简体   繁体   English

将Windows Workflow活动添加到项目时无法加载指定的元数据资源?

[英]Unable to load the specified metadata resource when I add a Windows Workflow activity to the project?

I have an ASP .NET project that contains one emdx model; 我有一个包含一个emdx模型的ASP .NET项目。 the project worked fine before I add a Workflow activity to it. 在向其中添加工作流程活动之前,该项目运行良好。 When the workflow activity is added to the project, the following error happens "Unable to load the specified metadata resource". 将工作流活动添加到项目时,会发生以下错误“无法加载指定的元数据资源”。 I examined the generated .dll file using reflector in both cases and I found that 我在两种情况下都使用了反射器检查了生成的.dll文件,发现

1- when I remove the workflow activity, the resource files (.csdl,.msl,.ssdl) are embedded correctly. 1-当我删除工作流程活动时,资源文件(.csdl,.msl,.ssdl)已正确嵌入。

2- when the workflow activity exists, the resources are not embedded, instead the workflow resource files are embedded. 2-当存在工作流活动时,不嵌入资源,而是嵌入工作流资源文件。

The workflow activity is ABC.xaml. 工作流程活动为ABC.xaml。 in resources, I found these two files only (ABC.g.xaml, TestApp_ABC_BeforeInitializeComponentHelper.txt). 在资源中,我仅找到了这两个文件(ABC.g.xaml,TestApp_ABC_BeforeInitializeComponentHelper.txt)。

Is there any fix that will make the .edmx resource file be embedded while using Workflow. 是否有任何修补程序可以使使用Workflow时嵌入.edmx资源文件。

I couldn't find a way to make the resources be embedded, but I found a workaround that will make it work. 我找不到使资源嵌入的方法,但是我找到了一种解决方法,可以使资源正常工作。

When the project is built, the resource files (.csdl,.msl,.ssdl) are generated in the directory /obj/Debug/edmxResourcesToEmbed. 生成项目后,资源文件(.csdl,.msl,.ssdl)在目录/ obj / Debug / edmxResourcesToEmbed中生成。 I copied the files to the bin directory and changed the connection string to be 我将文件复制到bin目录,并将连接字符串更改为

<add name="TestDBEntities" connectionString="metadata=~/bin/TestDBModel.csdl|~/bin/TestDBModel.ssdl|~/bin/TestDBModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=****;initial catalog=TestDB;persist security info=True;user id=*****;password=******;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>

instead of 代替

 <add name="TestDBEntities" connectionString="metadata=res://*/TestDBModel.csdl|res://*/TestDBModel.ssdl|res://*/TestDBModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=****;initial catalog=TestDB;persist security info=True;user id=*****;password=******;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>

by doing this, the application will get the resource files from the bin directory, instead of getting them from the .dll file. 这样,应用程序将从bin目录中获取资源文件,而不是从.dll文件中获取资源文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM