0

I'm trying to execute custom commands on my DLL using .msi. I want to know that How to get x86 framework path(c:\Windows\Microsoft.NET\Framework\v2.0.50727) in x64 machine and x86 machine

MSI Error - Failure of regsvr32 custom action

To get system path use we use [SystemFolder] so is there any property to get location of c:\Windows\Microsoft.NET\Framework\v2.0.50727

enter image description here

related article

Getting the .NET Framework directory path

Community
  • 1
  • 1
Vicky Thakor
  • 3,847
  • 7
  • 42
  • 67

1 Answers1

0

"Self registration" (Regsvr32, Regasm, GACUTIL, InstallUtil et al) is not considered a best practice in Windows Installer because it runs out of process, isn't declarative and isn't transactional. It defeats Windows Installers knowledge of the changes being made to the target machine, is slower, often fragile and often breaks in repair, upgrade, downgrade, rollback et al scenarios.

The alternative is to "harvest" or "extract" the COM metadata associated with your assembly and author them natively into your MSI. How you do this exactly depends on what tool you are using to author your MSI. InstallShield has a setting called ".NET Com Visible" and WiX has a feature called "Heat". A more raw approach is to run the command regasm foo.dll /regfile:out.reg and then author the contents of the regfile into your installer by hand substituting the paths with MSI directory properties.

There is one catch with regasm /regfile as documented on the regasm topic in MSDN:

Note that the .reg file does not contain any registry updates that can be made by user-defined register functions.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100