Build a .NET dll to WP7

2019-02-13 18:24发布

How can I port a C# dll to WP7?

I have the .dll source code successfully building on desktop but when I try to reference the dll on a WP7 project I get the following error:

Reference cannot be added to c:\path\to\my.dll because it was not built using the Windows Phone runtime. Windows Phone projects will work only with Windows Phone assemblies.

Is there an easy way to build it using Windows Phone runtime?

2条回答
手持菜刀,她持情操
2楼-- · 2019-02-13 18:58

You might also want to take a look at the Portable Class Libraries stuff from Microsoft - http://msdn.microsoft.com/en-us/library/gg597391.aspx - which allows you to compile a DLL up to work for WP7, Silverlight, .Net Framework or XBOX360

I have used it for a .Net WCF service and WP7 projects to share a common DLL.

There are a few things to look out for, in that there are some unsupported assemblies, but in the whole it covers most of what is needed.

查看更多
ゆ 、 Hurt°
3楼-- · 2019-02-13 19:05

Create a Windows Phone Library project, copy source codes to it and resolve all errors that appears. And than you can reference this dll from Windows Phone project

查看更多
登录 后发表回答