Wix C# 自定义操作不生成 CA.dll,只生成 .dll

问题描述

我正在将 Wix 集成到日常构建中,并且我正在尝试构建自定义操作,而无需在本地安装 Wix 工具集。因此,我使用了 wix 提供的二进制文件,它们适用于基本安装程序本身。

当我尝试构建 C# 自定义操作时出现问题,构建本身通过,但它只生成 .dll,而不是我需要的 CA.dll。 我怀疑问题出在我修改的 .csproj 本身

.csproj 用于自定义操作:

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

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)