dotnet build for .net 4.7 library fails citing missing references
See original GitHub issueSteps to reproduce
I have a ASP.Net Core 2 web application with class libraries that target the .net 4.7 framework. Visual Studio compiles fine but dotnet build fails. I’ve tracked the errors down to the class libraries which I’ve switched to use. I’ve followed the workarounds here (https://github.com/dotnet/standard/issues/481) and switched the library to use PackageReferences in the .csproj file and remove the packages.config. After some initial issues VS compiles fine and nuget restore works without issue but dotnet build still fails.
Expected behavior
dotnet build succeeds.
Actual behavior
Multiple errors about missing assemblies (ie Nuget Package references).
ApplicationSupport\EmailConfiguration.cs(4,7): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?) [C:\Dev\Neptune\Neptune.Common\Neptune.Common.csproj]
Environment data
dotnet --info
output:
.NET Command Line Tools (2.1.2)
Product Information: Version: 2.1.2 Commit SHA-1 hash: 5695315371
Runtime Environment: OS Name: Windows OS Version: 10.0.16299 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.2\
Microsoft .NET Core Shared Framework Host
Version : 2.0.3 Build : a9190d4a75f4a982ae4b4fa8d1a24526566c69df
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:9 (4 by maintainers)
Top GitHub Comments
Not sure if anyone is still facing this issue without a solution. After some experiments I found out that the issue is with dotnet cli’s having trouble restoring the nuget packages and referencing them properly for the old style projects. I have 2 solutions for this:
My suggestion or hope would be if dotnet could issue warnings rather than fail to build if it encounters framework assemblies (even if there are runtime errors later). The reason this is a big issue is that Visual Studio seems to support mixing full framework and .core packages. But then some functionality in VS breaks because under the covers it is calling dotnet and the cmdline is failing.
I’m in the process of trying to convert all of my code to .net core projects because I just don’t see the mixed code working very well.