2013-03-21 25 views
1

我有一個C#項目。我想要構建一個exe或MSI,具體取決於配置。Visual Studio項目文件指定多個導入

微星被定義爲

<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'. 

我該怎麼辦?

回答

5

您無法將這兩個目標導入到單個項目中。他們都希望能夠處理Compile項目(使用完全不同的工具,即:candle.execsc.exe)。你需要單獨的項目。通常,Microsoft.CSharp.targets進入.csproj並且Wix.targets進入.wixproj。

+0

大圖:我有四個項目,其中三個構建可執行文件。我需要每個人都有一個MSI。這是否意味着我需要添加三個項目,除了.wixproj之外,每個項目基本上都是空的? – 2013-03-21 19:39:09

+0

通常,每個.msi都有一個.wixproj,就像每個可執行文件都有一個項目一樣。您可以對項目採取更高級的技巧,以儘量減少項目數量。您可以看到我們在wix38分支的src \ Setup \ VotiveMsi的WiX工具集中使用Visual Studio集成進行此操作。 – 2013-03-21 23:16:03

相關問題