【问题标题】:Where does the $(WixTargetsPath) property get set for this .wixproj file?这个 .wixproj 文件的 $(WixTargetsPath) 属性在哪里设置?
【发布时间】:2021-11-23 02:06:18
【问题描述】:

我是项目文件的新手,今天正在做一些调查以尝试了解使用 VS2019 WiX 项目模板自动生成的 .wixproj 文件。我能够理解其中的大部分内容,但我被困在一个小问题上。 $(WixTargetsPath) 属性在哪里设置? 在这一点上,我可能已经浪费了很多时间试图无缘无故地弄清楚这一点,但我现在很好奇!我阅读了可以在 proj 文件中设置属性的所有不同方式,但我无法在任何地方找到变量定义。这是我的 .wixproj 文件:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>3.10</ProductVersion>
    <ProjectGuid>TestGUID-1234</ProjectGuid>
    <SchemaVersion>2.0</SchemaVersion>
    <OutputName>MySetup</OutputName>
    <OutputType>Package</OutputType>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
    <DefineConstants>Debug</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="MainComponents.wxs" />
    <Compile Include="Product.wxs" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\MyOtherProj\MyOtherProj.csproj">
      <Name>MyOtherProj</Name>
      <Project>TestGUID-1234/Project>
      <Private>True</Private>
      <DoNotHarvest>True</DoNotHarvest>
      <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
      <RefTargetDir>INSTALLFOLDER</RefTargetDir>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <WixExtension Include="WixUIExtension">
      <HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
      <Name>WixUIExtension</Name>
    </WixExtension>
    <WixExtension Include="WixNetFxExtension">
      <HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
      <Name>WixNetFxExtension</Name>
    </WixExtension>
  </ItemGroup>
  <ItemGroup>
    <Content Include="TestLicense.rtf" />
  </ItemGroup>
  <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
  <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
    <Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
  </Target>
  
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
</Project>

我检查了环境变量,但没有找到任何东西。我阅读了 .props 文件,但不知道将包含 wix.props 文件的位置。它使用 msbuild 构建,所以我知道它已设置,但除了 wix 安装程序修改 msbuild.exe 以包含其他默认属性外,我不知道该属性设置在哪里。

【问题讨论】:

    标签: c# visual-studio msbuild wix project-files


    【解决方案1】:

    它没有。

    Condition=" '$(WixTargetsPath)' != '' "
    

    确保Import 仅在设置了 时才被尝试。

    如果您要指向不在下一行使用的MSBuildExtensionsPath32 路径中的 wix.targets 文件,则该行存在。

    【讨论】:

    • 谢谢!当然,解决方案是我不想要的。
    猜你喜欢
    • 2013-05-24
    • 1970-01-01
    • 1970-01-01
    • 2016-10-01
    • 2016-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多