Friday, January 25, 2013 7:27 AM
Hello , Is it possible to refer regular NET dll to Windows Metro App or Windows Phone 8? I tried creating a Simple dll (basically doing I/O task) and tried to refer from Windows 8 and Windows Phone 8 project. Both are throwing error saying "Unable to add as reference..".
Why Microsoft restricted like that? It seems I need to use Portable libraries and move all my existing code from regular NET dll to PCL.
Are there any links which explains what Microsoft restrict like that?
Friday, January 25, 2013 7:51 AMModerator
See .NET for Windows Store apps for a discussion of which .Net classes can be used in a Windows Store app.
You are correct that you cannot use a generic .Net dll. You must use either a specifically .Net for Windows Store apps DLL or a Portable Class Library. If you want to share a binary between your Windows Store app and your Windows Phone 8 app then the Portable Class Library is the way to do so. If you want to share code files you can link them. See Maximize code reuse between Windows Phone 8 and Windows 8 for more details.
Friday, January 25, 2013 8:09 AM
Thanks Rob. Your links tells me techniques or steps suggested to reuse code.
I need some link which explains reasons that I cant refer generic dll in Metro App or Windows Phone 8.
If possible can you point me to that?
- Edited by Vamsidhar M Friday, January 25, 2013 8:10 AM Typo
Friday, January 25, 2013 11:02 PMModerator
As described in .NET for Windows Store apps and in the linked .NET for Windows Store apps overview, Windows Store apps use a subset of the .Net Framework. They cannot load a DLL which uses a different version. Portable Class Libraries are provided to bridge this gap and allow a DLL which targets the intersection of two profiles to be used in either of those versions of the framework.
You can find more information about the .Net for Windows Store apps profile and how it was designed in the //build/ 2011 talk A .NET developer's view of Windows 8 app development . Some of the details have changed between when the talk was given and release, but the general concepts and discussion of design decisions are still valid.