使用 MSBuild 输出发布到意外路径 [英] Publish using MSBuild outputs to unexpected path

查看:30
本文介绍了使用 MSBuild 输出发布到意外路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下命令发布我的 ClickOnce 应用程序:

I am using the following command to publish my application for ClickOnce:

D:\Builds\Client.App>"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" /m "Client\Client.csproj" /target:publish /property:VisualStudioVersion=14.0;ApplicationVersion=%version%;OutputPath="Client\bin\Release"

这最终会创建预期的文件,但在此路径中:

This ends up creating the expected files, but in this path:

D:\Builds\Client.App\Client\bin\Releaseapp.publish

注意到app.publish"之前缺少路径分隔符吗?

Notice the lack of path separator before the "app.publish"?

我也尝试在命令行上指定PublishUrl",但无济于事:

I've tried specifying the "PublishUrl" on the command line also, to no avail:

D:\Builds\Client.App>"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" /m "Client\Client.csproj" /target:publish /property:Configuration=Release;Platform="Any CPU";VisualStudioVersion=14.0;ApplicationVersion=%version%;OutputPath="%cd%\Client\bin\Release";PublishUrl="%cd%\Client\bin\Release\app.publish"

我使用了 %cd% 以确保不使用相对路径.

I have used the %cd% in order to ensure that relative paths aren't being used.

推荐答案

只需在 \Release 后添加另一个斜线

Just add another slash after \Release

D:\Builds\Client.App>"C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe" /m "Client\Client.csproj" /target:publish /property:VisualStudioVersion=14.0;ApplicationVersion=%version%;OutputPath="Client\bin\Release\"

如果这不起作用,那么您可以使用 PublishDir 属性明确指定最终的 clickonce 输出文件夹(如果未设置 PublishDir,msbuild 只会将默认的app.publish"文件夹附加到 OutputRoot).

If that doesn't work then you can use PublishDir property to explicitly specify the final clickonce output folder (msbuild would only append the default 'app.publish' folder to OutputRoot if PublishDir is not set).

这篇关于使用 MSBuild 输出发布到意外路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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