I need some help for my Windows Phone 7 application.
I would like in my first project to build a .dll which embed all my strings resources.
And then, in my second project, I would开发者_Go百科 like to build HelloWorld Application, which can use strings from my .dll.
To do that I build .dll according to this post : http://msdn.microsoft.com/en-us/library/21a15yht%28v=VS.100%29.aspx
So i first compile .resx file :
ResGen.exe /useSourcePath /compile strings.fr.rex,HelloWorld.strings.fr.resources
Ok, my file HelloWorld.strings.fr.resources is successfully created.
Now, I compile the .resources file to .dll :
al.exe /t:lib /embed:HellowWorld.strings.fr.resources /culture:fr /out:HelloWorld.resources.dll
Ok, my file HelloWorld.resources.dll is successfully created.
Now, in my second project, WP7 HelloWorld, i do right click on "references" and add my .dll.
Thenk in main page I call resources manager like this :
System.Resources.ResourceManager rm = new System.Resources.ResourceManager("HelloWorld.resources", System.Reflection.Assembly.GetExecutingAssembly());
And try to load a string from dll :
PageTitle.Text = rm.GetString("mystring");
But at runtime I get exception : MissingManifestResourceException
Can you help to solve it ?
I've been told in the App Hub forum that you can't do DLLs with WP7. http://forums.create.msdn.com/forums/p/87635/525973.aspx#525973 This blows what I want to do out of the water because I have a big library of C code that I don't want to rewrite in C#. I have a ton of tables representing graphs and C# lacks decent a struct facility which C/C++ had implemented very well. That's progress?
It's bad enough that C# (which does have some interesting things) fails again to even implement a struct facility, a rudimentary macro facility and competent conditional compile facility, and now this. Can't reuse C code? I'm thinking of punting WP7 and going to Android and iPhone for my app. Grrrrrrrrrrrrrrrrrr.
精彩评论