Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
520 views
in Technique[技术] by (71.8m points)

.net - WiX: How to register application to start when Windows launches?

I'm exploring distribution of .NET desktop applications with MSI generated by WiX.

So far it works great. But I've got a few questions, googling can't help out with.

What's the advised way of registering application to start when windows launches (in WiX)?

What WixUI could I use and how?

Notes:

  • The application is not a Windows Service and should not be registered as such.
  • It would be nice to let user to disable that option in the setup process.

Thanks in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I found this using Google (Providing automatic program start via the Registry); it also includes adding UI. Don't forget you should also provide an option outside the setup to enable/disable autostart.

The basic Wix for it is:

  <Property Id="ASSISTANCE_START_VIA_REGISTRY">1</Property>

  <!-- Auto-start via Registry -->
  <Component Id="MerliniAssistanceAutostart" Guid="Place-your-own-GUID-here">
    <RegistryValue Id="MerAs.rst" Root="HKMU" Action="write"
                   Key="SoftwareMicrosoftWindowsCurrentVersionRun"
                   Name="Merlinia Assistance Client"
                   Value="[INSTALLDIR]Assistance.exe"
                   Type="string" />
    <Condition>ASSISTANCE_START_VIA_REGISTRY</Condition>
  </Component>

  <ComponentRef Id="MerliniaAssistanceAutostart" />

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...