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=""$(ProjectDir)\app.exe" "$(ProjectDir)$(PublishDir) ""/>
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)
.
精彩评论