3
votes

I am using the "Create New NuGet Package from project after Each Build" NuGet package by Daniel Schroeder to automatically create NuGet packages from my projects via Visual Studio 2013. I am running into a problem when group dependencies are specified in the .nuspec file. This is what I have in my .nuspec file :

<dependencies>
   <group targetFramework=".NETFramework3.5">
        <dependency id="BitMiracle.LibTiff.NET" version="2.4.500.0" />
   </group>
   <group targetFramework=".NETFramework3.5">
       <dependency id="FAImage.Net35" version="1.0.0" />
   </group>
   <group targetFramework="Silverlight5.0">
      <dependency id="FAImage.SL50" version="1.0.0" />
  </group>
</dependencies>

The dependencies are being included in the package, but they are not tied to the specific platform specified in the tag of the .nuspec file. They are all being included as 'not framework specific'. When the same package is created via the NuGet Package Explorer, the dependencies are being sourced in correctly. Any help will be appreciated.

2

2 Answers

2
votes

I am new to nuget, but have you tried:

<group targetFramework="net35">
   <dependency id="BitMiracle.LibTiff.NET" version="2.4.500.0" />
   <dependency id="FAImage.Net35" version="1.0.0" />
</group>
<group targetFramework="sl5">
    <dependency id="FAImage.SL50" version="1.0.0" />
</group>
2
votes

Your nuspec file is missing the <frameworkAssemblies> tag for each of the frameworks you want to target. As @Patrick points out, you also need to use the framework aliases.

    <package>
        <metadata>
            <!-- snip other data -->
            <dependencies>
                <group targetFramework="net35">
                    <dependency id="BitMiracle.LibTiff.NET" version="2.4.500.0" />
                    <dependency id="FAImage.Net35" version="1.0.0" />
                </group>
                <group targetFramework="sl5">
                    <dependency id="FAImage.SL50" version="1.0.0" />
                </group>
            </dependencies>
            <frameworkAssemblies>
                <frameworkAssembly assemblyName="System.Core" targetFramework="net35" />
                <frameworkAssembly assemblyName="System.Core" targetFramework="sl5" />
            </frameworkAssemblies>
        </metadata>
    </package>