Note that there are some explanatory texts on larger screens.

plurals
  1. POWindows Setup: Dynamic Registry Keys/Values
    text
    copied!<p><strong>A synopsis of my question:</strong></p> <p>Is it possible to use your own, custom variables (the way that you can use [TARGETDIR]) in the Registry screen of a Windows Setup project in VS2010? Specifically, I need to store my assembly's strong name and assembly version in the registry, in order to register a COM object on a machine without the installing user having admin rights.</p> <p>I already tried using a custom action, and I'd rather not continue down that road if possible.</p> <p><strong>Here are the specifics, and what I've tried:</strong></p> <p>Recently, my employer started blindly removing all employees' admin rights from their machines.</p> <p>I had created a COM-exposed C# class that I'd been using on a few of my workstations, which is no longer able to be registered, because I no longer have the appropriate permissions under HKEY_CLASSES_ROOT.</p> <p>Through Googling, I found out how to register all of the appropriate keys under HKCU*, but now I'd like to implement this in my deployment project.</p> <p>I understand how to use the Registry screen within Windows Setup, but there are custom keys/values that need to be stored (install folder, assembly strong name, version).</p> <p>I could use a custom action, but ideally, I want Windows Setup to manage my registry settings, because (a) it's better than I am at automatically removing all the proper keys/values upon uninstall, (b) during the install, registry changes are transactional &amp; rolled back upon install error, and (c) the logic for registry key install/removal/transactions is already written by Microsoft, and I won't have to rewrite it myself.</p> <p>The project was in VS2008 until today, but I just upgraded it to VS2010, so perhaps something has changed between 2008 and 2010 that might allow this behavior.</p> <p>So, rather than using a custom action, is there a better way to do this?</p> <p><strong>EDIT:</strong> I found <a href="https://stackoverflow.com/a/1801639/864414">this</a> answer, which seems to suggest that you can access the Windows Install "Registry" table within your install project. I'm not sure how to do access it, though. In the past, I seem to recall that you could access the MSI databases from a special external tool (Orca), but I don't know if you can access these tables in your setup project.</p> <p><strong>EDIT 2:</strong> Ah, I may be on to something; perhaps a post-build event:</p> <ul> <li><a href="https://stackoverflow.com/questions/886842/use-orca-to-edit-msi-from-command-line">Use Orca to edit msi from command line?</a>, </li> <li><a href="http://msdn.microsoft.com/en-us/library/aa368562.aspx" rel="nofollow noreferrer">Examples of Database Queries Using SQL and Script</a>, </li> <li><a href="http://source.db4o.com/db4o/trunk/enterprise/omn/BuildScripts/WiRunSQL.vbs" rel="nofollow noreferrer">WiRunSQL.vbs</a></li> </ul> <hr> <p>* Run RegAsm twice - once with /codebase and once without; both times with the /regfile option. Then merge both files together (removing duplicates), and replace all HKCR references with HKCU\Software\Classes.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload