[wix-users] How to build WiX Custom Action projects without having VS Extension installed?

Bob Arnson bob at firegiant.com
Wed Jan 15 15:58:37 PST 2020


The Votive .vsix installs "redirect" targets files so you can reference them normally. They're just wrappers around the targets files installed by WiX.

-----Original Message-----
From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of Edwin Castro via wix-users
Sent: Wednesday, 15 January, 2020 18:44
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Edwin Castro <egcastr at gmail.com>
Subject: Re: [wix-users] How to build WiX Custom Action projects without having VS Extension installed?

I created sample.proj on my system with this content

<Project DefaultTargets="Default" xmlns="
http://schemas.microsoft.com/developer/msbuild/2003">
    <Target Name="Default">
        <Message Text="MSBuildBinPath = $(MSBuildBinPath)" />
        <Message Text="MSBuildExtensionsPath = $(MSBuildExtensionsPath)" />
    </Target>
</Project>

Then I ran the following powershell to run sample.proj against the msbuild.exe installed on my system

C:\temp> gci C:\Windows\Microsoft.NET\Framework,
C:\Windows\Microsoft.NET\Framework64, $env:ProgramFiles, ${env:ProgramFiles(x86)} -recurse -file -filter msbuild.exe -ea 0 |% { & $_.fullname sample.proj } | out-file sample.txt

Here is the output of sample.txt on my system

Microsoft (R) Build Engine Version 2.0.50727.9136 [Microsoft .NET Framework, Version 2.0.50727.9148] Copyright (C) Microsoft Corporation 2005. All rights reserved.

Build started 1/15/2020 3:38:01 PM.
__________________________________________________
Project "C:\temp\sample.proj" (default targets):

Target Default:
    MSBuildBinPath = C:\Windows\Microsoft.NET\Framework\v2.0.50727
    MSBuildExtensionsPath = C:\Program Files (x86)\MSBuild

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.05
Microsoft (R) Build Engine Version 3.5.30729.9135 [Microsoft .NET Framework, Version 2.0.50727.9148] Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 1/15/2020 3:38:01 PM.
Project "C:\temp\sample.proj" on node 0 (default targets).
  MSBuildBinPath = C:\Windows\Microsoft.NET\Framework\v2.0.50727
  MSBuildExtensionsPath = C:\Program Files (x86)\MSBuild Done Building Project "C:\temp\sample.proj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.08
Microsoft (R) Build Engine version 4.8.3752.0 [Microsoft .NET Framework, version 4.0.30319.42000] Copyright (C) Microsoft Corporation. All rights reserved.

Build started 1/15/2020 3:38:02 PM.
Project "C:\temp\sample.proj" on node 1 (default targets).
Default:
  MSBuildBinPath = C:\Windows\Microsoft.NET\Framework\v2.0.50727
  MSBuildExtensionsPath = C:\Program Files (x86)\MSBuild Done Building Project "C:\temp\sample.proj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.28
Microsoft (R) Build Engine Version 2.0.50727.9136 [Microsoft .NET Framework, Version 2.0.50727.9148] Copyright (C) Microsoft Corporation 2005. All rights reserved.

Build started 1/15/2020 3:38:02 PM.
__________________________________________________
Project "C:\temp\sample.proj" (default targets):

Target Default:
    MSBuildBinPath = C:\Windows\Microsoft.NET\Framework64\v2.0.50727
    MSBuildExtensionsPath = C:\Program Files\MSBuild

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.13
Microsoft (R) Build Engine Version 3.5.30729.9135 [Microsoft .NET Framework, Version 2.0.50727.9148] Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 1/15/2020 3:38:03 PM.
Project "C:\temp\sample.proj" on node 0 (default targets).
  MSBuildBinPath = C:\Windows\Microsoft.NET\Framework64\v2.0.50727
  MSBuildExtensionsPath = C:\Program Files\MSBuild Done Building Project "C:\temp\sample.proj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.21
Microsoft (R) Build Engine version 4.8.3752.0 [Microsoft .NET Framework, version 4.0.30319.42000] Copyright (C) Microsoft Corporation. All rights reserved.

Build started 1/15/2020 3:38:03 PM.
Project "C:\temp\sample.proj" on node 1 (default targets).
Default:
  MSBuildBinPath = C:\Windows\Microsoft.NET\Framework64\v2.0.50727
  MSBuildExtensionsPath = C:\Program Files (x86)\MSBuild Done Building Project "C:\temp\sample.proj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.42
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.

