2

理想情况下,我会从项目规范本身获取输出,但 heat.exe 似乎不支持将contentproj文件作为项目类型,如果我传入游戏的 main ,它也不会获取内容csproj

目前我有一个在输出文件夹上调用 heat 的预构建步骤,但是 (a) 感觉很脏,并且 (b) 产生了一堆File引用相对于输出文件夹的源路径的标签,这样构建失败时它可以'找不到它们相对于 WiX 项目的文件夹。

我应该注意到我正在使用 Votive,我的项目布局如下所示:

- Main solution
 - XNA "Metaproject" Folder
  - Game
   - bin/x86/Release (GameContent output appears here)
  - GameContent
 - WiX Project

我非常希望尽量减少必须指定类似路径的次数"../../Game/Game/bin/x86/Release/Content",因为这很容易出错并且令人沮丧。对正确方向的刺激表示赞赏!

4

1 回答 1

2

Assuming a contentproj is just a collection of files, what you can do is add the harvesting directly within the wixproj that is creating the installer:

<PropertyGroup>
    <HarvestDirectoryNoLogo>true</HarvestDirectoryNoLogo>
    <HarvestDirectorySuppressFragments>true</HarvestDirectorySuppressFragments>
    <HarvestDirectorySuppressUniqueIds>true</HarvestDirectorySuppressUniqueIds>
    <HarvestDirectoryAutogenerateGuids>true</HarvestDirectoryAutogenerateGuids>
</PropertyGroup>
<ItemGroup>
    <HarvestDirectory Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' " 
                      Include="$(SolutionDir)\GameContent">
        <DirectoryRefId>INSTALLDIR</DirectoryRefId>
        <SuppressRootDirectory>true</SuppressRootDirectory>
        <PreprocessorVariable>var.GameContentDir</PreprocessorVariable>
        <ComponentGroupName>GameContent</ComponentGroupName>
    </HarvestDirectory>    
</ItemGroup>

You will need to add this manually to the wixproj file and you can repeat the HarvestDirectory for each directory if you require more than one.

To set the var.GameContentDir pre-processor variable edit the DefineConstants property:

<DefineConstants>GameContentDir=$(GameContentDir);</DefineConstants>

which will set the pre-processor var to the msbuild property:

<GameContentDir>$(SolutionDir)\GameContent</GameContentDir> 

which means you can then modify this dependant on the build configuration. If you don't need to modify the path, just set a static value in the <DefineConstants> property.

This will then generate a wxs file in the obj directory each build which is then included assuming you have included the ComponentGroupName. If you have included the one you previously generated in your wixproj remove it as you will get conflicts if the ComponentGroupName is the same.

于 2012-07-02T16:18:07.350 回答