从MSBuild发布似乎停止工作.... [英] Publish From MSBuild Seems to Stop Workin At Times....

查看:430
本文介绍了从MSBuild发布似乎停止工作....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我目前要发布到保留文件夹的powershell脚本片段...

Here's the powershell script snippet I currently to publish to a holding folder...

$msbuild = """C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe"""

$apiproj = "$source\Development\12.0\Web\MyWebApp\MyCo.WebApi\MyCo.WebApi.csproj" 

start-process $msbuild -ArgumentList @($apiproj,'/p:DeployOnBuild=true','/p:PublishProfile="fs2 deployment"','/p:configuration=Release','/p:VisualStudioVersion=15.0','/p:ExcludeGeneratedDebugSymbol=false','/p:AspnetMergePath="C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools"') -Wait

一切都按预期工作了一段时间,但我们可能会注意到文件夹中的一个或两个文件不是最新的 发布配置文件设置为首先删除文件,但有时某些内容不是最新的或与构建服务器上的
输出不匹配。

Everything works as intended for a while, but then we might notice a file or two in a folder that is not the latest.  The Publish profile is set to delete files first, but sometimes some things are just not current or don't match the output sitting on the build server.

什么似乎可以解决问题是进入Visual Studio并发布。 这些文件是正确的,后续的CI构建似乎正确地推出文件 - 至少在注意到其他东西之前。

What seems to remedy the problem is to go into Visual Studio and publish.  The files are then correct and subsequent CI builds seem to push out files properly - at least until something else is noticed.

我是否应该在命令行上传递这个......

Should I be passing this on the command line as well ...

/p:DeleteExistingFiles=True

这是我们在上面指出的发布配置文件中,但不确定如果MSBuild可能有点不同,需要专门设置的那个标志。

That is in the publish profile file we point to above, but not sure if MSBuild might be a bit different and need that flag specifically set.

任何关于此的信息都赞赏!

Any info on this appreciated!

谢谢!!

谢谢

推荐答案

朋友,

欢迎来到MSDN论坛。

Welcome to MSDN forum.

>> 我是否应该在命令行上传递这个...

是的,在我检查之后,我们必须在命令行上传递这个值,即使我们在.pubxml中将它设置为true。

Yes, after my check, we have to pass this value on command-line even though we've set it to true in .pubxml.

此外,正在尝试发布将项目添加到文件夹中,您可以添加&pbsp:/ p:WebPublishMethod = FileSystem来检查它是否有帮助。

Also, as you're trying to publish the project to a folder, you can add a /p:WebPublishMethod=FileSystem to check if it helps.

>> 但不确定MSBuild是否有点不同,需要专门设置该标志。

有时它们确实有区别,例如在vs中构建时,vs将显示最新版本,如果它认为项目没有过时则不会构建,但msbuild命令行将始终构建。

Sometimes they do have difference such like when building in vs, vs will display Up-to-date and won't build if it thinks the project is not out-of-date, but msbuild command-line will always build.

我可以像你一样重现同样的问题,尝试在命令行中传递两个属性,如果同样的问题仍然存在并影响你的web部署,请分享发布文件夹的更多细节。(似乎文件夹可能没有 - 到目前为止但是
内容将实际更新,这不会影响网络应用程序)

And I can reproduce the same issue like you on my side, trying passing the two property in command-line, if the same issue persists and affect your web-deploy, please share more details of the publish folder. (It seems the folder maybe not up-to-date but the content will be updated actually, which won't affect the web-app)

期待您的回复。

最好的问候

Lance


这篇关于从MSBuild发布似乎停止工作....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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