理想情况下,我会抓取项目规范本身的输出,但heat.exe似乎不支持将contentproj文件作为项目类型,如果我传入游戏的主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"这样的路径的次数,因为这样很容易出错,而且输入时会很压抑。向正确的方向前进,非常感谢!
发布于 2012-07-03 00:18:07
假设contentproj只是一个文件集合,您可以做的是直接在创建安装程序的wixproj中添加收获:
<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>您需要手动将其添加到wixproj文件中,如果需要多个目录,则可以对每个目录重复执行HarvestDirectory。
要设置var.GameContentDir预处理器变量,请编辑DefineConstants属性:
<DefineConstants>GameContentDir=$(GameContentDir);</DefineConstants>它会将预处理器变量设置为msbuild属性:
<GameContentDir>$(SolutionDir)\GameContent</GameContentDir> 这意味着您可以根据构建配置修改此依赖项。如果不需要修改路径,只需在<DefineConstants>属性中设置一个静态值。
这将在每个构建的obj目录中生成一个wxs文件,然后假设您已包含ComponentGroupName,则包含该文件。如果您已经将之前生成的ComponentGroupName包含在您的wixproj中,则将其删除,因为如果该wixproj相同,您将得到冲突。
https://stackoverflow.com/questions/11287016
复制相似问题