Reputation: 373
I have a solution with many projects that target .net 4.6.1. On our MS build server it builds just fine. I recently added a project that targets .NET Standard 1.3. This will not build on the build server. It builds locally with VS2017 just fine. Build server VS has just been updated with all the latest.
The build error I'm getting is: The attribute "Version" in element <PackageReference> is unrecognized.
I am getting this for a few references. Here's one pulled from the project file: <PackageReference Include="System.Diagnostics.Process" Version="4.3.0"/>
Any ideas?
Upvotes: 14
Views: 26988
Reputation: 121
If anyone come across this thread, refer below solution for .Net Framework projects.
<PackageReference Include="System.Diagnostics.Process">
<Version>4.3.0</Version>
</PackageReference>
Upvotes: 12
Reputation: 3816
The right version of MSBuild is needed to build a project file with package references with version attribute. From Team City this screen shot shows an example. Note the name, 'Microsoft Build Tools 2017'. This is the package you want to have on your developer PC or target server.
This will be helpful for the CI /devops / build people out there that needs to build .NET applications / other apps requiring MSbuild on a build server.
Upvotes: 1
Reputation: 524
I was getting that same build error message using NuGet Version: 3.4.4.1321
I ran nuget update -self
Checking for updates from https://www.nuget.org/api/v2/.
Currently running NuGet.exe 3.4.4-rtm-1321.
Updating NuGet.exe to 5.1.0.
Update successful.
and afterwards there was no longer a build error when I ran nuget
Upvotes: 3
Reputation: 100581
Looks like you are not building using the MSBuild.exe that is included in VS 2017 (/ build tools) but rather the MSBuild.exe that ships with .NET Framework, which is an old version (and won't be updated).
Consider using VSWhere to locate MSBuild.exe
Upvotes: 13