NuGet issues when installing same package to multiple F# projects in solution - visual-studio-2013

Here's the solution layout:
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 the sake of an argument, let's say I want to install TopShelf from NuGet to both of those services. The error happens no matter the library, someone else had very similar issue not that long ago, but it seems I can actually reliably reproduce it.
NuGet Package Manager version: 2.8.60318.734
After opening 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 let's try the same thing with the other 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
Ooops...
I encountered it (again) when
Trying to install XUnit/NUnit to multiple F# test projects in a solution.
Most recently, when trying to install Akka.FSharp to multiple F# projects in a solution.
Any ideas how to fix it...?
It only happened to me with multiple F# projects - never had any issues with C# projects.
My bandaid solution is to copy & paste references from one .fsproj file to another. Update-Package even seems to be working after that operation.
That doesn't change the fact that it's a hack and not how solution management is supposed to work, especially when reinstall is needed - then you have to copy & paste all <Reference> elements from one .fsproj (the one that actually gets everything installed) to every other all over again, because NuGet package installation dies on subsequent projects...
Edit
It seems that brute force might work here - after c.a 4 tries, the package got installed to the second service application (?!).
That makes no sense...
I just hope I won't have to do that on CI server.

It's kind of a half-answer, but here it goes.
As I noted in the edit, brute-forcing seems to work. If it doesn't work the first time, just spamming Install-Package makes it work on the second (or third, or fourth...) try.
Weird...

Related

VS 2013 error: Could not load file or assembly 'Microsoft.PowerShell.Security' or one of its dependencies

I'm getting this error in Nuget Package Manager Console window, please see image attached. I think because of this I can not install an older version of package I need (Umbraco CMS) - during installation similar strange error arises with a bit different messages. I've checked this on different computer - without this error older package is being installed properly.
Tried re-installing Visual Studio 2 times - no effect. I could not achieved clean re-install, new VS instance inherits many plugins and features from previous instance.
Please somebody help me with this issue. Thanks in advance!

Failed to add reference to WikiNetParser. Please make sure that it is in the Global Assembly Cache

I am trying to add a reference to a project in Visual Studio 2012, by using 'Manage Nuget References'. The package is 'Wiki .NET Parser' (version 2.5.2.0).
When I try to add it, I get the below:
Successfully installed 'WikiNetParser 2.5.2.0'.
Successfully uninstalled 'WikiNetParser 2.5.2.0'.
Install failed. Rolling back...
Failed to add reference to 'WikiNetParser'. Please make sure that it is in the Global Assembly Cache.
I have also tried to create a clean, blank console project - But I still get the same problem. Any ideas?
A search on Google returned nothing specific to this component
The package appears to have a malformed manifest. I've reported this issue to the author of the package.
Specifically: The Manifest contains this node:
<frameworkAssemblies>
<frameworkAssembly assemblyName="WikiNetParser" targetFramework=".NETFramework4.0" />
</frameworkAssemblies>
Which tells NuGet to look for the "WikiNetParser" in the Core .Net 4.0 libraries, which of course does not exist. The node can simply be removed and the package should install successfully. If you want to try cracking the package open yourself, you can try using NuGet Package Explorer.

Nuget "already has a reference to"

Tests.Functional is selected from the Default project: drop down.
PM> install-package nunit
'NUnit 2.6.0.12054' already installed.
Tests.Functional already has a reference to 'NUnit 2.6.0.12054'.
Yet Nunit does not show up in References for Tests.Functional in the Solution Explorer. Tried reloading VS.Net (2010) and updating Nuget.
Am I missing something?
When running the solution under TFS, make sure the $(SolutionDir)\Packages\repositories.config file is checked out for edit.
Try the following:
Uninstall-Package NUnit -Force
Verify the Tests.Functional.csproj file (using notepad) no longer has any Reference to NUnit (if it still does, manually delete them, the project file probably got corrupted somehow).
Then run the following commandl:
Install-Package NUnit
I ran in to a similar issue trying to download the xunit framework when looking at the Entity Framework code. I worked around this by selecting a project to install to xunit to that didn't have the reference already, then just went in to manage and removed the reference to the project that didn't actually need it.
It appears that when a project references an assembly it doesn't have, nuget will see the reference and think that it doesn't need the assembly, even though it does. Simply adding the assembly to another project through nuget solves the issue. Not the most elegant solution, but it works.
Try the following in the Package Manager Console:
Uninstall-Package NUnit -Force
Then, go into your project directory and and manually remove NUnit references from your packages.config & .csproject files if any.
Now you can simply Install using:
Install-Package NUnit

