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

♀尐吖头ヾ 提交于 2019-12-10 18:31:18

问题


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.


回答1:


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




回答2:


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.


来源:https://stackoverflow.com/questions/48078195/nuget-packager-the-default-xml-namespace-of-the-project-must-be-the-msbuild-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!