2011-06-23 85 views
0

我需要一些帮助为我的Windows Phone 7应用程序。Silverlight WP7资源DLL

我想在我的第一个项目中构建一个嵌入我所有字符串资源的.dll文件。

然后,在我的第二个项目中,我想构建HelloWorld应用程序,它可以使用我的.dll中的字符串。

要做到这一点我建立的.dll根据这个帖子:http://msdn.microsoft.com/en-us/library/21a15yht%28v=VS.100%29.aspx

所以我先编译.resx文件:

ResGen.exe /useSourcePath /compile strings.fr.rex,HelloWorld.strings.fr.resources 

好吧,我的文件HelloWorld.strings.fr.resources是成功创建。

现在,我编译.resources文件到.dll文件:

al.exe /t:lib /embed:HellowWorld.strings.fr.resources /culture:fr /out:HelloWorld.resources.dll 

好吧,我的文件HelloWorld.resources.dll成功创建

现在,在我的第二个项目WP7 HelloWorld中,我右键单击“引用”并添加我的.dll。

Thenk在主网页我打电话资源经理是这样的:

System.Resources.ResourceManager rm = new System.Resources.ResourceManager("HelloWorld.resources", System.Reflection.Assembly.GetExecutingAssembly()); 

并尝试从DLL加载字符串:

PageTitle.Text = rm.GetString("mystring"); 

但在运行时,我得到异常:MissingManifestResourceException

你能帮忙解决吗?

+1

此解决方案有帮助吗? http://stackoverflow.com/questions/1327692/c-what-does-missingmanifestresourceexception-mean-and-how-to-fix-it – keyboardP

回答

0

我在App Hub论坛中告诉你,你不能用WP7做DLL。 http://forums.create.msdn.com/forums/p/87635/525973.aspx#525973 由于我有一个C代码库,我不想在C#中重写,因此这使得我想从水中完成任务。我有很多代表图形的表格,而C#没有像C/C++那样很好的结构设施。这是进展?

这已经够糟的是C#(其中确实有一些有趣的事情)再次失败,甚至实现结构设施,基本的宏功能和能力的条件编译工具,现在这个。无法重用C代码?我正在考虑推出WP7,并为我的应用使用Android和iPhone。 Grrrrrrrrrrrrrrrrrr。

+0

我很好奇....你踢了Wp7吗?你选择了Android吗? – Paul