NuGet issues when installing same package to multiple F # projects in solution

Here's a mock solution:

  • FSharpNuGetTest (sln)
    • FirstService (F # 3.1 Console Project, .NET 4.5 / 4.5.2)
    • SecondService (F # 3.1 Console Project, .NET 4.5 / 4.5.2)

For an argument, let's say I want to install TopShelf from NuGet to both of these services. The error happens regardless of the library, someone else had a very similar problem not too long ago , but it looks like I can actually reliably reproduce it.

NuGet Package Manager Version: 2.8.60318.734

After opening the NuGet Package Manager Console in VS2013.4 Community Edition:

PM> Install-Package Topshelf -ProjectName FirstService
Installing 'Topshelf 3.1.4'.
(... snip - license stuff ...)
Successfully installed 'Topshelf 3.1.4'.
Adding 'Topshelf 3.1.4' to FirstService.
Successfully added 'Topshelf 3.1.4' to FirstService.

      

Perfect. Now try the same thing with a different service:

PM> Install-Package Topshelf -ProjectName SecondService
'Topshelf 3.1.4' already installed.
Adding 'Topshelf 3.1.4' to SecondService.
No exact match found for removing reference 'Topshelf'. Trying case-insensitive search...
Failed to find match for removing reference 'Topshelf'.
Install-Package : Failed to add reference to 'Topshelf'.
At line:1 char:16
+ Install-Package <<<<  Topshelf
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

      

Oops ...

I ran into him (again) when

  • Trying to install XUnit / NUnit in multiple F # test projects in solution.
  • More recently when trying to install Akka.FSharp on multiple F # projects in a solution.

Any ideas how to fix this ...?

This only happened to me with a few F # projects - never had a problem with C # projects.

My solution for bandages is to copy and paste links from one file .fsproj

to another. Update-Package

even seems to work after this operation. This doesn't change the fact that this is a hack and not how solution management is supposed to work, especially when reinstalling - then you have to copy and paste all the items <Reference>

from one .fsproj

(the one that actually gets everything installed) for everyone else, because the installation NuGet package dies in subsequent projects ...

Edit

It seems like brute force might be at work here - after ca 4 tries, the package was installed into the second service application (?!). This makes no sense...

I just hope I don't have to do this in a CI server.

+3


source to share


1 answer


It's a half-answer, but here it comes.

As I mentioned in the editorial office, working with coarse forcing works. If it doesn't work the first time, it's just spam Install-Package

making it work on the second (or third or fourth ...) try.



Weird ...

+1


source







All Articles