Wix File Association with standard Windows File

巧了我就是萌 提交于 2019-12-10 11:28:05

问题


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.

FINAL ANSWER as credited to @Sunil

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.

Thanks


回答1:


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

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




回答2:


Windows Installer doesn't support file associations for already installed products. So if you want to create a file association for an existing file, you can try creating it manually through registry entries:

  • http://msdn.microsoft.com/en-us/library/cc144104(VS.85).aspx
  • http://phi.lho.free.fr/windows_tips/FileAssociations.en.html


来源:https://stackoverflow.com/questions/6901285/wix-file-association-with-standard-windows-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!