使用msbuild中的路径
我正在尝试使用msbuild和msbuild社区任务设置虚拟目录,但找不到如何指定位于使用msbuild中的路径,msbuild,msbuildcommunitytasks,Msbuild,Msbuildcommunitytasks,我正在尝试使用msbuild和msbuild社区任务设置虚拟目录,但找不到如何指定位于$(MSBuildStartupDirectory)之外的相对路径的方法 我的项目结构如下: c:\proj\ src\ website (this is where the virtual dir should point to) build\ build.proj (this is the msbuild file) 不幸的是,这不起作用-没有解析“..”,虚拟
$(MSBuildStartupDirectory)
之外的相对路径的方法
我的项目结构如下:
c:\proj\
src\
website (this is where the virtual dir should point to)
build\
build.proj (this is the msbuild file)
不幸的是,这不起作用-没有解析“..”,虚拟目录然后指向c:\proj\build\..\src\website
有人能给我一个如何在msbuild中使用(相对)路径的提示吗?我试过了,它对我很有效。我使用msbuild 4.0和community tasks版本1.3.0.504在Windows XP上对此进行了测试 我通常使用MSBuildProjectDirectory,因为MSBuildStartupDirectory可能指向其他位置,具体取决于msbuild的执行方式 下面的示例将创建网站并删除。。使用完整路径元数据从路径中删除条目
<ItemGroup>
<WebPath Include="$(MSBuildProjectDirectory)\..\src\website" />
</ItemGroup>
<Target Name="CreateWeb">
<Message Text="WebPath=@(WebPath)" Importance="high" />
<Message Text="FullPath=%(WebPath.FullPath)" Importance="high" />
<WebDirectoryCreate
VirtualDirectoryName="website"
VirtualDirectoryPhysicalPath="%(WebPath.FullPath)" />
</Target>
我试过了,效果很好。我使用msbuild 4.0和community tasks版本1.3.0.504在Windows XP上对此进行了测试 我通常使用MSBuildProjectDirectory,因为MSBuildStartupDirectory可能指向其他位置,具体取决于msbuild的执行方式 下面的示例将创建网站并删除。。使用完整路径元数据从路径中删除条目
<ItemGroup>
<WebPath Include="$(MSBuildProjectDirectory)\..\src\website" />
</ItemGroup>
<Target Name="CreateWeb">
<Message Text="WebPath=@(WebPath)" Importance="high" />
<Message Text="FullPath=%(WebPath.FullPath)" Importance="high" />
<WebDirectoryCreate
VirtualDirectoryName="website"
VirtualDirectoryPhysicalPath="%(WebPath.FullPath)" />
</Target>