Reputation: 1321
I have a dll with core functionality which I wan't to use at ASP.MVC application and Metro app. So I made Portable Library compatible with .NET 4.0 and .NET for Widows store app from my dll. As expected build was failed. The main reasons was:
I know that all UI classes won't be compiled, also.
So my question is What namespaces and classes do I have to avoid if I what to share my library between .net 4.0 and WinRT?
UPDATE Here is full list of changes in classes and namespaces http://msdn.microsoft.com/en-us/library/windows/apps/br230302%28v=vs.110%29.aspx#convert
Upvotes: 1
Views: 372
Reputation: 17855
If you're writing new code that you want to reuse in .NET framework and Windows Store apps, it's best that you immediately start writing your code as a portable class library with these two target platforms selected. This way you'll only have available the classes and methods that work on both platforms (Intellisense works as expected as well).
You can find an overview of the available APIs for each of the supported platforms here.
For the APIs that are not supported through portable class libraries because they are conceptually different but are still available in a way (file IO is a good example) you can use the abstraction/indirection pattern to implement them differently for each of the platforms. Here's a good explanation of this approach.
Upvotes: 2