-
Notifications
You must be signed in to change notification settings - Fork 181
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
Using PublishAot instead of SfxCA for custom actions #1456
Comments
Sorry to say but no you did not miss anything. Until WiX team provide the solution for .NETCore support WixSharp cannot do anything about it. Though AOT seems like an interesting experimental approach. Even though I am not convinced of the business value. |
I can confirm it now. Yes, it is possible. I will add support in the next release. However, it is only going to help with raw CA. |
Support for CA compiled with .NETCore (AOT)
Support for CA compiled with .NETCore (AOT)
Hey Oleg, Wow you work fast, awesome work!
Could you explain some more about this? Looking at your example also gave me a different insight, leaving the wixsharp project .net framework always made it so the compiler complained about it being unable to reference a project of .Net 8 (e.g. not a custom action but the software I want installed) however in your example you don't seem to use a project reference and I could apply this to non custom actions as well. Is this advised or just a workaround for the same issue? |
Let's review it... .NET Core supportCurrent stateThis is how external functionality can be embedded in MSI/WiX currently (WiX4):
In MS/WiX vision all 1-6 cases are implemented as individual modules/workflows. WixSharp takes a different and rather elegant approach. Everything can be defined as a single assembly with a very minimalistic user code. This approach is possible because all the assemblies of MSI/WiX workflows are of the same type. Thus WixSharp can combine them in a single assembly. But if we try to convert it in .NET Core then it becomes tricky. None of the scenarios from the table above support .NET Core compiled assemblies except 6 AOT compilation offers an interesting opportunity as the compiled assembly effectively becomes a native dll. Thus some scenarios can be scenario implemented providing the assemblies are AOT-ed by WixSharp before the msi compilation.
I have already got scenarios 1 and 6 working. Remaining scenarios: I am currently trying to POC scenario |
Once again awesome work! This is a super clear overview of the external functionality that the installer can provide. In case it does not work out I kinda wanna come back on the project reference thing I mentioned in the previous comment. Because as much as external functionality is important I do think the core functionality of "Installing files" in the form of a build project. Has more support in Wix than it has in WixSharp. e.g. I can add a .net8 application as project reference to a Wix project and build an installer with it. If I wouldn't be able to upgrade my installer code to a new framework then I feel like that's not the end of the world. But if the installer is preventing me from also upgrading my project im trying to install that's a bigger annoyance. Even if AoT doesn't work out I feel like there should be a way to cleanly allow for the core functionality of installing files from a newer .net project do you feel the same way? |
What you are proposing is quite feasible. I will treat it as a proposal and will see how best to implement it. Though, while I accept your motivation as a WixSharp user, through the history of WixSharp I am trying to move away from MSI/WiX philosophy when your deployment solution is primary and everything else only serves it. This leads to questionable concepts, such as the need for a dedicated msi developer, MSI/WiX technology being its own discipline or even having WiX project referencing application project(s). As a developer you want to build an MSI because you have the product, not vice versa. Sorry for referencing my interview but this will give you more insight into this approach: https://www.infoq.com/articles/WixSharp/ Thus for me Product is primary and the deployment is secondary. Thus You build your product, you aggregate it for further testing and release preparation. Every CI has this artifacts aggregation step. And then you simply build your msi with a single direct artifact referencing, not a source code/project referencing line. var project = new Project("My App",
new Dir(@"%ProgramFiles%\My Company\My App",
new AllFiles(@"\\BuildServer\LatestRelease\*.*"))); The code above is an ideal deployment authoring definition. BTW I can even develop and provide an MS itself has abandoned MSI evolution and invested in fundamental alternatives from ClickOnce to MSIX and containers. Even though MSI will always be supported and even somewhat integrated with alternative deployment approaches. Anyway, I will see what ven be done for VS project referencing. |
I fully agree that the deployment is there to support the product and not the other way around. Our (simplified) current situation is that we have one solution file with both the product and the deployment in it an splitsing this and adding an extra build step seems like a fine solution to my problem. However, I do think it's very powerful and assists in your vision of not needing separate deployment developers that everything is in a single solution. For example having everything in one solution is never going to result in a developer never having seen the WixSharp projects. Because: "Its is only a solution that barely changes" Or "That solution just does its thing on the build server" But that's just my two cents. Thank you so much for your time and effort! We are definitely able to move forward, and I'll keep my eyes peeled for any changes that might come from this. |
All good. I am focusing now on .NETCore support. But when I am done I will get in touch with you to understand the exact requirement you have in mind for auto-processing project references. Then it will be clear how to handle this challenge. Cheers |
- Issue #1406: Multi-language improvement - Issue #1462: ProgressText with WiX 4 - Issue #1463: Unable to find dotnet when building with dotnet cli - Issue #1460: Add -sw1026 to default Wix4 argument options? - PR #1461 from klokkenman1/wix-v4-master Add sw1026 to WixOptions - Proposal #1456: Using PublishAot instead of SfxCA for custom actions - Support for CA compiled with .NETCore (AOT) - Added support for .NET Core projects (pre-release) See https://github.com/oleg-shilo/wixsharp/blob/wix-v4-master/Source/src/NET-Core
I published the pre-release nuget package for .NET 8 project: |
I'll check it out soon, very cool progress! |
And now I can confirm that The code below already works in the POC branch: using System.Reflection;
using WixSharp;
using WixToolset.Dtf.WindowsInstaller;
using File = WixSharp.File;
var project =
new ManagedProject("My Product",
new Dir(@"%ProgramFiles%\My Company\My Product",
new File("program.cs")));
project.BeforeInstall += e =>
Native.MessageBox("Before Instrall", "WixSharp - .NET8");
project.AfterInstall += e =>
Native.MessageBox("After Instrall", "WixSharp - .NET8");
project.Load += (e) =>
Native.MessageBox("OnLoad", "WixSharp - .NET8");
project.UI = WUI.WixUI_ProgressOnly;
project.BuildMsi(); Now it's time to bring it all together. |
Hey,
I've been working on a project that involves upgrading .net framework projects too .net 8 and ran into the same issue described in #1357
Reading #802 it seems that it was decided to only support .net framework because only by doing this could wixsharp easily support Custom Actions. My assumption is that this is because it uses the MakeSfxCA.exe underwater is that correct?
However after more tinkering and searching i did find a person that got a .net 7 library working as a custom action using PublishAot
Native Aot does certainly have its limitations but would this not be an avenue for WixSharp to start supporting newer .net versions?
If there is any update I missed that allows WixSharp to build with newer .net I would love to hear it!
The text was updated successfully, but these errors were encountered: