oleg-shilo / wixsharp

Framework for building a complete MSI or WiX source code by using script files written with C# syntax.
MIT License
1.12k stars 176 forks source link

ProgressText with WiX 4 #1462

Closed rkyjak closed 6 months ago

rkyjak commented 8 months ago

Hi, I am using wix 4 and 0i tried to set a ProgressText property in my custom Action but ended up with a error: The ProgressText element contains illegal inner text After looking into it for a bit I noticed that it seems that in between WiX 3 and WiX 4 there has been a change that message of progress text was moved to a attribute. WiX 3: https://wixtoolset.org/docs/v3/xsd/wix/progresstext/ WiX 4: https://wixtoolset.org/docs/schema/wxs/progresstext/

I tried to do it via XML injection in a WiX4 way and was able to build and run the MSI but unfortunatelly the text is not displayed. Any ideas how to set the progress text using WiX 4 ?

Torchok19081986 commented 8 months ago

Hiho, you can try following. I do it each time if i struggle in Wix#. Try direct Wix toolset with Heatwave Extension. Install Heatwave Extension , now create Project in Visual Studio 2022 with Wix Toolset V3. VS created your new Project, click richt mouse for contextmenu on project and do something like "upgrade to Wixv4". After this your project is updated to new Wix V4 schema and now you can create msi. Most important Heatwave convert Wix MSI Project v3 to v4 with all needed Info. Look in output .wxs. Maybe you can find it . I found awlays differences in Wix schema v3 and v4 do it this way.

Best regards, Torchok.

Torchok19081986 commented 8 months ago

Update to my Comment from before . I do some research and found some info.

i added new Project for Wix Toolset V4 as Package. Install via Nuget Package which wix toolset v4 shows https://www.firegiant.com/docs/heatwave/extensions/ after this i added

xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui"

on top of package. After this add

<ui:WixUI
  Id="WixUI_InstallDir"
  InstallDirectory="INSTALLFOLDER"/>
 <UIRef Id="WixUI_ErrorProgressText" />  

Description as well. Now build project and result in MSI Package with Installprogress with MSI Standard english Localized Custom Action Values. Little bit too quick.

oleg-shilo commented 8 months ago

Thank you for the tip @Torchok19081986. This is a great way of discovering what has changed from WiX3 to WiX4. This is the way I did the WixSharp.wix3 porting to WiX4. While the WiX team implemented the w3->w4 conversion algorithm they often failed to reflect it comprehensively in the documentation.

Note, <UIRef Id="WixUI_ErrorProgressText" /> is generated for only for the project.UI = WUI.WixUI_InstallDir. Now I have changed it to be generated always and it can also be controlled by the new setting project.LocalizeErrorAndProgressText.

image

You can also inject this statement via XML injection:

project.WixSourceGenerated += doc 
    => doc.FindFirst("Package").AddElement("UIRef", "Id=WixUI_ErrorProgressText");
Torchok19081986 commented 8 months ago

i have only last question here code

project.LocalizeErrorAndProgressText

also can be use for Bootstrapper V4, right or there is some changes ?

oleg-shilo commented 8 months ago

Yep, it is very much in use:

image