MSBuild:包含自定义资源文件作为嵌入式资源 [英] MSBuild: Include a custom resource file as embedded resource
本文介绍了MSBuild:包含自定义资源文件作为嵌入式资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用MSBuild在构建时动态生成资源文件,但是为了能够在运行时从此资源文件中读取,我需要将其作为嵌入式资源.
I am dynamically generating a resource-file at build time with MSBuild, but in order to be able to read from this resource file at run-time, I need it to be an embedded resource.
我到处都在研究如何将.csproj
中的文件标记为嵌入式资源,甚至尝试都没有用.
I have looked everywhere at how to mark a file in a .csproj
as embedded resource, I have even tried this to no avail.
<ItemGroup>
<Content Include="Infrastructure\Content\Store\content_store_en.json" />
<EmbeddedResource Include="Infrastructure\Content\Store\content_store_en.json">
</EmbeddedResource>
</ItemGroup>
有什么办法可以做到这一点?
Is there any way I can achieve this ?
推荐答案
操作方法如下:
<Target Name="BeforeBuild">
<CreateItem Include="Infrastructure\**\*.json">
<Output ItemName="EmbeddedResource" TaskParameter="Include" />
</CreateItem>
</Target>
我更改了CreateItem属性,以使其反映您的问题.
I changed the CreateItem attribute so it will reflect your question.
我希望它能对您有所帮助...
I hope it helps...
这篇关于MSBuild:包含自定义资源文件作为嵌入式资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文