How do I NuGet Ninject.Web.Common? - nuget

All the examples seem to want the Ninject.Web.Common file reference. I can NuGet Ninect and Ninject.Web.Mvc but I can't seem to get the .Common assembly. It never comes up in the search results (I only have the default package source installed). Is there some other package source I can try so I can get this reference and build the sample applications?

It can be installed from the official feed in the NuGet console with this command:
Install-Package Ninject.Web.Common -Pre
Ninject.Web.Common is currently in a prerelease state, it won't be listed in NuGet by default. (NuGet 1.7 will have an option to show the prerelease packages in the UI)
Package page in the official gallery :
http://nuget.org/packages/Ninject.Web.Common

Related

How do I update all package references in a C# solution to most recent Nuget version

I have a Visual Studio, C# solution with several projects. Some of those point to older versions of some packages. my local nuget repo has more current, stable versions. e.g.
What I want to do is update all those old 3.0.246-alpha references to the latest stable version, 3.1.0
What is the best way to do that?
Output window after clicking Install:
errors at top of screen:
This is what I want to fix. There is no version 3.0.246 of that module, so I want Nuget to overide it with latest stable version, 3.1
Due to the limitation, I post this as an answer, but may include some comments.(Sorry for that)
As I searched online(nuget.org), I found no packages called TBSM.*, perhaps they were created by yourself/your company… and just used(saved) locally?
From the error message, it reported that the NuGet package was not found on source XXXXX, so did you perform some operations to remove the old version of the NuGet packages? (Maybe also removed the NuGet cache files?)
I did some tests:
Since I don’t know the specific structures of your projects/NuGet Package, I just created two NuGet packages for test locally with same names(ID) and different versions, and then added the package source path to the settings, and installed the first NuGet package into one project, after that deleted this NuGet package and the cache files. Then tried to Update it, NuGet Package manager could still update it to the latest version successfully, even if I uncheck these options: Allow NuGet to download missing packages and Automatically check for missing packages during build in Visual Studio from VS > Tools > Options > NuGet Package Manager > General.
Of course, I may not remove all of the NuGet packages’ cache files, or the issue is cause by the specific NuGet packages’ structures(cause I used two NuGet packages, but yours maybe used the same one with something updated)…
What I suggest:
1). If it is possible, you can have a try Uninstall and then Install the relates version.(remember to make a backup before this)
2). Try to select this two options in VS(Tools > Options > NuGet Package Manager > General), “Allow NuGet to download missing packages” and “Automatically check for missing packages during build in Visual Studio”, and then click Clear All NuGet Cache(s) button. Make sure you have added the right path source from VS > Tools > Options > NuGet Package Manager > Package Sources and try to install/update the NuGet packages again.(Generally, clear cache will not cause errors, but please remember to make a backup before clearing cache)

Nuget install failed: the package does not contain any assembly references or content files that are compatible with that framework

If I understand Scott Hanselman's post here correctly then I should be able to reference a .net standard library from a framework 4.7.2 solution.
I want to use Nuget to install such a reference.
I am using Azure DevOps Artifacts for the Nuget package. When I push my .net standard solution I can see that the package does create and that the Nuget install command is
Install-Package SBD.Standard -version 2.0.0-CI-etc
However when I try this at the PM console for my framework 4.7.2 project I get
Could not install package 'SBD.Standard 2.0.0-etc'. You are trying to install this package into a project that targets
'.NETFramework,Version=v4.7.2', but the package does not contain any assembly references or content files that are compatible with that
framework
moreover I do not see SBD.Standard as an avialable package in the relevant feed from within VS2019 -> Manage nuget packages for solution.
I think I need packages.config
I was able to create a new 4.7.2 project and add the nuget package that used .net standard 2.0 (but not 2.1)
When I tried to add the nuget package I got a dialog asking me to select the Nuget package manager format
so I chose Packages.config and that worked.
I am not sure I have it right. I solved my problem but am not sure whether this was it after all. SInce PackageReference is more recent it should work.
Some additional explanations for this issue.
There is an issue for NuGet restore when you using new SDK-based project type or PackageReference in the .net framework:
https://github.com/NuGet/Home/issues/5461
https://github.com/dotnet/sdk/issues/1755
When we use packages.config projects or non-SDK based project type, NuGet do not check compatibility during install/restore.
So, to resolve this issue, we need make sure the referenced project is an old style csproj or use packages.config.
That the reason why the packages.config works for you.
Hope this helps.

Why can't I download TagHelpers (nuget & ASP.NET 5)?

