Home > Blockchain >  Where does the $(WixTargetsPath) property get set for this .wixproj file?
Where does the $(WixTargetsPath) property get set for this .wixproj file?

Time:11-24

I am new to project files and was doing some investigating today to try and understand the .wixproj file that was automatically generated using VS2019 WiX project template. I was able to understand most of it, but I am stuck on one small question. Where does the $(WixTargetsPath) property get set? At this point I have probably wasted a lot of time trying to figure this out for no reason, but I am just so curious now! I read up on all the different ways properties can get set in a proj file but I was not able to find the variable definition anywhere. Here is my .wixproj file:

<?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>

I checked the environment variable's but did not find anything. I read up on .props files, but have no idea where a wix.props file would be included. It builds with msbuild so I know it is set, but aside from the wix installer modifying msbuild.exe to include additional default properties I have no idea where this property is set.

CodePudding user response:

It doesn't. The

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

ensures the Import is attempted only if it is set.

That line exists if you want to point to a wix.targets file that isn't in the MSBuildExtensionsPath32 path used in the next line.

  • Related