oleg-shilo/wixsharp

dotnet tool install --global wix - Need for all users

abskulkarni opened this issue · 12 comments

Hi @oleg-shilo
While compiling WixSharp v4 project, I need to run install dotnet tool install --global wix for wix.exe and extesion. However, it install Wix under %USERPROFILE%.dotnet folder.
It is creating a problem as we build same application on our build server where we need to use service account which cannot be used interactively and install Wix in its profile folder.

Question is, how we can install Wix.exe for all users? (dotnet tool install --global wix)
Like instead of %USERPROFILE%, it should install in some global folder & WixSharp still finds it.
By the way, I tried with using --tool-path option in dotnet tool install and installed wix.exe in custom path, added that path in PATH env variable. But still WixSharp project compilation failed saying it cannot find wix.exe.

Also another question : how does wix.exe is referred by WixSharp project while building MSI? Can we manipulate/change wix.exe path referenced by WixSharp project?

Question is, how we can install Wix.exe for all users? (dotnet tool install --global wix)
Like instead of %USERPROFILE%, it should install in some global folder & WixSharp still finds it.

This is completely outside of WixSharp control. I am not sure if .NET Tool manager allows that.
Adding the custom location to PATH is expected to solve the problem. See this lookup algorithm:
https://github.com/oleg-shilo/wixsharp/blob/wix-v4-master/Source/src/WixSharp/CommonTasks.cs#L2079

Though I cannot test this scenario right now.

You can also go with installing wix as a local tool. You create the tool-manifest file and indicate there that you need wix. Then during the build will will be downloaded and copied to the project dir without the need to use anything interactively.

Only one correction to my above suggestion about "local tool".
After creating the tool-manifest file you need to call "dotnet tool restore" from the proj folder. This will install the right version of the tool but, again, without any user interaction.