Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

[gtk2] Update templates to Gtk# 2.12 #5183

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

directhex
Copy link
Contributor

Real talk: Gtk# 2.6 shipped in 2005, and we don't support 2.4.

This should fix Gtk#2 projects going screwy if you have Gtk#3 installed

Real talk: Gtk# 2.6 shipped in 2005, and we don't support 2.4.

This should fix Gtk#2 projects going screwy if you have Gtk#3 installed
<Reference type="Package" SpecificVersion="true" refto="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference type="Package" SpecificVersion="true" refto="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference type="Package" SpecificVersion="true" refto="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference type="Package" SpecificVersion="true" refto="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
</References>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other templates specify Gtk2. If you "hardcode" this to gtk2 we should probably rename the template to something like FSharpGtk2Project

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am okay with this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a rename, which seems to have worked.

This brings the template in line with other Gtk2 templates for C#/VB
@directhex
Copy link
Contributor Author

It seems even with the changes in this PR, it doesn't force 2.12. The version bumping is unbeatable.

  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
      <Package>gtk-sharp-2.0</Package>
    </Reference>
    <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
      <Package>gtk-sharp-2.0</Package>
    </Reference>
    <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
      <Package>glib-sharp-2.0</Package>
    </Reference>
    <Reference Include="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
      <Package>glade-sharp-2.0</Package>
    </Reference>
    <Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
      <Package>gtk-sharp-2.0</Package>
    </Reference>
    <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
      <Package>gtk-sharp-2.0</Package>
    </Reference>
    <Reference Include="Mono.Posix" />
  </ItemGroup>
/usr/lib/mono/4.5/csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /platform:x86 /errorreport:prompt /warn:4 /define:DEBUG /errorendlocation /preferreduilang:en-GB /highentropyva+ /reference:/usr/lib/mono/gac/atk-sharp/3.0.0.0__35e10195dab3c99f/atk-sharp.dll /reference:/usr/lib/mono/gac/gdk-sharp/3.0.0.0__35e10195dab3c99f/gdk-sharp.dll /reference:/usr/lib/mono/gac/glade-sharp/2.12.0.0__35e10195dab3c99f/glade-sharp.dll /reference:/usr/lib/mono/gac/glib-sharp/3.0.0.0__35e10195dab3c99f/glib-sharp.dll /reference:/usr/lib/mono/gac/gtk-sharp/3.0.0.0__35e10195dab3c99f/gtk-sharp.dll /reference:/usr/lib/mono/4.7-api/Mono.Posix.dll /reference:/usr/lib/mono/4.7-api/mscorlib.dll /reference:/usr/lib/mono/gac/pango-sharp/3.0.0.0__35e10195dab3c99f/pango-sharp.dll /reference:/usr/lib/mono/4.7-api/System.Core.dll /reference:/usr/lib/mono/4.7-api/System.dll /debug+ /debug:portable /optimize- /out:obj/x86/Debug/button4.exe /subsystemversion:6.00 /resource:gtk-gui/gui.stetic,gui.stetic /target:winexe /utf8output gtk-gui/generated.cs MainWindow.cs gtk-gui/MainWindow.cs Program.cs Properties/AssemblyInfo.cs "/tmp/.NETFramework,Version=v4.7.AssemblyAttributes.cs"

Looking at the msbuild log, it seems MD is always resolving from GAC, not from pkg-config, and ignoring the exact version requirement.

@directhex
Copy link
Contributor Author

... because msbuild doesn't support pkg-config, but xbuild does. msbuild on the csproj fails, xbuild on the csproj is fine.

@directhex
Copy link
Contributor Author

@radical this seems bigger than it first appeared, you're the domain expert.

Summary: xbuild resolves from PkgConfig (a custom search path location in Mono Microsoft.Build.Tasks), and returns the specified assembly version. msbuild doesn't support PkgConfig resolver, and also ignores specific version requests in favour of $LATEST found in GAC. How to fix?

@radical
Copy link
Member

radical commented Jun 25, 2018

Is this just for these specific templates? You could try <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" HintPath="$(MSBuildBinPath)\..\..\..\gtk-sharp-2.0\gtk-sharp.dll"> .

@directhex
Copy link
Contributor Author

@radical it looks like adding a <HintPath /> to the csproj does indeed fix it, both with msbuild on the command line and in the IDE. It's unfortunate that the HintPath is distribution-specific though, so it breaks the ability to open projects on Ubuntu created in SUSE

I guess we need to add that to the IDE's pkg-config reference handling code?

Base automatically changed from master to main March 9, 2021 14:17
@akoeplinger akoeplinger changed the base branch from main to master March 15, 2021 17:02
Base automatically changed from master to main March 15, 2021 17:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants