最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

installation - Wix - Trouble adding DotNetCompatibilityCheck and file association - Stack Overflow

programmeradmin0浏览0评论

I am trying to develop an installer for a WPF application using Wix. So far, I have developed an installer that copies the executable file and DLLs, and a runtime Python folder in Program Files. There are some setbacks. This is the code so far. I have skipped some working code for brevity.

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns=";
     xmlns:netfx=";>

<Package Manufacturer="Denis Ivanov"
         Name="Adjustrix Desktop"
         UpgradeCode="5e40079f-d71d-4357-8339-bea315159720"
         Version="0.1"
         InstallerVersion="500">
    <MediaTemplate EmbedCab="yes"/>
    <StandardDirectory Id="ProgramFiles64Folder">
        <Directory Id="PFRoot" Name="Adjustrix">
            <Directory Id="DesktopRoot" Name="Desktop">
                <Directory Id="AppearanceFolder" Name="appearance"/>
                <Directory Id="RuntimeFolder" Name="runtime">
                </Directory>
            </Directory>
        </Directory>
    </StandardDirectory>

    <Feature Id="ExecutableInstall">
        <!-- SKIPPED: Code for installing the executable -->
        <Component Bitness="always64" Id="CmpExe_File_76FF29E851FA43359CCFBFD9F00E336A" Directory="DesktopRoot">
            <File Id="FileExe_File_76FF29E851FA43359CCFBFD9F00E336A" Name="AdjustrixWPF.exe" Source="C:\Users\denis\source\repos\Adjustrix\AdjustrixWPF\bin\Release\net8.0-windows\AdjustrixWPF.exe">
                <Shortcut Id="StartMenuShortcut"
                        Directory="ProgramMenuFolder"
                        Name="Adjustrix Desktop"
                        WorkingDirectory="DesktopRoot"
                        Icon="MyApp.ico"
                        Advertise="yes"/>
            </File>
            <ProgId Id="AdjxExtension" Description="Adjustrix project file" Icon="IconFileId">
                <Extension Id="adjx" ContentType="application/adjx">
                    <Verb Id="open" Command="Open" TargetFile="FileExe_File_76FF29E851FA43359CCFBFD9F00E336A" Argument='"%1"' />
                </Extension>
            </ProgId>
        </Component>
        <!-- SKIPPED: Code for installing the executable -->
    </Feature>

    <Feature Id="AppearanceInstall">
        <Component Bitness="always64" Directory="AppearanceFolder">
            <File Id="IconFileId" Source="C:\Users\denis\source\repos\Adjustrix\Logo3.ico"/>
        </Component>
    </Feature>

    <Feature Id="ProgramInstall">
        <!-- SKIPPED: Code for installing the Python executable and folder-->
    </Feature>

    <!-- Define an icon for the application -->
    <Icon Id="MyApp.ico" SourceFile="C:\Users\denis\source\repos\Adjustrix\Logo3.ico"/>
    <Property Id="ARPPRODUCTICON" Value="MyApp.ico"/>

</Package>

<Fragment>
    <Property Id="Checkdotnet"/>
    <netfx:DotNetCompatibilityCheck Id="Runtime"
                                    RuntimeType="desktop"
                                    Platform="x64"
                                    Version="8.0.0"
                                    Property="Checkdotnet"/>
    <PackageGroup Id="MyPackage">
        <ExePackage
          SourceFile="[sources]\packages\shared\windowsdesktop-runtime-3.1.10-win-x86.exe"
          DownloadUrl=".0.12-win-x64.exe"
          InstallCondition="x64 = 1 AND OSVersion >= v5.0.5121.0 AND DotNetCompatibilityCheckResult = 0" />
    </PackageGroup>
</Fragment>
</Wix>

This is my project file:

<Project Sdk="WixToolset.Sdk/5.0.2" Platform="x64">
  <ItemGroup>
    <PackageReference Include="WixToolset.Heat" Version="5.0.2" />
    <PackageReference Include="WixToolset.Netfx.wixext" Version="5.0.2" />
  </ItemGroup>
</Project>

I encountered the following problems:

  1. I expected the code within the ProgId tags to associate the .adjx file with my program and to set the file to be executed with it. I also wanted it to set the icon of the file to the specified icon. However, the result is slightly different. Before running the installer, the .adjx file is opened with Notepad by default. After using the installer, when I double click the file, the OS asks me for an app to open the file with and my program is the first in the list. It is as if the OS has multiple options to open the file with.

  2. This is the bigger issue. When I added the Fragment near the end of the file to check for .NET Desktop Runtime, I could no longer build the MSI. When I try to build it using the Wix command line commands, I get these errors:

WIX0200 - as if the namespace netfx doesn't contain the DotNetCompatibilityCheck element.

WIX0414 - ExePackage missing attribute Detect condition

WIX1006 - The property Checkdotnet doesn't contain Value

I tried to build the project using MSBuild or dotnet build, but when I try to do that, I get the following error for all the components of the file:

This package contains 64 bit component, but the Template Summary Property does not contain Intel64 or x64

To be honest, I have no idea how to write the code for the dotnet checking. I found multiple options on the internet and believe that in different Wix versions, the syntax was different. Therefore, I got utterly confused. Can someone please give me some advice or example on how to do it?

发布评论

评论列表(0)

  1. 暂无评论