首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到MSBuild发布配置文件.pubxml.user文件

找不到MSBuild发布配置文件.pubxml.user文件
EN

Stack Overflow用户
提问于 2020-08-22 05:48:30
回答 1查看 506关注 0票数 1

我有这个解决方案(Project1),它有2个web应用程序项目和3个依赖库项目。主要的web应用程序项目使用发布配置文件构建和部署很好,但是,第二个web应用程序项目是一个API (如下所示),其发布配置文件的名称与主项目相同,但当然,它们会去不同的位置。不幸的是,当使用MSBuild命令(TeamCity服务器)时,在VS2019中使用发布配置文件可以很好地构建和部署项目:

代码语言:javascript
复制
MSBuild.exe /m /p:DeployOnBuild=True /p:PublishProfile=Test /t:Rebuild

我得到以下错误:

代码语言:javascript
复制
CopyAllFilesToSingleFolderForAspNetCompileMerge:
    Creating directory "obj\Debug\AspnetCompileMerge\Source".
    Copying all files to temporary location below for package/publish:
    obj\Debug\AspnetCompileMerge\Source.
    Copying bin\KuderCore.API.dll to obj\Debug\AspnetCompileMerge\Source\bin\Project1.API.dll.
    Copying bin\KuderCore.API.pdb to obj\Debug\AspnetCompileMerge\Source\bin\Project1.API.pdb.
    Copying Areas\HelpPage\HelpPage.css to obj\Debug\AspnetCompileMerge\Source\Areas\HelpPage\HelpPage.css.
    Copying Content\bootstrap-theme.css to obj\Debug\AspnetCompileMerge\Source\Content\bootstrap-theme.css.
    Copying Content\bootstrap-theme.min.css to obj\Debug\AspnetCompileMerge\Source\Content\bootstrap-theme.min.css.
    Copying Content\bootstrap.css to obj\Debug\AspnetCompileMerge\Source\Content\bootstrap.css.
    Copying Content\bootstrap.min.css to obj\Debug\AspnetCompileMerge\Source\Content\bootstrap.min.css.
    Copying favicon.ico to obj\Debug\AspnetCompileMerge\Source\favicon.ico.
    Copying fonts\glyphicons-halflings-regular.svg to obj\Debug\AspnetCompileMerge\Source\fonts\glyphicons-halflings-regular.svg.
    Copying Global.asax to obj\Debug\AspnetCompileMerge\Source\Global.asax.
    Copying Properties\PublishProfiles\Test.pubxml.user to obj\Debug\AspnetCompileMerge\Source\Properties\PublishProfiles\Test.pubxml.user.
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VisualStudio\v16.0\Web\Transform\
        Microsoft.Web.Publishing.AspNetCompileMerge.targets(615,5): error : Copying file Properties\PublishProfiles\
        Test.pubxml.user to obj\Debug\AspnetCompileMerge\Source\Properties\PublishProfiles\
        Test.pubxml.user failed. Could not find file 'Properties\PublishProfiles\Test.pubxml.user'
    Done Building Project "Project1\Project1.API\Project1.API.csproj" (Rebuild target(s)) -- FAILED.

Build FAILED.

由于某些原因,MSBuild没有生成.user文件,而是在轰炸。知道这是怎么回事吗?

EN

回答 1

Stack Overflow用户

发布于 2021-10-15 23:57:50

我今天遇到了这个问题。问题是pubxml.user文件被添加到.gitignore中,但也包含在解决方案中。这意味着文件在.csproj中有一个构建操作,因此当发布步骤发生时,msbuild将查找可能不存在的文件。

因为该文件应该被忽略,所以它可能不应该出现在.csproj中。我发现两个解决方案都有效:

  1. 从解决方案中移除该文件,因此.csproj。
  2. 将生成操作设置为"None“。这可以在文件的属性中进行配置。

无论采用哪种方法,msbuild在执行发布步骤时都将不再查找该文件,构建应该可以工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63530453

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档