Website not able to find assemblies for silverlight library

大憨熊 提交于 2019-12-10 22:43:50

问题


I have a web site type project in visual studio and I have included a reference to my silverlight 5 library project. In the SL5 project, I am including the System.Runtime.Serialization assembly. When I try to access one of the pages of my web site that uses the SL5 library, I am getting the following error:

Could not load file or assembly 'System.Runtime.Serialization, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.

I have installed the SL5 SDK on the box I am publishing the website on, but it seems it is unable to find that assembly. Any ideas on what is going on? I have already restarted IIS.


回答1:


You can not use SL5 class library in asp web site project, because they have different runtime. Sometimes it works, when library is simple, but in your case library has dependency on System.Runtime.Serialization.

If you need share your code between SL and ASP projects, you can create simple .Net class library (not SL5) and add all you files from SL5 library as link to .Net library (Add/ Existing item... / Add as Link). Add reference to new library for your asp web project and remove old (SL5) library.

It's one way to share code between different libraries types. Probably you can not build new library if you have SL specific dependency in your code. I hope my idea will help you.



来源:https://stackoverflow.com/questions/10088906/website-not-able-to-find-assemblies-for-silverlight-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!