How to build library against multiple target platforms

173 views Asked by At

I'm asking this question due to Silverlight and NUnit, that if you've tried, know they do not play well together. Basic reason being SL code is compiled against the SL framework, and NUnit is compiled against the standard .NET framework.

Anyway, I've got a bunch of classes that are not specific to SL but do reside on the client side. I was thinking about moving them into their own library. Is it possible to configure Visual Studio and/or solution to compile this library both as an SL library AND a .NET library?

My SL client app would reference the SL-version of the library, NUnit would reference the .NET-version.

I'm suspecting at best, this would have to somehow be arranged through the makefile, and the NUnit test project could not reference the project directly, but rather the .dll created.

And other issues like that.

Just wondering what peoples thoughts are on this idea.

2

There are 2 answers

1
Nair On

Like you were planning to do, you could create SL Class libaray and .Net Class library and have the code in one project and do file link in the other project. This way you do not need to keep two copies of the files. So you can point to the .net class library for the NUnit tests. Just a thought.

1
Silver Solver On

Sounds like a job for Portable Class Libraries VS 2012 has built in support and there is an add-on for 2010.