Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BuildMsi() Requires elevated privileges #1749

Open
Amit-ram1103 opened this issue Feb 14, 2025 · 5 comments
Open

BuildMsi() Requires elevated privileges #1749

Amit-ram1103 opened this issue Feb 14, 2025 · 5 comments

Comments

@Amit-ram1103
Copy link

I'm using the BuildMsi() method of WixSharp.Compiler in my Web Application. I have hosted it in IIS and when I run the Application Pool in Local System account (Highest Privilege), the method creates a msi file and returns the path of the file. Whenever I run it un ApplicationPoolIdentity, msi file isn't created and null is returned.

Need help in overcoming this issue.

@Rain36522
Copy link

Hello
Did you try to run as admin directly? Do you have some log?

@Amitram1103
Copy link

I didn't try to run as admin directly.
Once I upgraded to wix5 and installed the necessary Nuget packages, the BuildMsi() is returning null instead of created a msi file and returning the path.
Then I tried to run it with elevated privileges and it was creating a msi file as well as returning the path of the file.

@oleg-shilo
Copy link
Owner

This means that when your build script (setup.cs) fails it prints the error messages in the build output some dotnet.exe/msbuild.exe can interpret the errors and fail the entire build.

If you want to detect the failure in the build script itself then you need to check the return value of BuildMsi as you did.

@Amitram1103
Copy link

It is returning null always. And when I check the folder, the msi file is not created.

@oleg-shilo
Copy link
Owner

It cannot be always since you wrote this "Then I tried to run it with elevated privileges and it was creating a msi file as well as returning the path of the file."

So for some reason in that environment, you need to be elevated.
I advise you to check the build output and look for the error entries. If this does not help, share your project so I can try and see what is happening.

You can also debug the project by yourself. Just disable 'just my code', put breakpoint at BuildMsi and go in with F11 when the breakpoint fires.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants