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

WixSharp with v4 toolset not getting compiled and msi not found #1484

Closed
abskulkarni opened this issue Apr 1, 2024 · 8 comments
Closed

WixSharp with v4 toolset not getting compiled and msi not found #1484

abskulkarni opened this issue Apr 1, 2024 · 8 comments

Comments

@abskulkarni
Copy link

Hi
I am trying to make Wix v4 work with WixSharp.
I added a "WixSharp custom UI (Wix v4)" project as shown below and just compiled it without any change.

image

image

Query 1: It is not getting compiled. Compile error says "wix.exe cannot be found. Ensure you installed it with dotnet tool install --global wix" What does this mean? It is due to the post build event command?

image

Query 2: If I remove post build even command, project gets compiled but there is no trace where msi file is generated. What is the issue here?

@oleg-shilo
Copy link
Owner

It means exactly what the error message says.
You need to have wix.exe (WiX toolset) installed.
It is a set of compilers, linkers and other WiX tools that WixSharp is using to orchestrate the building of msi files.

You can install wix.exe from the command prompt with this command: dotnet tool install --global wix

After that, you will be able to build your msi.

The post-build event there is for a reason. If you remove it then you will only compile the build script assembly but it will not be executed (you removed the execution command). So your msi will not be built.
You can read a bit more about this here: https://github.com/oleg-shilo/wixsharp/wiki/VS2019-%E2%80%93-2022-Templates#msi-authoring-steps

@oleg-shilo
Copy link
Owner

I have updated the home page to specifically describe WiX4 dependency:
https://github.com/oleg-shilo/wixsharp/wiki#dependencies

@abskulkarni
Copy link
Author

abskulkarni commented Apr 1, 2024

Thanks @oleg-shilo , I did what is suggested by you above. It generated msi.
But now when I ran that msi, it gave me run time error "object reference not set..."

image

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at FIS.Installer.IDRCommandLine.Dialogs.WelcomeDialog.ResetLayout()
   at FIS.Installer.IDRCommandLine.Dialogs.WelcomeDialog.WelcomeDialog_Load(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4645.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Microsoft.Deployment.WindowsInstaller
    Assembly Version: 3.0.0.0
    Win32 Version: 3.14.0.6526
    CodeBase: file:///C:/Users/E5370240/AppData/Local/Temp/2/MSI5811/Microsoft.Deployment.WindowsInstaller.DLL
----------------------------------------
WixSharp.UI
    Assembly Version: 1.25.2.0
    Win32 Version: 1.25.2.0
    CodeBase: file:///C:/Users/E5370240/AppData/Local/Temp/2/MSI5811/WixSharp.UI.DLL
----------------------------------------
WixSharp
    Assembly Version: 1.25.2.0
    Win32 Version: 1.25.2.0
    CodeBase: file:///C:/Users/E5370240/AppData/Local/Temp/2/MSI5811/WixSharp.DLL
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4654.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
. . .
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

@oleg-shilo
Copy link
Owner

Your ResetLayout method throws the exception because of something there being null while the reset was attempted.

Did you modify anything? Code, dialogs?

You have a few troubleshooting options here:

  • You can debug your dialog code.
    Put an assertion statement and attach the debugger when it asserts (see here)
  • Comment out ResetLayout completely. It's optional (just to improve scaling and rendering) and if there is something that prevents your dialogs from executing this method, then you can simply skip it.
  • Start with a VS simple template without custom UI. Just to verify that the MSI is built correctly.

@abskulkarni
Copy link
Author

Your ResetLayout method throws the exception because of something there being null while the reset was attempted.

Did you modify anything? Code, dialogs?

You have a few troubleshooting options here:

  • You can debug your dialog code.
    Put an assertion statement and attach the debugger when it asserts (see here)
  • Comment out ResetLayout completely. It's optional (just to improve scaling and rendering) and if there is something that prevents your dialogs from executing this method, then you can simply skip it.
  • Start with a VS simple template without custom UI. Just to verify that the MSI is built correctly.

I didn't change any code or dialog. I tried to build & run as it is. Also debugger is not getting attached to the process somehow. I know the process but it is not happening as expected.

@abskulkarni
Copy link
Author

I am trying to add new project Custom dialog WiX4. It is also not getting even compiled.
Is there any way we can have a screen share through MS Teams or something?

@abskulkarni
Copy link
Author

abskulkarni commented Apr 1, 2024

Hi @oleg-shilo
I had to do two things as of now to build any WiX4 project successfully and see msi running.

  1. Install wix.exe using command "dotnet tool install --global wix"
  2. Create any WiX4 project. If I compile it without any change, it gave me compile error for missing WixToolset.UI.wixext.dll in users .wix extension folder. So I installed "wixtoolset.ui.wixext v4.0.5" NuGet package in WiX4 project. Copied NuGet package's WixToolset.UI.wixext.dll to C:\Users[User].wix\extensions\WixToolset.UI.wixext\5.0.0-rc.2\wixext4 folder which was empty after step 1.

I hope I have done right and will not get any unwanted surprises while developing WiX 4 projects here after

@oleg-shilo
Copy link
Owner

Great. You solved it.

A few things to comment...

Also debugger is not getting attached...

Usually, it is caused by the debugger not being elevated. Try to have your VS run as admin.
image

Install wix.exe using command "dotnet tool install --global wix"

Yep, that is a one-off step to install the required tools.

So I installed "wixtoolset.ui.wixext v4.0.5"...

OMG, I cannot believe it. WiX team released a broken nuget package (5.0.0-rc) and it is still not patched.
Please read this thread it discusses the workaround.

Basically, you need to delete v5.0.0-rc manually and then install the working version. Until WiX team fixes the problem (it's been more than 3 weeks now) you will have to use @VietBuiHa's workaround:

dotnet tool install --global wix --version 4.0.4
wix extension add -g WixToolset.UI.wixext/4.0.4

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

2 participants