Comments (8)
The error means that the assembly that has been compiled for x64 is being loaded on the x86 CLR or vise versa. Ideally you want your assembly to be compiled against "AnyCPU" this way it will adhere to the CLR CPU type of the host/target system.
Note, MSI runtime is always x86 even when it is running on x64 OS.
from wixsharp.
Thanks for the reply. I had looked at exactly that, but all the projects were set to AnyCPU (with Prefer 32 bit un-check). I'll look again.
from wixsharp.
But what is the target CPU of that third party assembly? May be it is what is causing the discrepancy? You can check the asm CPU type with ILSpy/Reflectpor. And you can also run a hello world msi with Wix# custom action to check what is the actual CLR type during the installation. I recon this is where the problem is.
from wixsharp.
it is an x86 exe. At which version of WixSharp did this get enforced? We were on version 1.0.16.
from wixsharp.
At which version of WixSharp did this get enforced?
Wix# does not enforce anything. Actually it never did. If you are talking about "MSI runtime is always x86" then it is enforced by the MSI itself.
The fact that your 3rdparty.exe
is x86 already indicates that it will have a conflict when loaded on x64.
Yes I expect that MSI runtime to be always x86 but only nased on my experiments not the "promise" from MS. And I cannot exclude that under certain circumstances it can be x64 (e.g. next version of MS Installer). That is why I Wix# is compiled with neutral "AnyCPU" so it fits any OT type.
Anyway, the next step would be to verify the actual runtime on your target system is. This is how you can do it:
Create a hello world project similar to this one:
var project =
new ManagedProject("MyProduct",
new Dir(@"%ProgramFiles%\My Company\My Product",
new File(...
...
project.Load += project_Load;
...
static void project_Load(SetupEventArgs e)
{
MessageBox.Show("Hello World! (CLR: v" + Environment.Version + ")",
"Embedded Managed CA (" + (Is64BitProcess ? "x64" : "x86") + ")");
}
static bool Is64BitProcess
{
get { return IntPtr.Size == 8; }
}
Run the produced MSI on your target system and you will see if it is in conflict with your 3rdparty.exe
CPU type.
from wixsharp.
Results:
Hello World! (CLR: v4.0.30319.42000) Embedded Managed CA (x86)
I think I've found the problem we're running into though:
I'm trying to include an unmanaged exe that's used by a custom action.
In the past (v1.0.16), wixSharp would build the msi, and include the 3rd party exe just fine.
In the newer versions, in ProjectValidator.cs, AsmReflector.OriginalAssemblyFile makes a call to System.Reflection.Assembly.ReflectionOnlyLoadFrom(...), in order to get the full filename.
This call doesn't work on unmanaged exes.
The commit where this changed is c46e2abba9c6b42375a9467f51a79242a1b45c1f .
How would someone go about including an unmanaged utility (like say 7zip.exe) in an install to be used by a custom action?
Just a note in case someone else tries this:
The project needs to be a ManagedProject and since I wasn't using a UI, project_load was changed to:
static void project_Load(SetupEventArgs e)
{
e.Session.Log("Hello World! (CLR: v" + Environment.Version + ") Embedded Managed CA (" + (IntPtr.Size == 8 ? "x64" : "x86") + ")");
}
Thanks for being so responsive!
from wixsharp.
Great. Of course. It all makes sense now.
You mentioned project.DefaultRefAssemblies
meaning that you are adding assembly. This property is for the assemblies but not for unmanaged binaries.
You will need to use Binary
or even `BinaryAction:
var project =
new Project("My Product",
new Binary(new Id("EchoBin"), @"Files\Echo.exe"),
new Dir(@"%ProgramFiles%\My Company\My Product",
new File(binaries, @"AppFiles\MyApp.exe",
new WixSharp.Shortcut("MyApp", @"%ProgramMenu%\My Company\My Product"),
new WixSharp.Shortcut("MyApp", @"%Desktop%")),
new BinaryFileAction("EchoBin", "/i",
Return.check,
When.After,
Step.InstallFinalize,
Condition.NOT_Installed),
BinaryFileAction("EchoBin", "/u",
Return.check,
When.Before,
Step.InstallFinalize,
Condition.Installed),
...
Compiler.BuildMsi(project);
from wixsharp.
Perfect! I had seen the Binary, but not the BinaryAction.
Thanks again.
from wixsharp.
Related Issues (20)
- WixSharp NET Core UI Project HOT 3
- Write Filename with Path on InstallDialog HOT 24
- SetVersionFromFileId not working for relative path in Managed Project Dir HOT 3
- Azure pipeline build HOT 4
- If you enter the project name in Chinese, a question mark is displayed on the installation package HOT 6
- WixSharp-wix4.WPF 2.1.2 Can you smoothly upgrade to. NET8 HOT 2
- Install directory path changes when MSI is run second time through msexec command ADDLOCAL parameter HOT 1
- The installation directory value is incorrect HOT 2
- Dialog Data transfer problem HOT 2
- Add Ignore Errors a driver installer to Bundle HOT 1
- Allow specifying the Group name when adding a FirewallException HOT 2
- I would like to set a features directory path by the user in wix# ManagedUI HOT 3
- Execute CA which needed Powershell in Version 5.1 HOT 6
- Is there support for 4 digit version upgrade? HOT 2
- How to debug the installer script using csscript.exe ? HOT 3
- GetResourceBitmap Method is failing resulting in a Null Pointer exception HOT 1
- Unable to set property value from Session Object in a Custom WPF Dialog HOT 4
- Asking for reboot after unistalling HOT 3
- Digital Signature with relative certificate path not working HOT 4
- How to show all installing Files in control , for example userconrol or listbox, in Bundle WPF C# HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wixsharp.