Get MSBuild Publish Directory

I have an asp.net mvc application that I publish using the publish function in Visual Studio, and I have a custom MSBuild task that needs a directory that I publish so that it knows where to copy some custom assembly files .., I tried $ (OutDir), $ (PublishDirectory) and a bunch of others ... how do I get this path?

+4
source share
3 answers

For me it worked:

$(PublishUrl) 

And I got what I need: my publication directory.

Thanks.

+3
source

You can use the PackageArchiveRootDir property to resolve it. The default value is obj\Debug\Package . Therefore, if you need the full path, you simply combine MSBuildProjectDirectory with PackageArchiveRootDir as: $(MSBuildProjectDirectory)\$(PackageArchiveRootDir) .

+1
source

I managed to combine $ (ProjectDir) and $ (PublishDir) to get the publication folder. However, I published the SharePoint application, but I think it should work for other cases.

For example, to call a program

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

Source: https://habr.com/ru/post/1303487/