Wixsharp: WixUI still dependent on Net3.5 ?

Created on 22 Oct 2019  路  7Comments  路  Source: oleg-shilo/wixsharp

I try to create installation based on console project, targeted project as .net 4.0,
installed Wix# packages from nuget, use ManagedProject() with Dialogs based on Managed Setup\CustomUISequence sample

But when I build my MSI I get

      Loaded dependent assembly: C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5
  c561934e089\System.Windows.Forms.dll
      Loaded dependent assembly: C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\Sy
  stem.dll
      Loaded dependent assembly: C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d
  50a3a\System.Drawing.dll
      Loaded dependent assembly: D:\bin\Debug\BootstrapperCore.dll
      Loaded dependent assembly: C:\WINDOWS\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e0
  89\System.Core.dll

On my own system its ok, but on build system it fail with

EXEC : error : Dependent assembly not supplied: System.Drawing, Version=2.0.0.0, Culture=
neutral, PublicKeyToken=b03f5f7f11d50a3a [D:\MyProject.csproj]

So on a system which contain only 4.0+ .NET framework (no 3.5) project can not build MSI

It is by design or a bug ?

question

Most helpful comment

WiX 3.x is compiled for .NET 3.5. However, v3.14 has changes that are supposed to help users migrate to v4 when it is ready which includes dropping support for .NET 3.5. v3.14 will not be officially released until v4.0 is officially released, but development builds are available. It should fix your issue.

All 7 comments

so, what the answer ? :)

Sorry, I missed the fact that this post did not have the answer.

No it's not by design. In fact I was not aware that such a dependency exists. Do you know what stage of the build triggers this problem. "Build script" compilation or actual MSI building? This may help to establish where the dependency is.

Seems it is actual MSI building

MSIAuthoring:
  Building MSI
  "...test.Installation\bin\Debug\test.Installation.exe" "/MSBUILD:Done Building Project "test.Installation\test.Installation.csproj" (default targets) -- FAILED.test.Installation" "/WIXBIN:"
  Searching for custom action entry points in WixSharp.dll
      Loaded dependent assembly: ..\packages\WixSharp.wix.bin.3.11.2\tools\sdk\Microsoft.Deployment.WindowsInstaller.dll
EXEC : error : Dependent assembly not supplied: System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a [test.Installation.csproj]
EXEC : error : System.IO.FileLoadException: Cannot resolve dependency to assembly 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. [test.Installation.csproj]
     at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
     at System.Reflection.RuntimeAssembly.GetExportedTypes()
     at Microsoft.Deployment.Tools.MakeSfxCA.MakeSfxCA.FindEntryPoints(String module)
     at Microsoft.Deployment.Tools.MakeSfxCA.MakeSfxCA.Build(String output, String sfxdll, IList`1 inputs, TextWriter log)
     at Microsoft.Deployment.Tools.MakeSfxCA.MakeSfxCA.Main(String[] args)
  Cannot package ManagedCA assembly(test.Installation\bin\Debug\WixSharp.dll)
..\packages\WixSharp.1.13.0\build\WixSharp.targets(5,5): error MSB3073: The command ""test.Installation\bin\Debug\test.Installation.exe" "/MSBUILD:test.Installation" "/WIXBIN:"" exited with code 1. [test.Installation\test.Installation.csproj]

so test.Installation.exe compiled as net 3.5 dependent

Yeah, WixSharp is compiled for 3.5. And it is by design, so it can be used on older versions of CLR. This should not be a problem as CLR implements backwards compatibility. Thus your CLR (.NET 4) can load WixSharp compiled for .NET 3.5.

However it seems like MakeSfxCA does not respect that and does not map WixSharp and its dependencies (e.g. _'System.Drawing'_) to the newer CLR equivalent.

This is particularly odd as WixSharp references this assembly with the "Specific Version" carefully set to false so the probing failures like that never happen:

image

I am reopening this issue. But... I am not sure yet how to approach it. Recompiling WixSharp to .NET 4.0 may upset quite a few other users.

Did you try to find any solution in WiX forums? Specifically how to force MakeSfxCA.exe to resolve compatible assemblies that are not available in the same version?

No, I didn鈥檛 even know that MakeSfxCA.exe is part of the WiX, not WiXSharp :)

Yep, it is all WiX/MSI.

WixSharp is just a transcompiler that generates WiX source. The actual compilation and building the final MSI is all done by WiX compilers/linkers.

Saying that WixSharp does some very heavy lifting before the compilation stage. GUI, Bootstrapper, dynamic Reflection-based CA, managed runtime events, table-less deployment algorithm. All this is WixSharp and yes, there are so many things that can go wrong there :)

But in this case the error is caused at the compile stage of a valid source code + binaries. At least it looks this way.

Merry Christmas.

WiX 3.x is compiled for .NET 3.5. However, v3.14 has changes that are supposed to help users migrate to v4 when it is ready which includes dropping support for .NET 3.5. v3.14 will not be officially released until v4.0 is officially released, but development builds are available. It should fix your issue.

Was this page helpful?
0 / 5 - 0 ratings