Silverlight 4 Assembly Sharing Problem

跟風遠走 提交于 2019-12-04 12:56:46

this

does anyone know of a way to reference a SL4 assembly with System.Windows references from a full .NET assembly (without just linking the files and creating two different projects to maintain)?

is not possible at the moment. Referencing SL assemblies in .NET projects will only work if the SL project does not reference any assemblies other than mscorlib, System, System.Core, System.ComponentModel.Composition and Microsoft.VisualBasic. Adding a WPF project and linking your SL files into that project is the only way you can reuse your SL code if it uses e.g. System.Windows.

Cheers, Alex

I'm maybe late, but this has not been answered yet.

There is a plugin to VisualStudio 2010, which allows you create assemblies, which can be referenced in .NET, Silverlight, Windows Phone and XNA on xbox. It's called PortableLibrary.

http://blogs.msdn.com/b/bclteam/archive/2011/01/19/announcing-portable-library-tools-ctp-justin-van-patten.aspx

Found it! I had some xmlns namespaces defined in my SL4 class library like:

using System.Windows.Markup;

[assembly: XmlnsDefinition("http://MyProj/Presentation", "MyProj.Presentation")]
[assembly: XmlnsDefinition("http://MyProj/Presentation", "MyProj.Presentation.Controls")]

and that prevented the WPF assembly from referencing it, producing the aforementioned error. Just moved the namespace declarations into the WPF project to fix...

[Edit]

Ok, so this fixed the problem...but does anyone know of a way to reference a SL4 assembly with System.Windows references from a full .NET assembly (without just linking the files and creating two different projects to maintain)?

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