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

Build error with WixToolset.UI.wixext #1473

Closed
Coloryr opened this issue Mar 10, 2024 · 13 comments
Closed

Build error with WixToolset.UI.wixext #1473

Coloryr opened this issue Mar 10, 2024 · 13 comments

Comments

@Coloryr
Copy link

Coloryr commented Mar 10, 2024

生成开始于 16:38...
1>------ 已启动生成: 项目: ColorMC.Setup.Wix, 配置: Debug Any CPU ------
1>ColorMC.Setup.Wix -> E:\code\ColorMC\src\ColorMC.Setup.Wix\bin\Debug\net472\win-x86\ColorMC.Setup.Wix.exe
1>
1>----------------------------------------------------------
1>
1>Wix project file has been built: E:\code\ColorMC\src\ColorMC.Setup.Wix\colormc-x64.wxs
1>
1>Compiling colormc-x64.wxs
1>Source base directory: E:\code\ColorMC\src\ColorMC.Setup.Wix
1>wix.exe : error WIX0144: The extension 'WixToolset.UI.wixext' could not be found. Checked paths: WixToolset.UI.wixext, C:\Users\40206\.wix\extensions\WixToolset.UI.wixext\5.0.0-rc.1\wixext4\WixToolset.UI.wixext.dll
1>
1>----------------------------------------------------------
1>
1>Wix project file has been built: E:\code\ColorMC\src\ColorMC.Setup.Wix\colormc-x64-aot.wxs
1>
1>Compiling colormc-x64-aot.wxs
1>Source base directory: E:\code\ColorMC\src\ColorMC.Setup.Wix
1>wix.exe : error WIX0144: The extension 'WixToolset.UI.wixext' could not be found. Checked paths: WixToolset.UI.wixext, C:\Users\40206\.wix\extensions\WixToolset.UI.wixext\5.0.0-rc.1\wixext4\WixToolset.UI.wixext.dll
1>E:\code\ColorMC\src\ColorMC.Setup.Wix\ColorMC.Setup.Wix.csproj(36,5): error MSB3073: 命令“cd .\
1>E:\code\ColorMC\src\ColorMC.Setup.Wix\ColorMC.Setup.Wix.csproj(36,5): error MSB3073: set ide=true
1>E:\code\ColorMC\src\ColorMC.Setup.Wix\ColorMC.Setup.Wix.csproj(36,5): error MSB3073: "E:\code\ColorMC\src\ColorMC.Setup.Wix\bin\Debug\net472\win-x86\ColorMC.Setup.Wix.exe"”已退出,代码为 -1。
1>已完成生成项目“ColorMC.Setup.Wix.csproj”的操作 - 失败。
========== 生成: 0 成功,1 失败,6 最新,0 已跳过 ==========
========== 生成 于 16:38 完成,耗时 04.920 秒 ==========

This issue start in yesterday(2024.3.9)

My CI in here
Fail
Done

@VietBuiHa
Copy link

I'm getting the same error, I think it is related to the newest wix release 5.0.0-rc.1 yesterday.
https://github.com/orgs/wixtoolset/discussions/8023

@oleg-shilo
Copy link
Owner

oleg-shilo commented Mar 11, 2024

Yes the problem is caused by the defective 5.0.0-rc.1 release.

Specifically, by the fact that WiX v4.0 pulls WiX v5.0 pre-releases packages. In this case WxToolset.UI.wixext.

The package is defective as it has no files:
image

Though given if the files were there they most likely would not be compatible with the v4.0 compiler.

The problem needs to be fixed by the WiX team.

Now, what you guys can do? There is a trick.
WixSharp is always using the latest extension available on the system. Thus it's enough to remove 5.0.0-rc.1 folder and ensure the older version of the extension (e.g. 4.0.2) is installed.

In my case (see the screenshot) I have the old version from my previous builds. But if it is a new environment, installing a specific version can be a challenge.

wix.exe extension add -g WixToolset.UI.wixext always installs the latest package (extension) version available on the package repository. And I do not see any option in CLI on how to target a specific version. This is something that you can try to resolve. If you do, please share it here.

@oleg-shilo
Copy link
Owner

Just to help your further troubleshooting...

wix extension add -g -v 4.0.2 WixToolset.UI.wixext installs the latest version of the package but not the one I specified. CLI help is completely silent about how to target specific versions. Oh, dear...

@oleg-shilo
Copy link
Owner

If you cannot find the way then you can always get the required version from NuGet:

dotnet add package WixToolset.UI.wixext --version 4.0.2

