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

ManagedBootstrapperApplication Payloads #107

Closed
frederikstonge opened this issue Jul 20, 2017 · 6 comments
Closed

ManagedBootstrapperApplication Payloads #107

frederikstonge opened this issue Jul 20, 2017 · 6 comments

Comments

@frederikstonge
Copy link

frederikstonge commented Jul 20, 2017

wixsharp/Source/src/WixSharp/Bootstrapper/BootstrapperApplication.cs

Its more of a suggestion than an issue, but i'm trying to have localized resources and the fact that all payloads are placed in the root of the temp folder when executing, my resources are not found. I would love a way to specify the name of the payload as well.

@oleg-shilo
Copy link
Owner

I would love a way to specify the name of the payload as well

Can you please elaborate?
Currently you can specify the name of the pyloads:

Payloads = new[] { @"Samples\setup1.dll", @"Samples\setup2.dll", }, 

Most likely you have something else in mind...

@frederikstonge
Copy link
Author

frederikstonge commented Jul 24, 2017

If i'm not mistaken, this line of code would add this :

< Payload SourceFile="Samples\setup1.dll" />
< Payload SourceFile="Samples\setup2.dll" />
By default, when the installer starts, they will be extracted in the root of the installer. I wanted to add localization with different resources, which are placed in a fr folder, and the installer is looking in a fr folder to load them. Example :

< Payload SourceFile="Samples\setup1.dll" Name="fr\setup1.dll" />
< Payload SourceFile="Samples\setup1.dll" Name="fr\setup2.dll" />

Then, in the Temp folder of the extracted installation, these dll will be located in the fr folder.

@oleg-shilo
Copy link
Owner

OK, I see.

I'll see what can be done about that. The API can be tricky as I am not sure I want to elevate payload from being a string to a rich class. But I just may have to...

In a mean time please use the following XML injection to achieve the desired functionality.

bootstrapper.WixSourceGenerated += (doc) =>
{
    doc.FindAll("Payload")
       .Select(x => new 
               { 
                   Element = x, 
                   File = x.Attribute("SourceFile").Value.PathGetFileName()
               })
       .Where(x => x.File.EndsWith(".dll"))
       .ForEach(x => x.Element.AddAttributes($"Name=fr\\{x.File}"));
};

@oleg-shilo
Copy link
Owner

Done. The release will be available in a few days.

var bootstrapper =
    new Bundle("My Product",         
        new MsiPackage(productMsi)         
        {
             DisplayInternalUI = true,
             Payloads = new[] {
                                  new Payload("script.dll") { Name = @"fr\script.dll" },
                                  new Payload("utils_a.dll"),
                                  "utils_b.dll".ToPayload()
                              }
             ...

@frederikstonge
Copy link
Author

frederikstonge commented Jul 30, 2017 via email

oleg-shilo added a commit that referenced this issue Aug 2, 2017
----
* Issue #111: Display attribute & Reset link doesn't work in FeaturesDialog window
* Issue #107: ManagedBootstrapperApplication Payloads
* issue #108: [ManagedUI] feature checkbox can be unchecked when allowChange is false
* Issue #109: [ManagedUI] backgroup image dimensions
* Issue #103: Compiler.WixLocation, WixSharp.wix.bin and new csproj format in Visual Studio 2017
* Issue #99: Working with embedded WPF UI and MSI; Updated code sample.
* Issue #102: Update nuget package WixSharp.bin to include WIX (Windows Installer Xml) Toolset v3.11
* Migration of WiX Toolset from v3.10.3 (v3.10.3007.0) to v3.11.0 (v3.11.1701.0)
@oleg-shilo
Copy link
Owner

The latest NuGet package contains the fix.

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