English 中文(简体)
Get WiX to write a new GUID to the registry after each install
原标题:

I m trying to port an NSIS installer to WiX. Every time the installer runs it sets a registry key to a new GUID value, so that when my app runs it can see if it s first run after an install. On first run the app sets another registry key to the GUID value from the installer. As long as the two keys match then I know the installer hasn t been run.

Here s the NSIS code:

#Write InstallGUID
Call CreateGUID
Pop $0
WriteRegStr HKLM "${REGKEY}" InstallGUID $0

and

Function CreateGUID
  System::Call  ole32::CoCreateGuid(g .s) 
FunctionEnd

I ve got a fairly complete WiX installer ready at this point, but I can t figure out how to replicate this functionality. Is there something in WiX to generate GUIDs at install time, or do I need to write a custom event? If I could avoid writing a little dll that would be best.

问题回答

If you don t find a better solution you could put that code into an NSIS script by itself and make it a silent install so that you can silently run the NSIS script from the Wix+MSI installer.

I would be mindful to do appropriate error catching in the NSIS code and return/set error code to be returned back to Wix so that any registry related failures/errors can be communicated to the Wix installer.





相关问题
Correct place to install demostration projects?

With the new Windows 7 restrictions (well, new to Windows Vista anyways), we can no longer install demo projects to %ProgramFilesFolder%OurApplicationdemo since restricted users will not be able to ...

.deb package conffiles problem

I am distributing one of my applications using a .deb package, but have a problem relating to one of the files. The distribution includes a database file which is constantly updated by the app, on a ...

Closing an application using WiX

In creating my WiX installer I have run into an issue when trying to close an application before installing the upgrade. Below is an example of how I am attempting to do this. <util:...

VS 2005 Setup - HKCU

I am trying to fix an existing application that uses a Visual Studio 2005 setup project. We are requiring it to work on limited user accounts for XP, our app is written in C# for .Net 2.0. It writes ...

Do I want Publish or Release Build in VB.net?

I wrote a little (like 40 lines little) Winforms application with VB.net in Visual Studio 2010. Now I ve released the code as a Google Code project. It s easy for a developer to get the source but I d ...

configsource and installer

I have an project csproj, with app.config file, and logging Ent.Library section using configsource attribute. The logging section is in ahother file Configloggingconfiguration.config. I have a ...

热门标签