开发者

Get publish directory in MSBuild

I have an asp.net mvc application that I am publishing with Publish feature of Visual Studio and I have a custom MSBuild task that needs the directory that I am 开发者_StackOverflowpublishing to so it knows where to copy some custom build files to... I've tried $(OutDir), $(PublishDirectory) and a bunch of others... how do I get this path?


For me what worked was:

$(PublishUrl)

And i got what i was needing: My publish directory.

Thanks.


I was able to combine $(ProjectDir) & $(PublishDir) to get the publishing folder. However, I was publishing SharePoint app but I think it should work for other cases as well.

For example to call a program

<Exec Command="&quot;$(ProjectDir)\app.exe&quot; &quot;$(ProjectDir)$(PublishDir) &quot;"/>


You should be able to use the PackageArchiveRootDir property to resolve that. The default value for that is obj\Debug\Package. So if you need the full path you just combine the MSBuildProjectDirectory with the PackageArchiveRootDir like: $(MSBuildProjectDirectory)\$(PackageArchiveRootDir).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