Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 59605 on
GitHub or Developer Community if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
1. clone e.g. cecil from https://github.com/jbevain/cecil
2. cd cecil
3. nuget restore
Super unhelpful message shows up
>/NuGet/Microsoft.NuGet.targets(178,5): error : Your project is not referencing the ".NETFramework,Version=v4.0" framework. Add a reference to ".NETFramework,Version=v4.0" in the "frameworks" section of your project.json, and then re-run NuGet restore. [cecil/Mono.Cecil.csproj]
The problem seems to be in Nuget or msbuild because Nuget creates obj/project.assets.json file which msbuild chokes on, manually removing the file fixes the build.
So far I found only similar complains here https://github.com/dotnet/sdk/issues/1321 with no solution.
VS Mac does not run any restore when the Mono.Cecil.sln is opened. So the build works there with the default configuration selected.
NuGet restore and msbuild /t:restore both generate restore files (project.assets.json, nuget.g.targets, nuget.g.props) for several projects. (Mono 184.108.40.206 (2017-06/1afb931de69 Mon Aug 28 08:21:28 EDT 2017)).
Looking at the diagnostic restore output it looks like it is treating the various projects as .NET Standard. The Mono.Cecil.csproj defines a NetStandard property:
<NetStandard Condition=" $(Configuration.StartsWith('netstandard')) Or '$(NuGetRestoreTargets)' != '' ">true</NetStandard>
<NetStandard Condition=" '$(NetStandard)' == '' ">false</NetStandard>
NetStandard seems to be true in the restore output since NuGetRestoreTargets is defined. This setting then causes msbuild to import the NetStandard.props file which sets the TargetFramework to be .NETStandard. Then when you build and do not use the netstandard configuration the build then fails.
Testing this on Windows with NuGet 4.3.3.exe. If a normal command prompt is opened so MSBuild 14 is used no restore occurs and NuGet outputs a message:
Nothing to do. None of the projects in this solution specify any packages for NuGet to restore.
If you open a VS 2017 command prompt so MSBuild 15 is used then NuGet restores the various restore files the same as Mono's MSBuild. Then building the solution fails in the same way.
So this seems to suggest that it is an MSBuild 15 problem which affects both Windows and Mono or maybe even a Mono.Cecil project problem.