Search code examples
msbuildmsdeploywebdeploy

Is there a built in way of executing an MSBuild target on the remote server using MSDeploy


Is there a built in way of executing an MSBuild target on the remote server using MSDeploy?

If I include a targets file in my project so that it is deployed is there a built in way or executing msbuild.exe? I know I could use runCommand but then the path to msbuild.exe could be wrong.


Solution

  • I've never heard of a built-in way to execute MsBuild from webdeploy. I don't even think it's necessarily a valid idea to have such a built-in way as target machine can have several versions of msbuild co-existing (v2.0\3.5\4.5\etc) - how do you tell msDeploy which to use?

    I suggest, that you use runCommand and refer to msBuild using system variables: %WinDir%\Microsoft.Net\Framework\v4.0.30319\

    Keeping in mind that framework versions move rather slowly you're safe (as you generally know, which version of the framework you target)

    UPD: if you want a better way to find msbuild location - check out this answer (read from registry)