Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I recently wrote a blog post about this issue and how to reproduce it.</p> <p><a href="http://mikehadlow.blogspot.co.uk/2013/06/nuget-install-is-broken-with-f.html" rel="nofollow">http://mikehadlow.blogspot.co.uk/2013/06/nuget-install-is-broken-with-f.html</a></p> <p>I've copied in the start of it below as requested:</p> <p>There’s a very nasty bug when you try and use NuGet to add a package reference to an F# project. It manifests itself when either the assembly that is being installed also has a version in the GAC or a different version already exists in the output directory.</p> <p>First let’s reproduce the problem when a version of the assembly already exists in the GAC.</p> <p>Create a new solution with an F# project.</p> <p>Choose an assembly that you want to install from NuGet that also exists in the GAC on your machine. For ironic purposes I’m going to choose NuGet.Core for this example.</p> <p>It’s in my GAC:</p> <pre><code>D:\&gt;gacutil -l | find "NuGet.Core" NuGet.Core, Version=1.0.11220.104, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL NuGet.Core, Version=1.6.30117.9648, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL </code></pre> <p>You can see that the highest version in the GAC is version 1.6.30117.9648</p> <p>Now let’s install NuGet.Core version 2.5.0 from the official NuGet source:</p> <pre><code>PM&gt; Install-Package NuGet.Core -Version 2.5.0 Installing 'Nuget.Core 2.5.0'. Successfully installed 'Nuget.Core 2.5.0'. Adding 'Nuget.Core 2.5.0' to Mike.NuGetExperiments.FsProject. Successfully added 'Nuget.Core 2.5.0' to Mike.NuGetExperiments.FsProject. </code></pre> <p>It correctly creates a packages directory, downloads the NuGet.Core package and creates a packages.config file:</p> <pre><code>D:\Source\Mike.NuGetExperiments\src&gt;tree /F D:. │ Mike.NuGetExperiments.sln │ ├───Mike.NuGetExperiments.FsProject │ │ Mike.NuGetExperiments.FsProject.fsproj │ │ packages.config │ │ Spike.fs │ │ │ ├───bin │ │ └───Debug │ │ │ └───obj │ └───Debug │ └───packages │ repositories.config │ └───Nuget.Core.2.5.0 │ Nuget.Core.2.5.0.nupkg │ Nuget.Core.2.5.0.nuspec │ └───lib └───net40-Client NuGet.Core.dll </code></pre> <p>But when when I look at my fsproj file I see that it has incorrectly referenced the NuGet.Core version (1.6.30117.9648) from the GAC and there is no hint path pointing to the downloaded package.</p> <pre><code>&lt;Reference Include="NuGet.Core, Version=1.6.30117.9648, Culture=neutral, PublicKeyToken=31bf3856ad364e35"&gt; &lt;Private&gt;True&lt;/Private&gt; &lt;/Reference&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload