1

我有一个 C# 项目。我想根据配置构建 exe 或 MSI。

MSI 定义为

<PropertyGroup>
  <Configuration Condition=" '$(Configuration)' == '' ">MSI</Configuration>
  <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
  <ProductVersion>9.0.30729</ProductVersion>
  <ProjectGuid>{DCB76E90-6364-4DFB-B568-3680EE4F9C80}</ProjectGuid>
  <SchemaVersion>2.0</SchemaVersion>
  <OutputName>Project1</OutputName>
  <OutputType>Package</OutputType>
  <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
  <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'MSI|x86' ">
  <OutputPath>bin\MSI2\</OutputPath>
  <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
  <Compile Include="MyWxs.wxs" />
</ItemGroup>

问题是当我尝试同时拥有两者时

<Import Project="$(WixTargetsPath)" />

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

错误

A problem occurred while trying to set the "TargetType" parameter for the IDE's in-process compiler.
Invalid target type "package" for /target: must specify 'exe', 'winexe', 'library', or 'module'.

我该怎么办?

4

1 回答 1

5

您不能将这两个目标都导入到一个项目中。他们都希望能够处理这些Compile项目(使用完全不同的工具,即:candle.execsc.exe)。您需要单独的项目。通常,Microsoft.CSharp.targets进入 .csproj 并Wix.targets进入 .wixproj。

于 2013-03-21T19:17:53.107 回答