Error in downloading WebActivator with NuGet

I just updated my NuGet Package Manager on my corporate machine. Ever since the update, I am unable to add any package. I tried to install WebActivator for instance and got the following error:
PM> Install-Package WebActivator
Install-Package : The ServicePointManager does not support proxies with the https scheme.
At line:1 char:16
+ Install-Package <<<< WebActivator
+ CategoryInfo : NotSpecified: (:) [Install-Package], NotSupportedException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
How can I go about this?
The following work around helped me. Note that I am using Windows 7, Visual Studio 2010 Professional, IE 9 and am behind a corporate proxy. Your steps might vary depending on your environment:
Go to C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
Open the devenv.exe.config for editing.
In the System.Net node add the code given below.
Close Visual Studio and reopen it.
Check if the RSS feeds are displaying. If yes, everything else including Nuget should also work.
If RSS feeds section is prompting for password, then provide it and save it.
If things don't work still, run fiddler and go through steps 4 to 6 again. (Just running Fiddler in background also helps in some cases. See link below.)
Code to put in devenv.exe.config:
<defaultProxy useDefaultCredentials="true" enabled="true">
<proxy proxyaddress="http://ProxyServer:8080"/>
</defaultProxy>
This is really a hack based upon the following two discussions, but it works.
Cannot connect to any online resource
http://nuget.codeplex.com/discussions/242477
Hope this helps others who have similar issues. But I really wish there is a better way around. Hardcoding the proxy server and port doesn't seem to be a very maintainable solution. Also, there should be an alternative way of using NuGet packages like WebActivator and Nuget.MVC3.
As a backup if your proxy is HTTPS only, you can follow the package download instructions from:
Nuget packages without nuget package manager? and then the installation instructions from:
How to install a Nuget Package .nupkg file locally?.
I'm not behind a corporate proxy, so the error message made absolutely no sense to me. What helped, though, was to replace the default NuGet package source. I did this by:
Going into NuGet settings and adding a new package source pointing to http://nuget.org/api/v2/ (no s in the scheme)
Disabled the default source
Enabled my newly added source
Now, I don't get the error message anymore. Et voilĂ !

The package source named 'NuGet' is either invalid or not available

I have installed Nuget 1.2 yesterday, and today, while I was trying to install Entity Framework package, I have encountered the following problem in the Package Manager Console:
PM> install-package entityframework
Install-Package : The package source named 'NuGet official package source [https://go.microsoft.com/fwlink/?LinkID=206669]' is either
invalid or not available and thus is currently unreachable.
At line:1 char:16
+ install-package <<<< entityframework
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I can surft the internet and I don't think anything is preventing Visual Studio to access the internet.
Actually, there was something that was preventing Visual Studio from accessing the internet. Seems like VS had some problems with my proxy server.
So I used a solution that has been introduced in here and everything works fine now.
Same issue happened to my setup. However, i found that VS 2010 uses proxy settings from Internet Explorer. I have removed proxy settings from IE and it was successfully connecting.
To correct this problem permanently, a fix from Microsoft must be used
This is the name of the file KB2581019(VS10SP1-KB2581019-x86.exe)
While this link is active you can download path correction for it.
http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=38654
It's solved!

Resources