and then simply copy the package in the %userprofile%\.wix\extensions folder. You see, WiX reused NuGet packages but it does not incorporate nuget goodness like specific versions, recognizing pre-releases, or compatibility algorithms. Again, oh, dear...

@Coloryr
Copy link
Author

Coloryr commented Mar 11, 2024

If you cannot find the way then you can always get the required version from NuGet:

dotnet add package WixToolset.UI.wixext --version 4.0.2

and then simply copy the package in the %userprofile%\.wix\extensions folder. You see, WiX reused NuGet packages but it does not incorporate nuget goodness like specific versions, recognizing pre-releases, or compatibility algorithms. Again, oh, dear...

How to do this in github action?

@oleg-shilo
Copy link
Owner

You have a few options.
You can have a step where you create a dummy project add the package to it. This will download the package in the global packages store %userprofile%\.nuget\packages\wixtoolset.ui.wixext. Now you can copy it to WiX packages store.

dotnet new console
dotnet add package WixToolset.UI.wixext --version 4.0.2
md "%userprofile%\.wix\extensions\wixtoolset.ui.wixext\4.0.2"
xcopy "%userprofile%\.nuget\packages\wixtoolset.ui.wixext\4.0.2\wixext4" "%userprofile%\.wix\extensions\wixtoolset.ui.wixext\4.0.2\wixext4\" /S

That's it. So you can just add a batch file step in your CI and execute it before the WixSharp build.

@Coloryr
Copy link
Author

Coloryr commented Mar 11, 2024

    - name: Install WiX Toolset
      run: |
        choco install wixtoolset
        dotnet tool install --global wix
        dotnet new console
        dotnet add package WixToolset.UI.wixext --version 4.0.2
        md "%userprofile%\.wix\extensions\wixtoolset.ui.wixext\4.0.2"
        xcopy "%userprofile%\.nuget\packages\wixtoolset.ui.wixext\4.0.2\wixext4" "%userprofile%\.wix\extensions\wixtoolset.ui.wixext\4.0.2\wixext4\" /S

Is right?

@VietBuiHa
Copy link

Yep, it's frustrating, it just literally breaks everyone's builds.
The following commands work for me

dotnet tool install --global wix --version 4.0.4
wix extension add -g WixToolset.UI.wixext/4.0.4

@Coloryr
Copy link
Author

Coloryr commented Mar 11, 2024

Yep, it's frustrating, it just literally breaks everyone's builds. The following commands work for me

dotnet tool install --global wix --version 4.0.4 wix extension add -g WixToolset.UI.wixext/4.0.4

Thanks

@oleg-shilo
Copy link
Owner

oleg-shilo commented Mar 11, 2024

Great. Thank you for sharing.

wix extension add -g WixToolset.UI.wixext/4.0.4

That was that magic syntax that WiX team did not share with us, unfortunately.

With this trick you don't need to deal with the nuget packages just have this single step and you are good

wix extension add -g WixToolset.UI.wixext/4.0.4

@oleg-shilo
Copy link
Owner

Since it's been more than 3 weeks and WiX team has not patched/removed the broken extension from nuget,.org,
I decided to handle this problem in WiX sharp.

Thus now you can request building your msi with a specific version of the extension in question. For the problem we are discussing the work around will be as below:

WixExtension.UI.PreferredVersion = "4.0.4";
. . .
project.BuildMsi();

I have also updated the compiling algorithm and now it warns you if accidentally you are trying to build your msi with a broken version of WixToolset.UI.wixext.

image

I will release this enhancement in a day or two.

@Coloryr
Copy link
Author

Coloryr commented Apr 4, 2024

That is good

oleg-shilo added a commit that referenced this issue Apr 6, 2024
NET Framework:
- #1473: Build error with WixToolset.UI.wixext
- Issue #1444: wix.exe not found if installed as local tool
- minor improvements triggered by #1469

NET Core (v2.1.3.0):
- added project templates
- improved error reporting during compilation.
- added full CustomUI sample (to be used as a template)
@oleg-shilo
Copy link
Owner

Done. You can find the update in the latest v2.1.5 release.

Note, that this change was implemented to specifically avoid the use of the defective version of WiX extension (WixToolset.UI.wixext v5.0.0-rc.1).

While this work can be used to target a specific version of any extension in general, this workaround can be removed when WiX team releases the next version of this extension.

This is how you can target a specific version of an extension:

WixExtension.UI.PreferredVersion = "4.0.4"; // or any other working version
. . .
project.BuildMsi();

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

3 participants