msbuild error: attribute "Version" in element <PackageReference> is unrecognized.
DSwift510 opened this issue · 5 comments
Hi,
I'm trying to use this plugin to build a C#/.NET project, originally created in VS2017 using the
'gradle clean msbuild' command. I am using a Mac.
Here is my build.gradle file:
`plugins {
id 'com.ullink.msbuild' version '2.19'
}
msbuild {
solutionFile = 'csharp/Basic/Producer/DEBProducer/DEBProducer.csproj'
targets = ['Clean','Rebuild']
}
`
Here is my gradle version
`gradle --version
Gradle 4.8.1
Build time: 2018-06-21 07:53:06 UTC
Revision: 0abdea078047b12df42e7750ccba34d69b516a22
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM: 1.8.0_131 (Oracle Corporation 25.131-b11)
OS: Mac OS X 10.13.6 x86_64`
This is my msbuild version:
msbuild -version Microsoft (R) Build Engine version 15.6.0.0 (xplat-master/ca830585 Sun Mar 25 19:24:09 EDT 2018) for Mono Copyright (C) Microsoft Corporation. All rights reserved.
Originally I was getting this error:
The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.
After adding the line the project element in my .csproj i received the following error:
The attribute "Version" in element <PackageReference> is unrecognized.
After a good amount of googling, every solution to this error I've come across is to upgrade from VS2015 to VS2017, however VS2017 is the Visual Studio version I am using. It appears to me that it may be using an older version of msbuild (I could be wrong), is it possible set the required version of ms build?
Thank you for your help!
May be the auto resolution not working very well on Mac as we don't have any Mac env
I have just updated the README, that shows you can use
msbuild {
msbuildDir = '......../msbuild/bin'
}
to specify the location of msbuildDir
Thank you for that! it appears that it is searching for xbuild not msbuild.
when I run 'gradle clean msbuild' now after adding version = '15.0', I get:
`Task :msbuild FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':msbuild'.
Cannot find an xbuild binary. Is mono SDK installed? (Existing binaries: [/Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/4.5/xbuild.exe, /Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/xbuild/14.0/bin/xbuild.exe, /Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/xbuild/12.0/bin/xbuild.exe])
`
and when I specify msbuildDir I get:
` Task :msbuild FAILED
Cannot open assembly '/Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/msbuild/15.0/bin/xbuild.exe': No such file or directory.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':msbuild'.
Process 'command 'mono'' finished with non-zero exit value 2
`
hi @DSwift510, can you try with the latest gradle-msbuild-plugin 2.21? in 2.20 it starts supporting msbuild instead of just xbuild in *nix environment
I appreciate the help! That's all it took, thank you for the help!
@DSwift510 on Mac you usually install the mono framework. Isn't that your case also?