16
I am building a NuGet package that references the Microsoft CommonServiceLocator assembly.
There are two versions of the Microsoft CommonServiceLocator out there:
- CommonServiceLocator - targets the full .NET framework and is referenced by the Microsoft EnterpriseLibrary components.
- Portable.CommonServiceLocator - contains both the full version of CommonServiceLocator and the recently released Portable Class Library version.
My project is a Portable Class Library but, because it's sometimes used with Enterprise Library, I need to sort of "conditionally" reference the portable version so there's no conflict.
- If the target framework is full .NET 4.0/4.5, use the original CommonServiceLocator package so people can also use the Enterprise Library bits (which also reference the CommonServiceLocator package).
- If the target framework is portable (or anything else) use the Portable.CommonServiceLocator package.
I see the new "group" feature in the NuGet docs showing how to specify dependencies in your .nuspec file and I think that will do what I want, but I'm not sure how to test it.
Here's what I think I need to do and I'm hoping someone can validate my approach or point me in the right direction:
<dependencies>
<group>
<!-- Always include regardless of target framework -->
<dependency id="Autofac" />
</group>
<group targetFramework="net40">
<!-- Also include the full CSL if it's full fr