2

I'm trying to install SignalR through NuGet. When it comes to install Json it says that the installation is failed because of a PowerShell policy. I've found this post to explain what to do in such case.

Unfortunately changing the setting is blocked by our company policy and I'm not able to change that value.

What I did as next step is to manually download Json.NET and reference in my project manually. I was hoping that NuGet will find the reference and ignore the installation. But that didn't work as well.

Finally coming to my question: Is there a way to "tell" NuGet to ignore the Json.NET Dependency while installing SignalR ?

Community
  • 1
  • 1
gsharp
  • 27,557
  • 22
  • 88
  • 134

2 Answers2

1

The Install-Package command has a flag to ignore the dependencies:

Install-Package Microsoft.AspNet.SignalR -IgnoreDependencies

Install-Package [-Id] [-IgnoreDependencies] [-ProjectName ] [-Version ] [-Source ] [-IncludePrerelease] [-Force] [-FileConflictAction] [-DependencyVersion ] [-WhatIf]

-IgnoreDependencies
        Installs only this package and not its dependencies.

        Required: false

more info.

Sirwan Afifi
  • 10,654
  • 14
  • 63
  • 110
  • Hi Sirwan, yes that would work, but then I'm in a Dependency nightmare since the whole SignalR dependency tree consists of quiet a lot packages. Any other possiblity? – gsharp Jul 22 '15 at 08:19
  • Hi, First of all I suggest you to install `Microsoft.AspNet.SignalR.Core` package because it has dependency to JSON.NET, then Install `Microsoft.AspNet.SignalR` – Sirwan Afifi Jul 22 '15 at 08:22
0

I was about to try what Sirwan suggested until I realized that because of the Execution Policy of PS, I wasn't even able anymore to run any commands in the Package Manager Console.

The Solution:

You can actually change the MachinePolcy Execution Policy without going through GPO! You need to go in the registry and edit the following key HKLM:\Software\Policies\Microsoft\Windows\PowerShell and change the ExecutionPolicy value to ByPass

Solution found here

That acutally also solves the other problem that I had by installing Json.NET.

gsharp
  • 27,557
  • 22
  • 88
  • 134