我有这个解决方案(Project1),它有2个web应用程序项目和3个依赖库项目。主要的web应用程序项目使用发布配置文件构建和部署很好,但是,第二个web应用程序项目是一个API (如下所示),其发布配置文件的名称与主项目相同,但当然,它们会去不同的位置。不幸的是,当使用MSBuild命令(TeamCity服务器)时,在VS2019中使用发布配置文件可以很好地构建和部署项目:
MSBuild.exe /m /p:DeployOnBuild=True /p:PublishProfile=Test /t:Rebuild我得到以下错误:
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文件,而是在轰炸。知道这是怎么回事吗?
发布于 2021-10-15 23:57:50
我今天遇到了这个问题。问题是pubxml.user文件被添加到.gitignore中,但也包含在解决方案中。这意味着文件在.csproj中有一个构建操作,因此当发布步骤发生时,msbuild将查找可能不存在的文件。
因为该文件应该被忽略,所以它可能不应该出现在.csproj中。我发现两个解决方案都有效:
无论采用哪种方法,msbuild在执行发布步骤时都将不再查找该文件,构建应该可以工作。
https://stackoverflow.com/questions/63530453
复制相似问题