I am integrating Wix into daily builds, and I am trying to build a custom action without having Wix Toolset installed locally. I am therefore using the binaries provided by wix, and they work fine for the basic installer itself.
The problem arises when I try to build the C# custom action, the build itself passes, but it only generates the .dll, and not the CA.dll which I require. I suspect the problem is in the .csproj itself that I modified
.csproj for the custom action:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{970397C2-1306-47C4-8E61-20949BD061E3}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>InstallerExtensions</RootNamespace>
<AssemblyName>InstallerExtensions</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<WixToolPath>$(SystemDrive)\WixTools\</WixToolPath>
<WixTargetsPath>$(WixToolPath)wix.targets</WixTargetsPath>
<WixExtDir>$(WixToolPath)</WixExtDir>
<WixTasksPath>$(WixToolPath)WixTasks.dll</WixTasksPath>
<WixSdkPath>$(WixToolPath)sdk\</WixSdkPath>
<WixCATargetsPath>$(WixSdkPath)wix.nativeca.targets</WixCATargetsPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xml">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Deployment.WindowsInstaller">
<HintPath>$(WixSdkPath)Microsoft.Deployment.WindowsInstaller.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Configuration.cs" />
<Compile Include="CustomAction.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Content Include="CustomAction.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Company\Company.Util\Company.Util.csproj">
<Project>{02c36290-8ce5-43ec-a21a-b61151e17642}</Project>
<Name>Company.Util</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(WixCATargetsPath)" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
add this to the end of the project file:
<Import Project="$(WixCATargetsPath)" Condition=" '$(WixCATargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets" Condition=" '$(WixCATargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixCATargetsImported)' != '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>