I have created a library that I need to be able to use in a Portable Class Library as well as a regular .NET application. The way I accomplished this is by creating multiple solutions / projects that point to the same files:
Src/
Dismissile.sln
Dismissile.Portable.sln
Dismissile/
Dismissile.csproj
Dismissile.Portable.csproj
Class1.cs
Dismissile.sln includes Dismissile.csproj and targets .NET Framework 4.5.2 Dismissile.Portable.sln includes Dismissile.Portable.csproj and is a portable class library project that targets .NET Framework 4.5, Xamarin.Android and Xamarin.iOS.
Each project includes Class1.cs. I have created some conditional compilation symbols in each project such as PORTABLE and NET452.
This seems to work so fine but now I need to add a NuGet package for JSON.NET into my projects.
If I add a NuGet package in my Portable project it will create the following in my packages.config:
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="portable40-net40+sl5+win8+wp8+wpa81" />
However, if I add it in my other project it will create the following in packages.config:
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net40" />
Is there any way to have a separate packages.config so each project includes the correct reference to my NuGet dependencies?