【问题标题】:MSBuild: Include a custom resource file as embedded resourceMSBuild:包含自定义资源文件作为嵌入资源
【发布时间】:2015-04-10 10:40:32
【问题描述】:

我在构建时使用 MSBuild 动态生成资源文件,但为了能够在运行时读取此资源文件,我需要它是嵌入式资源。

我到处查看如何将.csproj 中的文件标记为嵌入式资源,我什至尝试过这种方法无济于事。

<ItemGroup>
  <Content Include="Infrastructure\Content\Store\content_store_en.json" />
  <EmbeddedResource Include="Infrastructure\Content\Store\content_store_en.json">
  </EmbeddedResource>
</ItemGroup>

有什么方法可以实现吗?

【问题讨论】:

  • 如果对您有帮助,请将其标记为已回答:)

标签: visual-studio msbuild csproj


【解决方案1】:

这是你的做法:

<Target Name="BeforeBuild">
    <CreateItem Include="Infrastructure\**\*.json">
        <Output ItemName="EmbeddedResource" TaskParameter="Include" />
    </CreateItem>
</Target>

来源:http://ayende.com/blog/4446/how-to-setup-dynamic-groups-in-msbuild-without-visual-studio-ruining-them

我更改了 CreateItem 属性,以便它反映您的问题。

希望对你有帮助……

【讨论】:

    猜你喜欢
    • 2019-03-28
    • 2010-10-02
    • 1970-01-01
    • 2011-06-04
    • 1970-01-01
    • 1970-01-01
    • 2021-07-26
    • 2016-10-09
    • 1970-01-01
    相关资源
    最近更新 更多