rmoc
Posts: 49
Joined: Tue Mar 14, 2017 8:27 pm

.net Core Custom Action dosn't work

Hello,

I have created a custom action based on .net Core 8. It runs correctly on my computer.
work.png
work.png (58.67 KiB) Viewed 16320 times
However, the following error is displayed in my test VM.
error.png
error.png (17.62 KiB) Viewed 16320 times
However, I cannot find an error here. The .net Core 8 Runtime is installed and other .net Core 8 programmes are executed without errors.
Enclosed is the MSI log file
testactionlog.txt
(72.61 KiB) Downloaded 291 times
of the execution.
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: .net Core Custom Action dosn't work

Hello Rene,

That error is displayed when something in your code fails during the installation.

As we can see, it is displayed after the messagebox, therefore it fails after.

What I would suggest is trying to debug further your custom action's code to see what the problem is.

If you don't have many lines of code, you can add a messagebox after each line and see where exactly it fails. After that, we can see what the reason might be.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rmoc
Posts: 49
Joined: Tue Mar 14, 2017 8:27 pm

Re: .net Core Custom Action dosn't work

Hi Catalin

i have used the VS2022 Custom - Action Template from you. I have now extended it to include the output of the MessageBox in the first line.
source.png
source.png (73.22 KiB) Viewed 16208 times
Unfortunately without success.
error2.png
error2.png (8.42 KiB) Viewed 16208 times
I have attached my setup and CustomAction project here.
TestNetAction.zip
(83.31 KiB) Downloaded 341 times
Regards
René
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: .net Core Custom Action dosn't work

Hello René,

Apologies for the quite delayed reply on this.

I've had a look over this and it seems to be a problem, but I wasn't able to find it just yet.

Please allow me a bit more time to run this by the dev team and I'll followup as soon as I will have more information (most likely tomorrow).

Thank you for your patience!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rmoc
Posts: 49
Joined: Tue Mar 14, 2017 8:27 pm

Re: .net Core Custom Action dosn't work

Hello Catalin,

Is there any news here? Otherwise I would have to start looking for an alternative execution of the CustomActions.

Regards,
René
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: .net Core Custom Action dosn't work

Hello René,

Oh wow, I'm so sorry for this - I totaly overlooked this thread because it was marked as "answered". :(

On my VM, I had a really strange error "Failed to start .NET" - so not really the same as yours. This ended up happening because I did not have the DLL file on my VM and I was building the project using dummy resources.

After fixing that, everything worked just fine on that VM as well as on my own machine.
Screenshot_232.png
Screenshot_232.png (312.9 KiB) Viewed 14911 times

After further playing with this, I think the issue actually is the fact that you do not have the WindowsForms support on your end.
Screenshot_236.png
Screenshot_236.png (5.08 KiB) Viewed 14910 times

On my end, when I had only the runtime installed, I managed to reproduce the same issue:
Screenshot_233.png
Screenshot_233.png (176.11 KiB) Viewed 14911 times

Please note that in order to have the WinForms support, you need to .NET Desktop Runtime and, of course, a version matching yours from the project, aka 8.x:
Screenshot_234.png
Screenshot_234.png (34.87 KiB) Viewed 14911 times

Here is a download link:

https://dotnet.microsoft.com/en-us/download/dotnet/8.0

and you can download the SDK as it contains all the others:
Screenshot_235.png
Screenshot_235.png (47.68 KiB) Viewed 14911 times

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rmoc
Posts: 49
Joined: Tue Mar 14, 2017 8:27 pm

Re: .net Core Custom Action dosn't work

Hello Catalin

Thank you for your test. I have probably found the cause. But I think something is still not quite right. My software is based on .net core 8 (x64). I have therefore only installed the 64-bit version of the desktop runtime as prerequisites. My custom action DLL is compiled as ‘Any CPU’ and should therefore run under x86/x64. However, it seems that the custom action explicitly runs as x86. However, since only the x64 desktop runtime is installed, this error occurs with the current AI version.
errorNetCoreRuntime.png
errorNetCoreRuntime.png (11.37 KiB) Viewed 14750 times
That's ok for now. If I install the .net core 8 (x86) version, the custom action runs as desired.

I have therefore now activated this check box in the custom action as I don't really want to install the x86 runtime if I don't need it myself.
x64.png
x64.png (3.24 KiB) Viewed 14750 times
The custom action is now started.
x64_error.png
x64_error.png (155.39 KiB) Viewed 14750 times
However, the setup is cancelled at the following line. The next MessageBox is not displayed.

Code: Select all

....
System.Windows.Forms.MessageBox.Show("Second line");

// the custom action is cancelled here
Win32Window msiWindow = new Win32Window(session.GetMsiWindowHandle());

System.Windows.Forms.MessageBox.Show("Attach your debugger now!", "Advanced Installer custom action");
....
Regards,
René
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: .net Core Custom Action dosn't work

Hello René,

You are indeed right, something is not quite right here.

I've run the test once again and I'm also able to reproduce this - I think I didn't even go past the "First line" messagebox last time I tested and that's why I did not see this error.

I'm now working together with the dev of this feature to see if we can find the root cause of this.

I will update this thread as soon as I'll have more details.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: .net Core Custom Action dosn't work

Hello René,

It looks like this has been a bug on our side, indeed.

I will email you a file that you can just replace and this should be fixed.

After testing, please confirm that everything is working as expected.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rmoc
Posts: 49
Joined: Tue Mar 14, 2017 8:27 pm

Re: .net Core Custom Action dosn't work

Hello Catalin

the CustomAction is now working as desired under the x64 - .NET Core Runtime. Thank you very much for your efforts.

Best regards
René
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: .net Core Custom Action dosn't work

You are always welcome, René!

Glad to hear everything is working as expected now. :)

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”