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

[Feature] A way (Or create an example) of how to create a standalone fragment and insert into Projects / chains / etc #1379

Closed
Smurf-IV opened this issue Nov 28, 2023 · 8 comments

Comments

@Smurf-IV
Copy link

I want to use an equivalent of a separate wix file that has the self contained variables / conditions / check / elements as a c# object, that can then be inserted into the relevant areas in a project / bundle / chain / etc.

e.g.
given an existing wix bundle containing

<Chain ParallelCache="yes">
    <PackageGroupRef Id="WindowsDesktopNetRuntime"/>
    ......

And a separate wxs file that has

<Fragment>
    <Variable Name="CheckNETRuntime_RequiredVER" Type="version" Value="8.0.0.33101" />
    <util:RegistrySearch Id="CheckNETRuntime_ID"
                         Variable="CheckNETRuntime_Current"
                         Result="value"
                         Root="HKLM" Key="SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{17316079-d65a-4f25-a9f3-56c32781b15d}"
                         Value="DisplayVersion"
                         Win64="yes"/>

    <PackageGroup Id="WindowsDesktopNetRuntime">
        <ExePackage
            Id="WindowsDesktopNetRuntime"
        ......

How to do this via the wixSharp coding experience in separate files?

Because:
I want to reuse these separate fragments in other projects / bundles / etc.

oleg-shilo added a commit that referenced this issue Nov 30, 2023
…ne fragment and insert into Projects / chains / etc
oleg-shilo added a commit that referenced this issue Nov 30, 2023
…ne fragment and insert into Projects / chains / etc
@oleg-shilo
Copy link
Owner

There is a code sample for that:
image

But I added an extension to make it easier to use from files:

static public WixProject AddWixFragmentFile(this Project project, string placementPath, string wixFile)

@Smurf-IV
Copy link
Author

But that is just injecting XML.
I want to use a Feature C# object and add things into (Like a project) that can then be referenced by the Parent Project / Bundle / other fragment(s)

@oleg-shilo
Copy link
Owner

I am not sure I agree that merging multiple WixSharp entities brings adequate value to the product. It is one of those features with the high effort/value ratio.

I am also not convinced that importing the algorithm definition syntax fragments without merging interface/API makes sense. It rather seems like an anti-pattern. Required for WiX but rather questionable for WixSharp.

Mind you that you can still have other C# modules defining logical fragments (e.g. registries, actions):

project.AddActions(...);
project.AddBinaries(...);
project.AddDirs(...);
project.AddProperties(...);
project.AddRegValues(...);

And yet, I see it as a questionable functionality because it leads to the high codebase maintenance cost due to its fragmentation.

@Smurf-IV
Copy link
Author

Smurf-IV commented Dec 1, 2023

Required for WiX but rather questionable for WixSharp.

This is the crux. When converting a working Wix Project / bundle to wixSharp, it would be nice to have the same reusable component file equivalents for fragment files.

@oleg-shilo
Copy link
Owner

And you do have this equivalent. AddWixFragmentFile works exactly as in WiX.

oleg-shilo added a commit that referenced this issue Dec 4, 2023
- Issue #1392: Is it possible to inherit wxl files using managed UI?
- Issue #1389: Multi language installer intermediate .msi not found error
- Issue #1387: Cannot update to latest Caliburn.Micro
- Issue #1384: When the bootstrapper.Build API uses the same name as the project, then misleading compile warnings are issued
- Issue #1382: Package (all child elements of Chain) need to have the After field added
- Issue #1383: Package (all child elements of Chain) need to have the SuppressSignatureVerification field added
- Issue #1381: ExePackage needs to have the Protocol field implemented
- Issue #1379: A way (Or create an example) of how to create a standalone fragment and insert into Projects / chains / etc
- Issue #1377: WixSharp.wix.bin nuget references a url which is no longer available
- Issue #1372: Creating a FileAssociation with Icon and Advertised = false does not work
- Validation of the CPU architecture for the custom BA assembly.
- Updated default `BootstrapperCore.config` content
- Updated WixBootstrapper_UI sample to demonstrate how to use the WinForm-based custom BA (#1386)
- Added support for ManagedUI to foll back on the stock WXL if one was not supplied by the user for non-English languages
- Added WXL and theme files to be used in WixSharp.wix.bin package.
- Added support for ManagedUI to fall back on the stock WXL if one was not supplied by the user for non-English languages
- Improved multi-language sample
- Updated project templates to comment out webref package for bootstrapper template
- Added `WixStandardBootstrapperApplication.AddPayload`
@oleg-shilo
Copy link
Owner

Done. You can import now v1.24.0.0 packages

@Smurf-IV
Copy link
Author

Smurf-IV commented Dec 4, 2023

Is there a working example of this API usage?
And, Is there going to be a way of not using a WixFile, and doing it in code as requested ?

@oleg-shilo
Copy link
Owner

oleg-shilo commented Dec 4, 2023

Is there a working example of this API usage?

Yes it is in InjectXML
It shows the usage of:

project.AddXmlInclude(...);
project.AddWixFragment(...);
project.AddXml(...);
project.AddXmlElement(...);

And, Is there going to be a way of not using a WixFile, a...

Yes, these methods of adding WixObjects to the project are available:

project.AddActions(...);
project.AddBinaries(...);
project.AddDirs(...);
project.AddProperties(...);
project.AddRegValues(...);

oleg-shilo added a commit that referenced this issue Dec 6, 2023
- Release WixSharp.VSIX v2.1.0
  - Made split on WiX3 vs WiX4 templates
  - Added Bootstrapper Custom BA templates
- `WarnOnOutputPathCollision` changed from Warning to Error (continuation of #1384).
- Extended cascading `Project.Platform` to `RegistrySearch` (triggered by #1390 discussion).
- Issue #1392: Is it possible to inherit wxl files using managed UI?
- Added support for ManagedUI to foll back on the stock WXL if one was not supplied by the user for non-English languages
- Added handling new WiX constant `PFiles` (same as old `ProgramFilesFolder`)
- added `WixStandardBootstrapperApplication.AddPayload`
- #1387: Cannot update to latest Caliburn.Micro
- #1384: When the bootstrapper.Build API uses the same name as the project, then misleading compile warnings are issued
- #1379: A way (Or create an example) of how to create a standalone fragment and insert into Projects / chains / etc
- #1382: Package (all child elements of Chain) need to have the After field added
- #1383: Package (all child elements of Chain) need to have the SuppressSignatureVerification field added
- #1381: ExePackage needs to have the Protocol field implemented
- #1372: Creating a FileAssociation with Icon and Advertised = false does not work
- #1373: Need a clearer reason for the following Build exception: "System.NullReferenceException: Object reference not set to an instance of an object."
- Added ensuring `project.OutDir` exists.
- Updated WixToolset.Dtf.WindowsInstaller to the latest version
- `WarnOnOutputPathCollision` changed from Warning to Error (continuation of #1384).
- Extended cascading `Project.Platform` to `RegistrySearch` (triggered by #1390 discussion).
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