Martin
Martin

Reputation: 1159

NuGet Packager Task uses wrong MSBuild in VSTS?

I have a .Net Standard 1.5 library and try to get an automated .NET Core build within Visual Studio Team Services, but somehow the NuGet Packager Task generates an error:

MSBuild auto-detection: using msbuild version '4.0' from 'C:\Windows\Microsoft.NET\Framework\v4.0.30319'.
Attempting to build package from 'My.Shared.csproj'.
##[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.  C:\a\1\s\src\My.Shared\My.Shared.csproj

The package should use automated semantic versions, which why I used the GitVersion extension. The GitVersion extension doesn't support .NET Core, which is why I need to create a separate NuGet Packager Task. The thing that wonders me is that the auto-detection is using MSBuild 4.0, because i'm building this using .NET Core (screenshot).

Things I've tried so far:

Any tips, tricks or ideas what's going on here and how to fix it? E.g. could it be fixed by instructing NuGet Packager Task to use MSBuild 15 and if so: how would I do that?

Upvotes: 3

Views: 857

Answers (2)

Martin
Martin

Reputation: 1159

Turns out it was the wrong Task for the job: I should've used a .NET Core Task with the pack command.

screenshot

Upvotes: 2

Marina Liu
Marina Liu

Reputation: 38136

Based on your first screenshot, It seems you only want to package *.csproj file(s), so if you use NuGet Command task (nuget spec) without additional arguments (-AssemblyPath).

The method to create a .nuspec file and then use it in NuGet Packager task can work fine.

After the NuGet Command task, it will create a Package.nuspec file in $(Build.SourcesDirectory). So you can specify Path to cspro or nuspec file to pack as $(Build.SourcesDirectory)\*.nuspec.

enter image description here

Upvotes: 0

Related Questions