Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget Packager the default XML namespace of the project must be the MSBuild XML namespace in TFS 2017

I changed the project type I am packaging from .net framework v4.6 to .net standard 2.0, now the build definition is failing in Nuget packager step and I am getting this error message.

[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 element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.

After researching about this error I understand that the NuGet packer step doesn't work on SDK-based csproj formats.

What is the best alternative available? I found the same issue here, but I can not find the command pack within the available commands.

like image 675
Yahya Hussein Avatar asked Oct 29 '22 21:10

Yahya Hussein


2 Answers

While the pack command does not appear in the dropdown, you can enter it manually into the field.

like image 133
Martin Ullrich Avatar answered Nov 01 '22 07:11

Martin Ullrich


This is how I resolved this issue:

1- Add package metadata to .csproj file.

2- Go to project properties -> package and check "Generate NuGet package on build".

3- In Build definition add the following tasks:

a- NuGet Restore:

  • Set path to solution.

  • Select Feeds in my NuGet.config as Feeds to use.

  • Set path to Nuget.config (Usually project root "src\nuget.config").

b- Visual Studio Build:

  • Set path to solution.

  • Platform: something like $(BuildPlatform).

  • Configuration: something like $(BuildConfiguration).

c- Copy and Publish Build Artifacts:

  • In contents enter *.nupkg.
  • Set Copy Root, Artifact name, and Artifact type.
like image 25
Yahya Hussein Avatar answered Nov 01 '22 09:11

Yahya Hussein