【发布时间】:2015-01-07 04:39:59
【问题描述】:
我正在尝试将嵌入式资源包含到我正在使用 Roslyn 编译的 dll 中。我找到了一些帮助我走上正轨的东西here.
但是,当我使用以下代码创建 dll 时:
const string resourcePath = @"C:\Projects\...\Properties\Resources.resources";
var resourceDescription = new ResourceDescription(
"Resources.resources",
() => File.OpenRead(resourcePath),
true);
var result = mutantCompilation.Emit(file, manifestResources: new [] {resourceDescription});
我发现它将通过我为项目创建的所有单元测试,除了那些依赖资源文件的单元测试。
我得到的错误如下所示:
System.Resources.MissingManifestResourceException ... Make sure "[Project].Properties.Resources.resources" was correctly embedded or linked into
assembly "[Project]" at compile time, or that all the satellite assemblies required are loadable and fully signed.
dll 应该是经过签名的,当它由 roslyn 发出时,它会带有正确的公钥。此外,Resource.resx 直接包含在我的项目的 Properties 文件夹中。
如果有人能提供任何帮助,我将不胜感激。
【问题讨论】:
-
编辑了我的问题以反映我所做的更多研究。
-
当我尝试点击您在第一段中提供的链接时,我收到“您无权执行此操作”。我想你不记得它的全部内容了吗?
标签: c# embedded-resource roslyn