安装 WIX 生成的 MSI 后未设置环境变量
No environment variable set after installation of MSI generated by WIX
我的 WSX 文件如下所示:https://gist.github.com/pyeremenko/891eceb779197e4be240#file-sample-wxs-L23-L25
复制工作正常,即 exe 文件在 Program Files/test/my_test
文件夹中可用,但我无法通过 echo %test%
安装后访问 TEST
env 变量(当然我重新加载 cmd)
我也尝试在系统属性 > 环境变量中查找它,但那里没有这样的变量
如何让MSI注册env变量?
使用 WIX 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
需要与功能相关联。尝试将 <Environment...>
与 <File...>
组合成一个组件:
<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.log
中搜索 MainExecutable 以查看组件的安装方式。
我的 WSX 文件如下所示:https://gist.github.com/pyeremenko/891eceb779197e4be240#file-sample-wxs-L23-L25
复制工作正常,即 exe 文件在 Program Files/test/my_test
文件夹中可用,但我无法通过 echo %test%
安装后访问 TEST
env 变量(当然我重新加载 cmd)
我也尝试在系统属性 > 环境变量中查找它,但那里没有这样的变量
如何让MSI注册env变量?
使用 WIX 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
需要与功能相关联。尝试将 <Environment...>
与 <File...>
组合成一个组件:
<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.log
中搜索 MainExecutable 以查看组件的安装方式。