gsharp
gsharp

Reputation: 27927

Installing SignalR from NuGet (problems with Newtonsoft.Json)

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 ?

Upvotes: 2

Views: 418

Answers (2)

gsharp
gsharp

Reputation: 27927

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.

Upvotes: 0

Sirwan Afifi
Sirwan Afifi

Reputation: 10824

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.

Upvotes: 1

Related Questions