Nuget Packager 项目的默认 XML 命名空间必须是 TFS 2017 中的 MSBuild XML 命名空间 [英] Nuget Packager the default XML namespace of the project must be the MSBuild XML namespace in TFS 2017

查看:39
本文介绍了Nuget Packager 项目的默认 XML 命名空间必须是 TFS 2017 中的 MSBuild XML 命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将要打包的项目类型从 .net framework v4.6 更改为 .net standard 2.0,现在构建定义在 Nuget 打包程序步骤中失败,我收到此错误消息.

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.

[错误]项目的默认 XML 命名空间必须是 MSBuildXML 命名空间.如果项目是以 MSBuild 2003 格式创作的,请添加 xmlns="http://schemas.microsoft.com/developer/msbuild/2003"到元素.如果项目是在旧的1.0 或 1.2 格式,请转换为 MSBuild 2003 格式.

[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.

在研究此错误后,我了解到 NuGet 打包程序步骤不适用于基于 SDK 的 csproj 格式.

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.

推荐答案

我是这样解决这个问题的:

This is how I resolved this issue:

1- 将包元数据添加到 .csproj 文件.

1- Add package metadata to .csproj file.

2- 转到项目属性 -> 包并选中在构建时生成 NuGet 包".

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

3- 在构建定义中添加以下任务:

3- In Build definition add the following tasks:

a- NuGet 还原:

a- NuGet Restore:

  • 设置解决方案的路径.

  • Set path to solution.

在我的 NuGet.config 中选择 Feed 作为要使用的 Feed.

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

设置 Nuget.config 的路径(通常是项目根目录src uget.config").

Set path to Nuget.config (Usually project root "src uget.config").

b- Visual Studio 构建:

b- Visual Studio Build:

  • 设置解决方案的路径.

  • Set path to solution.

平台:类似于 $(BuildPlatform).

Platform: something like $(BuildPlatform).

配置:类似于 $(BuildConfiguration).

Configuration: something like $(BuildConfiguration).

c- 复制和发布构建工件:

c- Copy and Publish Build Artifacts:

  • 在内容中输入 *.nupkg.
  • 设置复制根、工件名称和工件类型.

这篇关于Nuget Packager 项目的默认 XML 命名空间必须是 TFS 2017 中的 MSBuild XML 命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