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

2

6

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.

Sciamachy answered 3/1, 2018 at 13:17 Comment(0)
S
1

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.
Sciamachy answered 24/1, 2018 at 9:57 Comment(2)
Do you just skip the packing step while build step already generates the package?Botticelli
Yes exactly, "Generate NuGet package on build" should do the trickSciamachy
C
1

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

Citizen answered 3/1, 2018 at 17:9 Comment(4)
@YahyaHussein Have you resolved the issue by Martin's answer? any update?Ibnrushd
@AndyLi-MSFT No, Actually I used a totally different way, Martin's answer was a part of the solution, if you have an answer please paste it because it might be better than the way I am using, if you are searching for an answer, then I will explain what I did when I have the chance.Sciamachy
@YahyaHussein If you have resolved the issue , please share the solution as an answer here, thanks.Ibnrushd
@AndyLi-MSFT check the answerSciamachy
S
1

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.
Sciamachy answered 24/1, 2018 at 9:57 Comment(2)
Do you just skip the packing step while build step already generates the package?Botticelli
Yes exactly, "Generate NuGet package on build" should do the trickSciamachy

© 2022 - 2024 — McMap. All rights reserved.