第一次尝试使用Visual Studio制作应用程序的安装包。我有一个注册表值,在安装该程序时需要更改该注册表值,我需要在每次计算机启动时都启动该程序。
这是一项相当琐碎的任务吗?有人可以指出我要尝试实现的目标。
到目前为止,我只拥有带有表单等的应用程序。
我有同样的问题,我使用WIX,并按照从回答这个#1的问题。我也是WIX的新手,如果您感兴趣的话,这是我完整的WIX工作脚本(在Windows XP和Windows 8.1上进行了测试):
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*"
Name="FooSetup" Language="1033"
Version="1.0.1.1"
Manufacturer="Foo Enterprise"
UpgradeCode="9235c293-2f08-4c2b-b7a5-69d01f5fca32">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<!-- Step 1: Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="FooSetup" />
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="Foo Application"/>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<!-- Step 2: Add files to your installer package & add autostart feature -->
<DirectoryRef Id="INSTALLFOLDER">
<!-- The main executable file-->
<Component Id="FooApplication" Guid="3F122E60-3745-4AEB-ADA3-B90DCB87E0BD">
<File Id="FooMainApp" Source="$(var.Foo.TargetPath)" KeyPath="yes"/>
</Component>
<!-- The main lib file-->
<Component Id="FooLib" Guid="83BEDB02-C9F5-4A06-B3D5-0A4D61D6A99C">
<File Id="FooFileLib" Source="$(var.Foo.Lib.TargetPath)" KeyPath="yes"/>
</Component>
<!-- Register windows autostart registry -->
<Component Id="RegistryEntries" Guid="45C7AC46-1101-4301-83E1-D24392283A60">
<RegistryValue Type="string"
Name="FooStartup"
Value="[#FooMainApp]"
Root="HKLM"
Key="Software\Microsoft\Windows\CurrentVersion\Run"
Action="write"/>
</Component>
</DirectoryRef>
<!-- Step 3: Add the shortcut to your installer package -->
<!-- Start Menu -->
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="FooShortcutMenu" Guid="3874D005-4E1C-4C0E-9CEA-8CD8D5442B60">
<Shortcut Id="FooApplicationStartMenuShortcut"
Name="Foo Application"
Description="The Foo is Cool!"
Target="[#FooMainApp]"
WorkingDirectory="INSTALLFOLDER"/>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\FooApplication" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Desktop Menu -->
<DirectoryRef Id="DesktopFolder">
<Component Id="FooDesktopShortcutMenu" Guid="D4D0A2ED-C0DB-4524-AC53-D30F904DB846">
<Shortcut Id="FooApplicationDesktopShortcut"
Name="Foo Application"
Description="The Foo is Cool!"
Target="[#FooMainApp]"
WorkingDirectory="INSTALLFOLDER"
Directory="DesktopFolder"/>
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Microsoft\FooApplication" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<!-- Tell Wix -->
<Feature Id="ProductFeature" Title="FooSetup" Level="1">
<ComponentRef Id="FooApplication" />
<ComponentRef Id="FooLib" />
<ComponentRef Id="FooShortcutMenu"/>
<ComponentRef Id="FooDesktopShortcutMenu"/>
<ComponentRef Id="RegistryEntries" />
</Feature>
</Product>
</Wix>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句