2015-05-18 77 views
0
产生的MSI安装后设置

我WSX文件看起来像这样:https://gist.github.com/pyeremenko/891eceb779197e4be240#file-sample-wxs-L23-L25没有环境变量由维克斯

复制工作正常,可即exe文件在Program Files/test/my_test文件夹,但在安装后通过我无法访问TEST环境变量echo %test%(当然我重装CMD)

我也试图寻找它在系统属性>环境变量,但没有这样的变种有

我应该怎么做才能让MSI注册环境变量?

+1

下面是一个示例:http://blogs.technet.com/b/alexshev/archive/2008/03/28/from-msi-to-wix-part-13-installable-items-environment-variable.aspx –

回答

1

建设有维克斯3.9以上WSX文件生成这些错误:

Product.wxs(23,0): error LGHT0204: ICE18: KeyPath for Component: 'EnvVariable' is Directory: 'INSTALLDIR'. The Directory/Component pair must be listed in the CreateFolders table. 
Product.wxs(23,0): error LGHT0204: ICE21: Component: 'EnvVariable' does not belong to any Feature. 

若要安装,EnvVariable需要与功能相关联的组件。试着用<File...>结合<Environment...>到单个组件:

<Component Id='MainExecutable' Guid='77777777-8888-4fb0-892f-d62579f11b8d'> 
     <File Id='my_testexe' Name='hello.exe' DiskId='1' Source='D:\Robert\Documents\Visual Studio 2013\Projects\SetupProject1\Release\ConsoleApplication1.exe' KeyPath='yes' /> 
     <Environment Id='UpdateTest' Name='TEST' Action='set' Permanent='yes' System='yes' Part='all' Value='TestTestTest' /> 
    </Component> 

删除现在空组件<Component Id='EnvVariable'...>

如果仍然有问题,你可以尝试与运行诊断日志记录安装程序:

msiexec /l*v Install.log /i InstallPackage.msi 

搜索文件Install.logMainExecutable怎么看正在安装的组件。