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

.Net 8 project with external dependency fails to build #1649

Open
Davidvanluijk opened this issue Sep 30, 2024 · 3 comments
Open

.Net 8 project with external dependency fails to build #1649

Davidvanluijk opened this issue Sep 30, 2024 · 3 comments

Comments

@Davidvanluijk
Copy link

A follow up from: Cannot build .net 8 example project #1574

I've been able to build the sample project and convert one of our Wix 3.x based projects using .net8 and WixSharp.Core/WixSharp.Msi.Core 2.4.0. However: we have a couple of installer projects which use common code from a shared library. This I can't get to work. The setup

  • A library project containing utilities like setting all the common project settings, but also containing a couple of custom actions. I added true
  • A installer project which references the library project.

The build currently fails on (InstallerPartBase being a class in the library project):
1>aot.entrypoints.cs(17,66): Error CS0012 : The type 'InstallerPartBase' is defined in an assembly that is not referenced. You must add a reference to assembly 'project.Installer, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. [C:\projectl.Installer\bin\AnyCPU\Release\aot.project.Installer\project.Installer.aot.csproj]

How do I fix this? Can I have CustomActions and/or dependent types in a separate library?

@oleg-shilo
Copy link
Owner

Yes, you can. The was just a question about that: #1648

A word of warning, ensure that your utility is compiled as standardlibrary2
image

And.... .NET Core (e.g. .NET8) support is rather limited. Some features may be impacted. See this wiki: https://github.com/oleg-shilo/wixsharp/wiki/.NET-Core-support

@Davidvanluijk
Copy link
Author

Davidvanluijk commented Oct 1, 2024

I've got it to compile/work now: I am using a baseclass from the library for adding actions to the installer. This happens to be the same class which the customaction is defined in. This doesn't work, you will get the Error CS0012 : The type 'InstallerPartBase' is defined in an assembly that is not referenced. I now define the customaction in a static class separate from the adding of the customaction to the installer, which works.

FYI: The generated code also fails on enum's defined in a class, I needed to change that as well.

With WixSharp.Core and WixSharp.Msi.Core can I still influence the wix.exe that is being called? I used to do this:

...
<PackageReference Include="wix" Version="3.14.1" />
<PackageReference Include="WixSharp.bin" Version="1.25.3" />
...
<Exec Command="&quot;$(TargetPath)&quot; &quot;/MSBUILD:$(ProjectName)&quot; /WIXBIN:$(WixExtDir) /Configuration:$(Configuration) /Platform:$(Platform)" WorkingDirectory="$(ProjectDir)" />

Which ensured Wix 3.14.1 was used, I don't see how this works with the Core packages? (Then using Wix version 4.0.5)

@oleg-shilo
Copy link
Owner

If you are interested in controilling wix.exe then you can use WixTools to set the desired version:

WixTools.SetWixVersion(Environment.CurrentDirectory, "5.0.0");

Note, wix.exe is part of the Wix4 toolser. WiX3 uses completely different set of compilers. And Core packages are only designed to be used with WiX4.

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