I want to run MSBuild on a users PC as part of a WinForms ClickOnce deployment. That is after the application is downloaded and run (via clickonce) the application needs to kick off an MsBuild to handle database updates (using MigratorDotNet).

Q - How can my application robustly kick off MsBuild? i.e. how can it be sure what path it is installed, what if it is not installed, should I be including the MSBuild.exe in the clickonce package so that I know it is there for sure myself?

1

There are 1 answers

2
Sayed Ibrahim Hashimi On

You can look at the values for MSBuildToolsPath under

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\2.0
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\3.5
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0

But with ClickOnce I don't think you will be able to execute MSBuild scripts.

I don't think you are allowed to redistribute MSBuild. Since MSBuild is distributed with the .NET Framework you can just check to see if v2+ is installed. If not then you can prompt them to install it.