简体   繁体   中英

How to register either a 64 bit or 32 bit DLL in a Visual studio setup project

I've created a setup project for my C# application that installs my software. I understand i can add an assembly reference and add my DLL to the installer this way (outlined here ).

What i want to know, is how do i bundle in both a 32 bit dll, and a 64 bit dll and at install time, determine what assembly the machine is running, and then register the relative DLL.

All help would be greatly appreciated!

EDIT

The dll is not actually called from within the app - It is actually a shell extension used to call the app, therefore i cannot simply add code into my main app that calls certain DLL files, and they must be registered at install time.

I would also very much like to try and do this natively in Visual Studio if at all possible

If your setup project's architecture is 32-bit than it can't include the 64-bit Dll. If it's 64-bit setup project it can include both (different locations obviously). This assumes that your Dlls are explicitly 32-bit for 32-bit clients and 64-bit for 64-bit clients, because AnyCpu settings for the code can confuse things. That's why a 32-bit client code should be built as x86 and 64-bit as x64. You need separate architecture setups:

https://blogs.msdn.microsoft.com/heaths/2008/01/15/different-packages-are-required-for-different-processor-architectures/

The registration setting in a setup project is in the Properties window (select the file, then F4) for the file in the File System view. See the Register setting. If it's a C++ shell extension there should be a vs Self register setting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM