SharpDX - 选择构建操作

时间:2014-11-15 02:36:05

标签: c# sharpdx

使用SharpDX。现在我想使用ContentManager并加载一些资源,因此我必须设置特定文件的构建操作(ToolkitTexture或ToolkitFont)。问题是,我无法在这两个行动之间做出选择。

我发现了这个“解决方法”http://sharpdx.org/forum/5-api-usage/2504-toolkit-spritefont-spritefont-compiler-and-build-action并且我手动添加了SharpDX的NuGet - .packages文件夹,但是这并没有使选项可见。我缺少什么?

亲切的问候,Erik

1 个答案:

答案 0 :(得分:0)

所以...找到了解决方案:

必须在* .csproj文件的末尾添加以下内容,即所有SharpDX - 构建操作都可用

<Import Project="..\..\SharpDX\packages\SharpDX.2.6.2\build\SharpDX.targets" Condition="Exists('..\..\SharpDX\packages\SharpDX.2.6.2\build\SharpDX.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
  <PropertyGroup>
    <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
  </PropertyGroup>
  <Error Condition="!Exists('..\..\SharpDX\packages\SharpDX.2.6.2\build\SharpDX.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\SharpDX\packages\SharpDX.2.6.2\build\SharpDX.targets'))" />
  <Error Condition="!Exists('..\..\SharpDX\packages\SharpDX.Toolkit.2.6.2\build\SharpDX.Toolkit.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\SharpDX\packages\SharpDX.Toolkit.2.6.2\build\SharpDX.Toolkit.targets'))" />
</Target>
<Import Project="..\..\SharpDX\packages\SharpDX.Toolkit.2.6.2\build\SharpDX.Toolkit.targets" Condition="Exists('..\..\SharpDX\packages\SharpDX.Toolkit.2.6.2\build\SharpDX.Toolkit.targets')"/>

所以只是第一行是不够的(但可能错误块是强制性的,但安全第一;)

亲切的问候,Erik