I have a solution which used to compile just fine, but after installing Visual Studio 2015 Update 3 RC it fails with the following output:
Attempting to build package from 'Core.csproj'.
MSBuild auto-detection: using msbuild version '3.5' from 'C:\Windows\Microsoft.NET\Framework\v3.5'.
The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
I'm using the following command:
nuget pack "C:\Projects\c2WMO\Mobile\10 - Kanzi\Kanzi\Core\Core.csproj" -OutputDirectory "C:\Projects\c2WMO\Mobile\10 - Kanzi\Kanzi\Core\bin\Debug" -Properties Configuration="Debug"`;Platform="AnyCPU" -NonInteractive
Note that the csproj I'm trying to build is a Portable Class Library project. I'm using the latest version of the NuGet.exe command line tool: NuGet Version: 3.4.4.1321
Thanks very much for the report.
Does this fail to build inside of VS as well?
Or just when you build using the nuget pack command?
Which NuGet and VS did this last work for you?
Can you share a zip of a similar project so we have a good repro project? (if it can be public, paste the zip into a comment -- otherwise, share it with our team only at [email protected])
Project builds fine inside Visual Studio, except for the creation of the NuGet package. I'm using the CreateNewNuGetPackageFromProjectAfterEachBuild package to make that happen.
The version of that package (1.8.5) I was using included NuGet.exe 2.8.50506.49 which failed with a different error message:
A numeric comparison was attempted on "10.0.11000.0" that evaluates to "10.0.11000.0" instead of a number, in condition "'$(TargetPlatformVersion)' >= '10.0.11000.0'". C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets
Strange thing is that I only get that message when NuGet.exe is run during the build inside Visual Studio. If I run it from the command line it works just fine.
In order to try and remedy the situation I decided to see if there was a newer version of the CreateNewNuGetPackageFromProjectAfterEachBuild package and installed that (1.8.9) which includes NuGet.exe 3.3. After doing that I got the error message I posted earlier, so I updated NuGet.exe itself (using nuget update -self) to see if that helps but unfortunately it did not.
All of this was working fine using Visual Studio 2015 Update 2.
I'm working on a repro project right now and I'll send it to you by email shortly. Just send it.
just installed visual studio 2015 update 3 on a build machine which build fine with the previous Update2 ,and I've start receiving the exact same error (i'm reached this page by googling)
Microsoft.AppXPackage.Targets (283): A numeric comparison was attempted on "10.0.11000.0" that evaluates to "10.0.11000.0" instead of a number, in condition "'$(TargetPlatformVersion)' >= '10.0.11000.0'"
the project is a business app with Silverlight and an asp.net website.
This seems to be due to the fact that the msbuild.exe in your path is version 3.5. MSBuild 3.5 does not have two .dll's that we are attempting to load dynamically ("Microsoft.Build.dll and Microsoft.Build.Framework.dll) and we are not handling this case gracefully.
This problem can be easily reproduced by executing:
nuget.exe pack MyProj.csproj -msbuildversion 3.5
While we work on a resolution to this issue, please make sure NuGet.exe uses MSBuild 4.0 or higher. This can be done by making sure MSBuild 4.0 or higher is the first to resolve in your path or by passing the -msbuildversion option. For example, I use MSBuild 14.0 (which shipped with Visual Studio 2015).
nuget.exe pack MyProj.csproj -msbuildversion 14.0
@jmezach and @PhotoAtomic, could you open the Package Manager Console in Visual Studio with your project open and selected. Then, could you execute the two following commands and respond with the output for each?
MSBuild.exe /version
Get-Command MSBuild.exe
We had this same problem in our deployment script outside of VS. Now we are using following msbuild:
_C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe_
and everything works fine!
it's hard to me to repro now because I've restored a previous restore point, then repaired the VisualStudio 2015 installation. and now the things works, but i'll try the command you gave me and i'll post the output it it will be something meaning full, anyway as I said now it works so i'm not in the same situation as before :(
@jmezach, could you run the commands that I mentioned above?
Also, could you run where msbuild from both plain old cmd.exe and from the Visual Studio developer command prompt?
I just ran where msbuild from cmd.exe and got:
C:\Users\jonat.JONATHANM01>where msbuild
C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe
When I run it from the Visual Studio 2015 Developer Command prompt I get this:
C:\Program Files (x86)\Microsoft Visual Studio 14.0>where msbuild
C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe
Running msbuild.exe /version from the Package Manager Console gave me the following:
PM> msbuild.exe /version
Microsoft (R) Build Engine Version 3.5.30729.8763
[Microsoft .NET Framework, Version 2.0.50727.8745]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
And Get-Command msbuild gives me this:
PM> Get-Command msbuild
CommandType Name Version Source
----------- ---- ------- ------
Application MSBuild.exe 3.5.307... C:\WINDOWS\\Microsoft.NET\Framework\v3.5\MSBuild.exe
@jmezach, yes this is the cause of the issue. Could you modify your %PATH% so that MSBuild 4.0 or later is first?
Is it necessary to have MSBuild in your user %PATH%? For my development environment, I simply depend on the Developer Command prompt to have it's own environment variables and %PATH% that make MSBuild available. For me, MSBuild is not in my %PATH% for plain old cmd.exe.
Thanks for reporting this issue. We have not been able to reproduce this issue. If you are still able to reproduce this with the latest NuGet version, please provide additional steps.
Most helpful comment
This seems to be due to the fact that the
msbuild.exein your path is version 3.5. MSBuild 3.5 does not have two .dll's that we are attempting to load dynamically ("Microsoft.Build.dllandMicrosoft.Build.Framework.dll) and we are not handling this case gracefully.This problem can be easily reproduced by executing:
While we work on a resolution to this issue, please make sure NuGet.exe uses MSBuild 4.0 or higher. This can be done by making sure MSBuild 4.0 or higher is the first to resolve in your path or by passing the
-msbuildversionoption. For example, I use MSBuild 14.0 (which shipped with Visual Studio 2015).@jmezach and @PhotoAtomic, could you open the Package Manager Console in Visual Studio with your project open and selected. Then, could you execute the two following commands and respond with the output for each?