How can we add embedded resources to a file which is compiled from a source file at run-time

萝らか妹 提交于 2019-11-28 10:30:35

You'll need to create a .resources file containing the files you want to embed as resources, and then reference the generated resource file in your CompilerParameter's instance using the EmbeddedResources property.

Follow the directions from Resources in .resources Files section of the first link above (the section that refers to System.Resources.ResourceWriter), which will produce a temporary file. Then based on the code in your question (and the example from the EmbeddedResources documentation), you'll reference it with something like:

if (provider.Supports(GeneratorSupport.Resources))
{
    cp.EmbeddedResources.Add("pathToYourGeneratedResourceFile");
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!