如何在<Message />给定相对路径的情况下让MSBuild在任务中评估和打印绝对路径?
物业集团
<Source_Dir>..\..\..\Public\Server\</Source_Dir>
<Program_Dir>c:\Program Files (x86)\Program\</Program_Dir>
Run Code Online (Sandbox Code Playgroud)
任务
<Message Importance="low" Text="Copying '$(Source_Dir.FullPath)' to '$(Program_Dir)'" />
Run Code Online (Sandbox Code Playgroud)
产量
将''复制到'c:\ Program Files(x86)\ Program \'
我想使用Web Deploy来运行自定义部署设置.
因为我想在许多不同的环境(团队成员本地机器,4个不同的构建服务器)上运行时能够正常工作,我想部署到相对的本地路径.
我想要做的是:
但是当我输入本地文件路径以部署为:"..\Deploy_Production"
Web部署抱怨:
2>Connecting to ..\Deploy_Live...
2>Unable to create the Web site '../Deploy_Live'. The URL http://:0 is invalid.
Run Code Online (Sandbox Code Playgroud)
它就好像Web部署认为相对文件路径是网站URL.使用".. \"代替我的原因.
如何将WebDeploy部署到本地相对路径?
编辑1:
我试图在构建之前使用ConvertToAbsolutePath任务,但无济于事:
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish>http://mywebsite.com</SiteUrlToLaunchAfterPublish>
<publishUrl>..\Deploy_Production</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
<Target Name="BeforeBuild">
<ConvertToAbsolutePath Paths="$(publishUrl)">
<Output TaskParameter="AbsolutePaths" PropertyName="publishUrl" />
</ConvertToAbsolutePath>
</Target>
Run Code Online (Sandbox Code Playgroud)
编辑2: 上述工作,但只有在针对解决方案文件而不是项目文件运行命令行构建时