I can't get the TagHelpers package via the project.json nor through nuget.
I've tried >Install-Package Microsoft.AspNet.Mvc.TagHelpers -Pre in the package manager console.
I can't even find it in the Nuget Package Manager search.
I'm using the latest Visual Studio 2015 CTP 6 with everything up to date. I started using the ASP.NET 5 web project.
How can I get the TagHelpers package?
Don't use the NuGet console. It will not work.
Use kpm:
kpm add Microsoft.AspNet.Mvc.TagHelpers
kpm restore
Also, check the NuGet package sources in the VS options. Make sure nuget.org is enabled.
You can use nuget just fine. The problem is the CTP6 includes a nuget v3 api reference, which is active by default, but that doesn't work with nuget properly.
To fix this:
Go into Tools -> NuGet Package manager -> Package Manager Settings.
On the left click Package Sources.
On the right you should see 'nuget.org' and 'api.nuget.org'. The api one will probably be checked, while the nuget.org one will not.
Ensure 'nuget.org' is checked, and the other is not.
Click the nuget.org entry and ensure the 'source' textbox has a v2 instead of v3 in the url.
Done.

nuget error installing protobuf-net on portable library

I'm trying to install protobuf-net (2.0.0.602) in a portable class library, I just can't seem to get this to work. I get this error:
PM> install-package protobuf-net
'protobuf-net 2.0.0.602' already installed.
install-package : Could not install package 'protobuf-net 2.0.0.602'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.0,Profile=Profile4', but
the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Inspecting the package it appears to target portable-sl4+wp71+windows8, however when i create a vinalla project targeting these frameworks I can't get it to work (profile4 is listed above, but I've tried a few different ones to see what sticks). I've just updated nuget in studio. Running 'nuget' from the package manager console shows the nuget version as 2.1.31022.9038.
If I browse to the protobuf-net.dll within the package (under lib\portable-sl4+wp71+windows8) it will allow me to reference it and all is good.
I can just manually add it, but am I missing something obvious.
Any help appreciated.
This appears to be just a slight tweak needed to the nuget config; I had specified portable-sl4+wp71+windows8, when actually I needed to specify portable-sl4+net4+wp7+windows8, to include regular .NET.
This is fixed in 2.0.0.611, which has been pushed to NuGet.

Download Nuget Packages Without VS/NuGet Package Manager

How can I download NuGet Packages outside of visual studio? so it can be used to create offline packages.
How to download NuGet Package without Visual Studio or Nuget Package Manager:
Search your desired package at NuGet Official Site.
Copy the end of the URL of the package page.
For Example: http://nuget.org/packages/EntityFramework => Package Name is "EntityFramework"
Enter the URL: http://packages.nuget.org/api/v1/package/{Package Name}
For Example: http://packages.nuget.org/api/v1/package/EntityFramework
You can download NuGet packages outside of Visual Studio using:
NuGet Package Explorer
NuGet Package Explorer is a ClickOnce application which allows
creating and exploring NuGet packages easily. After installing it, you
can double click on a .nupkg file to view the package content. You can
also load packages directly from the official NuGet feed.
Open a package from online feed:
And export the package to the desired location:
Install the NuGet command line program:
The NuGet command line may be installed onto a machine in a few possible ways.
Direct download of the executable from https://dist.nuget.org/win-x86-commandline/latest/nuget.exe. The executable may be placed anywhere on the file system, and in most cases should be placed in a directory that is listed in the PATH environment variable.
Install the NuGet.CommandLine package from the NuGet Visual Studio client and either move nuget.exe to a common location or execute it in the context of your project.
Install the NuGet.CommandLine Chocolatey package using the Chocolatey client. More information on Chocolatey can be found at [http://chocolatey.org].
Then run nuget install package to download and install package in the current directory.
More about the NuGet command line program:
Command Line Reference
Chrome Plugin "NuTake" provides a direct download link.
Rename extension to .zip and extract
You can download nuget packages using - vnuget.org.
On this website you can also view content of nuget package - http://vnuget.org/packages/Microsoft.AspNet.Mvc/5.2.3.
Here are a few examples that can add to DeePak's answer:
This one downloads AutoMapper from NuGet.org
nuget.exe install AutoMapper -OutputDirectory c:\Temp\LotsOfPackages -Version 6.2.2
This one downloads MyCustomPackage from an internal TFS Nuget feed
nuget.exe install MyCustomPackage -OutputDirectory c:\Temp\LotsOfPackages -Source "http://tfs.myCompany.com:8080/tfs/TFSArea/_packaging/FeedName/nuget/v3/index.json" -Version 1.0.0.2
Notes
Keep in mind that the install command will get the package in question AND all its NuGet dependencies. So, be careful about just dumping this into the directory where you running. Thus, I added OutputDirectory to the command.
For internal Nuget packages/feeds, the Source URL is available via TFS. Go to your packages tab and find your specific feed URL. If it has any spaces that have been encoded with %20, you need to replace them with spaces.
CLI command reference
Copy packages from one NuGet feed to another