mono / monodevelop

MonoDevelop is a cross platform .NET IDE
http://www.monodevelop.com
2.84k stars 1.02k forks source link

Monodevelop cannot resolve well the paths from libraries in GAC in projects with new template engine #3768

Open netonjm opened 6 years ago

netonjm commented 6 years ago

1) Create a new project with a template created with the new template engine (IoT template will work) 2) Add the reference of Gtk library to the project

Expected: Project compiles without problem Result: Project cannot resolve the path and types in the library with a compilation errors.

image

I fixed adding the reference with the full path.

Visual Studio Enterprise 2017 for Mac (Preview) Version 7.4 Preview (7.4 build 985) Installation UUID: ac2f5f5a-65c6-4e02-aae1-61d2ac9aabc1 Runtime: Mono 5.8.0.123 (2017-10/38502063cac) (64-bit) GTK+ 2.24.23 (Raleigh theme)

Package version: 508000123

NuGet Version: 4.3.1.4445

.NET Core Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 2.0.5 2.0.3 2.0.0 1.1.2 1.1.1 1.0.5 1.0.4 1.0.3 SDK: /usr/local/share/dotnet/sdk/2.1.4/Sdks SDK Versions: 2.1.4 2.0.3 2.0.0 1.0.3 1.0.1 1.0.0-preview2-003156 MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Sdks

VS bug #567922

jsuarezruiz commented 6 years ago

Happens the same to me. Using the GAC I have problems solving dependency. I have needed to use the full path.

image

image

Tested in Visual Studio 7.4 build 985

mrward commented 6 years ago

This looks like an MSBuild problem. If I create an sdk style project, that targets net47 or net461 and uses gtk#, it fails to compile from the command line.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net47</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
    <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
    <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
    <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
  </ItemGroup>
</Project>

Warnings are shown for each GTK# assembly reference.

 /Library/Frameworks/Mono.framework/Versions/5.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(2057,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [~/NetCoreConsole/NetCoreConsole.csproj]

The build fails with errors about any use of Gtk.

error CS0246: The type or namespace name 'Gtk' could not be found (are you missing a using directive or an assembly reference?

A non sdk style project, that targets .NET 4.7 and uses GTK#, builds OK from the command line.