本文介绍了teamcity 错误 MSB4057:目标“包";项目中不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法为使用 4.7 框架的 Dot Net Core 项目创建包.我在 teamcity 中使用 msbuild/t:pack/p:COnfiguration=Release 命令来创建一个包.

Unable to create packages for a Dot Net Core project using 4.7 framework. I am using msbuild /t:pack /p:COnfiguration=Release command in teamcity to create a package.

<Project Sdk="Microsoft.NET.Sdk">
 <PropertyGroup>
 <TargetFramework>net471</TargetFramework>
 </PropertyGroup>
</Project>

NuGet.Build.Tasks.Pack 已安装在项目中.

NuGet.Build.Tasks.Pack is installed in the project.

我们只使用 .net core csproj 结构而不使用 .net core 作为目标框架,所以它不能通过 .net CLI 编译 - 这就是我们通过 MSBuild 而不是 .net CLI 构建项目的原因请指导如何为此类项目创建包.

we use only .net core csproj structure but not .net core as target framework so it can't be compiled via .net CLI - that's why we build projects via MSBuild and not .net CLIPlease guide how to create packages for such project.

推荐答案

似乎 TeamCity 使用 msbuild 的方式,默认情况下它会创建一个包装脚本,然后调用它.包装器操作方式中的某些因素会阻止其正常工作.

Seems that the way TeamCity operates with msbuild, by default it creates a wrapper script and then calls that. Something in the way the wrapper opperates prevents it from working properly.

TeamCity MSBUILD 文档 中有关于实现的说明请注意,您可以禁用包装器.我试过了,它似乎有效.

At the TeamCity MSBUILD Docs there is a note on Implementation Note that you can disable the wrapper. I tried this and it seemed like it works.

禁用包装器行为 teamcity.msbuild.generateWrappingScriptfalse.我通过在构建配置中添加 teamcity.msbuild.generateWrappingScript 作为配置参数来实现这一点,其值为false".然后我重新运行构建并按预期运行.

To disable the wrapper behaviour teamcity.msbuild.generateWrappingScript to false.I did this by adding teamcity.msbuild.generateWrappingScript as a configuration parameter on the build config with the value "false". Then I re-ran the build and it behaved as expected.

这篇关于teamcity 错误 MSB4057:目标“包";项目中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 09:08