Build started 1/15/2020 3:38:07 PM.
Project "C:\temp\sample.proj" on node 1 (default targets).
Default:
  MSBuildBinPath = C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin
  MSBuildExtensionsPath = C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild Done Building Project "C:\temp\sample.proj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.03
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.

Build started 1/15/2020 3:38:07 PM.
Project "C:\temp\sample.proj" on node 1 (default targets).
Default:
  MSBuildBinPath = C:\Program Files (x86)\Microsoft Visual
Studio\2017\Professional\MSBuild\15.0\Bin\amd64
  MSBuildExtensionsPath = C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild Done Building Project "C:\temp\sample.proj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.03

So I'm guessing your build server is using an msbuild.exe from C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools.

If C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix.ca.targets is the same as the wix.ca.targets installed by the VS extension, then I'd explicitly set WixCATargetsPath to C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix.ca.targets on your build server.

--
Edwin G. Castro

On Wed, Jan 15, 2020 at 3:19 PM Edwin Castro <egcastr at gmail.com> wrote:

> Which version of WiX v3 are do you have installed? I think I see 
> wix.ca.targets installed by the WiX CoreMSI when the MSBuild Support 
> feature is selected.
>
>
> https://github.com/wixtoolset/wix3/blob/wix3112rtm/src/Setup/CoreMsi/M
> SBuild.wxs
>
>
> I think it gets installed into
> [ProgramFilesFolder]\MSBuild\Microsoft\WiX\v3.x
>
>
> https://github.com/wixtoolset/wix3/blob/wix3112rtm/src/Setup/CommonLib
> /Folders.wxs
>
>
> I expected MSBuildExtensionsPath to resolve to C:\Program Files 
> (x86)\MSBuild for a 32-bit process.
>
>
> https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-reserved
> -and-well-known-properties
>
>
> If WixCATargetsPath is not explicitly set to C:\Program Files 
> (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild 
> \Microsoft\WiX\v3.x\Wix.CA.targets then MSBuildExtensionsPath must be 
> getting resolved to C:\Program Files (x86)\Microsoft Visual 
> Studio\2017\BuildTools\MSBuild by the version of MSBuild used on your 
> build server.
>
> I'd confirm that C:\Program Files
> (x86)\MSBuild\Microsoft\WiX\v3.x\wix.ca.targets exists and explicitly 
> set WixCATargetsPath on your build server OR figure out why 
> MSBuildExtensionsPath seems to be getting resolved to a non-standard 
> directory.
>
> --
> Edwin G. Castro
>
>
> On Wed, Jan 15, 2020 at 2:53 PM Philipp Weber via wix-users < 
> wix-users at lists.wixtoolset.org> wrote:
>
>> Hi,
>>
>> I've got a C# solution containing a WiX installer project, which 
>> references a C# Custom Action project for WiX v3. Within the csproj 
>> of that CA project, there is a WixCATargetsPath entry referencing the 
>> file
>> Wix.CA.targets:
>>
>> <WixCATargetsPath Condition=" '$(WixCATargetsPath)' == ''
>>
>> ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.CA.targets</WixCATa
>> rgetsPath>
>>
>> The Wix.CA.targets is obviously part of the installation of the Wix 
>> Toolset VS 2017 Extension, and not of the Wix Toolset itself. But on 
>> our build server, neither Visual Studio nor Wix Toolset Extension is 
>> installed, which is why the build there fails:
>>
>> error MSB4019: Das importierte Projekt "C:\Program Files 
>> (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\WiX\v3.x\Wix.CA.targets"
>> wurde nicht gefunden. Vergewissern Sie sich, dass der Pfad in der 
>> <Import>-Deklaration korrekt und die Datei auf dem Datenträger 
>> vorhanden ist.
>>
>> On the build server, WiX Toolset is installed, but not the 
>> corresponding VS extension.
>> So is it possible to build Custom Action projects on the build server 
>> without having the Wix Toolset Extension installed? Is there any 
>> alternative?
>>
>> Thanks for your help in advance
>> Philipp
>>
>> ____________________________________________________________________
>> WiX Toolset Users Mailing List provided by FireGiant 
>> http://www.firegiant.com/
>
>

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/


More information about the wix-users mailing list