Wix 文件关联与标准 Windows 文件 [英] Wix File Association with standard Windows File

查看:43
本文介绍了Wix 文件关联与标准 Windows 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个 Wix 项目.我需要关联一个新的文件扩展名.就其本身而言,看起来很简单.问题是我想将新扩展名关联为一种可以使用标准 Windows NotePad.exe 打开的文本文件.我遇到的问题/担忧是我不想复制我的 XP 版本的记事本并将其安装在最终用户的 System32 中并覆盖他们应该已经存在的 XP、Vista、Windows7 等记事本.

I'm working on a Wix project. I need to associate a new file extension. In itself, appears simple. The issue is I want to associate a new extension as a type of text file that can be open with standard Windows NotePad.exe. The issue/concern I have is I don't want to copy My XP version of Notepad and have it installed within the end-user's System32 and overwrite their Notepad for XP, Vista, Windows7, etc which should already be there.

我应该如何正确引用这个关联.

How should I properly reference this association.

最终答案归功于@Sunil

Wix 3.5 不喜欢带有系统文件夹和文件名的目标文件...因此,在我的组件/目录中,我创建了一个指向相关文件的文件 ID 条目,然后,与此文件的扩展关联文件ID参考如下...

Wix 3.5 didn't like the target file with the system folder and file name... So, within my component/directory, I created a file ID entry pointing to the file in question, THEN, the extension association to this file ID reference as below...

<File Id="LinkingNotePad" Source="$(env.windir)\Notepad.exe" ></File>

<ProgId Id="MyProgID" Description="Text files for my new extension" Advertise="no" >
   <Extension Id="myExt" ContentType="application/text" Advertise="no" >
      <Verb Command="Open" Id="regMyProgID" TargetFile="LinkingNotePad" Argument="%1" />
   </Extension>
</ProgId>

在上面的示例中,它无法解析目标文件,因为我没有明确告诉它在哪里可以找到它.我不希望它抓取我的版本并覆盖用户版本.

In the above sample, it can't resolve the target file as I have not explicitly told it where to find it. I don't want it to grab my version and overwrite the users version.

谢谢

推荐答案

可以使用 WIX 变量SystemFolder"访问所有系统文件.

All system files can be accessed using the WIX variable "SystemFolder".

SystemFolder 将为您提供默认的 Windows 文件夹路径.所以你将有 TargetFile=[SystemFolder]Notepad.exe"

SystemFolder will give you the default Windows folder path. So you will have TargetFile=[SystemFolder]Notepad.exe"

这篇关于Wix 文件关联与标准 Windows 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