Missing reference on successful NuGet package installation - c#

I am following this guide to setup my own NuGet private server, but using Visual Studio 2010.
I have successfully added the NuGet.Server package through Package Manager Console, but when I want to build the WebApplication I got errors:
The type or namespace name 'Server' does not exist in the namespace 'NuGet' (are you missing an assembly reference?)
There is no error in the package installation, but I see that NuGet.Server is not added in the reference folder of the project, Why is that happen?
Edit : Further investigating on the package contents, I see that NuGet.Server does not have the lib for net40. I might need to fork NuGet.Server source and compile it in net40 to fix this.
Here is my logs from Package Manager Console:
PM> Install-package nuget.server
Attempting to resolve dependency 'NuGet.Core (≥ 2.10.1)'.
Attempting to resolve dependency 'Microsoft.Web.Xdt (≥ 2.1.0)'.
Attempting to resolve dependency 'Newtonsoft.Json (≥ 8.0.1)'.
Attempting to resolve dependency 'RouteMagic (≥ 1.3.0)'.
Attempting to resolve dependency 'WebActivatorEx (≥ 2.1.0)'.
Attempting to resolve dependency 'Microsoft.Web.Infrastructure (≥ 1.0.0.0)'.
Installing 'Microsoft.Web.Xdt 2.1.1'.
You are downloading Microsoft.Web.Xdt from Microsoft Corporation, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=273778. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Microsoft.Web.Xdt 2.1.1'.
Installing 'NuGet.Core 2.10.1'.
Successfully installed 'NuGet.Core 2.10.1'.
Installing 'Newtonsoft.Json 8.0.1'.
Successfully installed 'Newtonsoft.Json 8.0.1'.
Installing 'RouteMagic 1.3'.
Successfully installed 'RouteMagic 1.3'.
Installing 'Microsoft.Web.Infrastructure 1.0.0.0'.
Successfully installed 'Microsoft.Web.Infrastructure 1.0.0.0'.
Installing 'WebActivatorEx 2.1.0'.
Successfully installed 'WebActivatorEx 2.1.0'.
Installing 'NuGet.Server 2.10.3'.
Successfully installed 'NuGet.Server 2.10.3'.
Adding 'Microsoft.Web.Xdt 2.1.1' to WebApplication2.
Successfully added 'Microsoft.Web.Xdt 2.1.1' to WebApplication2.
Adding 'NuGet.Core 2.10.1' to WebApplication2.
Successfully added 'NuGet.Core 2.10.1' to WebApplication2.
Adding 'Newtonsoft.Json 8.0.1' to WebApplication2.
Successfully added 'Newtonsoft.Json 8.0.1' to WebApplication2.
Adding 'RouteMagic 1.3' to WebApplication2.
Successfully added 'RouteMagic 1.3' to WebApplication2.
Adding 'Microsoft.Web.Infrastructure 1.0.0.0' to WebApplication2.
Successfully added 'Microsoft.Web.Infrastructure 1.0.0.0' to WebApplication2.
Adding 'WebActivatorEx 2.1.0' to WebApplication2.
Successfully added 'WebActivatorEx 2.1.0' to WebApplication2.
Adding 'NuGet.Server 2.10.3' to WebApplication2.
File Conflict
File 'Web.config' already exists in project 'WebApplication2'. Do you want to overwrite it?
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "N"):A
Overwrite existing file 'Web.config'.
Successfully added 'NuGet.Server 2.10.3' to WebApplication2.

I got the same error when trying to build it with Visual Studio 2015 in a project that had the target framework set to .NET Framework 4.0. Setting the target framework to .NET Framework 4.6.1 fixed it for me.
I would suggest using a newer version of Visual Studio if possible, or compiling it with the newer framework itself via the command line. This other stack overflow answer may be of assistance if you wish to do the later. How to build .NET 4.6 Framework app without Visual Studio installed?

An option for anyone who do not want to, or cannot target a different .NET Framework version, is to install a previous version of NuGet.Server. For example, version 2.10.3 targets .NET 4.5.

Related

Framework Compatibility Issue While Installing MaterialDesignThemes.Wpf from Nuget

I am trying to run this
project from github. But when it comes to installing to MaterialDesignThemes.Wpf for wpftoolkit. it fails due to compatibility issue.Here is the full error:
"Error Could not install package 'MaterialDesignColors 1.1.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', 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."
I tried with changing the project target framework but it did not work.
Could any body please help in resolving this issue?
Thanks

'System.Xaml' which was not found in the GAC

Trying to update Microsoft.Build.Framework using Nuget in my SLN and getting the below error. This is VS 2017 Enterprise Version 15.9.1
Projects all target NET461 in this sln.
I duplicated this problem on 2 different windows 10 machines with the same project.
What can I do to get these packages updated?
Output
Attempting to gather dependency information for package 'Microsoft.Build.Framework.15.8.166' with respect to project 'Synovia.Service', targeting '.NETFramework,Version=v4.7.2'
Gathering dependency information took 3.08 sec
Attempting to resolve dependencies for package 'Microsoft.Build.Framework.15.8.166' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Microsoft.Build.Framework.15.8.166'
Resolved actions to install package 'Microsoft.Build.Framework.15.8.166'
Found package 'Microsoft.Build.Framework 15.8.166' in 'D:\git\sbss\Source\packages'.
GET https://api.nuget.org/v3-flatcontainer/microsoft.build.tasks.core/15.7.179/microsoft.build.tasks.core.15.7.179.nupkg
GET https://api.nuget.org/v3-flatcontainer/microsoft.build.utilities.core/15.7.179/microsoft.build.utilities.core.15.7.179.nupkg
Retrieving package 'Microsoft.Build.Tasks.Core 15.7.179' from 'nuget.org'.
Retrieving package 'Microsoft.Build.Utilities.Core 15.7.179' from 'nuget.org'.
Found package 'Microsoft.VisualStudio.Setup.Configuration.Interop 1.16.30' in 'D:\git\sbss\Source\packages'.
Removed package 'Microsoft.Build.Framework.15.6.82' from 'packages.config'
OK https://api.nuget.org/v3-flatcontainer/microsoft.build.utilities.core/15.7.179/microsoft.build.utilities.core.15.7.179.nupkg 53ms
Installing Microsoft.Build.Utilities.Core 15.7.179.
OK https://api.nuget.org/v3-flatcontainer/microsoft.build.tasks.core/15.7.179/microsoft.build.tasks.core.15.7.179.nupkg 78ms
Successfully uninstalled 'Microsoft.Build.Framework.15.6.82' from Synovia.Service
Installing Microsoft.Build.Tasks.Core 15.7.179.
Removed package 'Microsoft.Build.Tasks.Core.15.6.82' from 'packages.config'
Successfully uninstalled 'Microsoft.Build.Tasks.Core.15.6.82' from Synovia.Service
Removed package 'Microsoft.Build.Utilities.Core.15.6.82' from 'packages.config'
Successfully uninstalled 'Microsoft.Build.Utilities.Core.15.6.82' from Synovia.Service
Package 'Microsoft.Build.Framework.15.8.166' already exists in folder 'D:\git\sbss\Source\packages'
Install failed. Rolling back...
Package 'Microsoft.Build.Framework.15.8.166' does not exist in project 'Synovia.Service'
Package 'Microsoft.Build.Utilities.Core.15.6.82' already exists in folder 'D:\git\sbss\Source\packages'
Added package 'Microsoft.Build.Utilities.Core.15.6.82' to 'packages.config'
Package 'Microsoft.Build.Tasks.Core.15.6.82' already exists in folder 'D:\git\sbss\Source\packages'
Added package 'Microsoft.Build.Tasks.Core.15.6.82' to 'packages.config'
Package 'Microsoft.Build.Framework.15.6.82' already exists in folder 'D:\git\sbss\Source\packages'
Added package 'Microsoft.Build.Framework.15.6.82' to 'packages.config'
Executing nuget actions took 6.84 sec
Failed to add reference. The package 'Microsoft.Build.Framework' tried to add a framework reference to 'System.Xaml' which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance.
Reference unavailable.
Time Elapsed: 00:00:10.1224742
========== Finished ==========
'System.Xaml' which was not found in the GAC
Your project is probably target .Net 3.5, which does not have this DLL. You can update the framework version in Project Properties.
If above not resolve your issue or you do not want to change your framework version, you can manually add the reference System.Xaml to your project:
Go to References -> Add Reference... and then click on Browse..
Add the file, which is located on (Windows 10): C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.Xaml.dll
Then update your nuget package.
Hope this helps.

'System.Web.Mvc.VirtualPathProviderViewEngine' is defined in an assembly that is not referenced

The complete error is "'System.Web.Mvc.VirtualPathProviderViewEngine' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'"
I have an Asp.Net Mvc 4 application build in Visual Studio 2010 that does not build on one machine but builds on another machine without issue. Through the tips System.web.mvc missing I discoverd that the machine that builds does indeed have MVC 3 version 3.0.50813.0 and the machine that does not build has MVC 3 version 3.0.20105.0 so I uninstalled MVC 4 and MVC 3 and attempted every combination of uninstall and reinstall between downloaded installers and the web platform installer but the problem machine still gets the older version. I decide that I will just attempt to fix the project by upgrading the NuGet package for the one project using the suggestion from the question
Install-Package Microsoft.AspNet.Mvc -Version 3.0.50813.1
at which point it the following error with the NuGet package Manager
"Install-Package : The schema version of 'Microsoft.AspNet.Mvc' is incompatible with version 2.0.30625.9003 of NuGet. Please upgrade NuGet to the latest version" In attempting to fix that I find this Nuget versioning issue with package restore
I performed the answer from there and got the same error when attempting to install the NuGet package, which makes sense because it is looking for an older version of NuGet.
I also looked at this MS14-059 but my project does not even reference the MVC 3 dll so the manual update option is out and I have tried the NuGet package.
My question is
Does anyone know where I can find an installation of the MVC 3 framework for version 3.0.50813.0
OR
How I can get the NuGet package to install in my solution.

How do I install WindowsAzure.Storage in Visual Studio 2013?

Note: this answer didn't help me because I don't have the same dll: System.Collections.Immutable 1.1.37
I'm using Visual Studio 2013 and .net 4.5 and following this tutorial: Get started with Azure Blob storage using .NET
I am trying to install WindowsAzure.Storage but get this error:
Attempting to resolve dependency 'Microsoft.Data.OData (≥ 5.8.2)'.
Attempting to resolve dependency 'System.Spatial (= 5.8.2)'.
Attempting to resolve dependency 'Microsoft.Data.Edm (= 5.8.2)'.
Attempting to resolve dependency 'Newtonsoft.Json (≥ 6.0.8)'.
Attempting to resolve dependency 'Microsoft.Data.Services.Client (≥ 5.8.2)'.
Attempting to resolve dependency 'System.Net.Requests (≥ 4.0.11)'.
Attempting to resolve dependency 'System.ComponentModel.EventBasedAsync (≥ > 4.0.11)'.
Attempting to resolve dependency 'System.Dynamic.Runtime (≥ 4.0.0)'.
Attempting to resolve dependency 'System.Linq.Queryable (≥ 4.0.0)'.
The 'System.Linq.Queryable 4.0.0' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.12.0.817'.
when I upgrade Nuget per the red error in the image, it takes me to Extensions and Updates asking to update this:
I don't know the relation between what I am looking for and this, but I went ahead and followed that update anyway, but get the error:
Where should I proceed from here!?
based on comment form Simsons, I already checked that my processor supports Virtualization:
When you try to install the WindowsAzure.Storage package through NuGet, this is the key error;
Attempting to resolve dependency 'System.Linq.Queryable (≥ 4.0.0)'. The 'System.Linq.Queryable 4.0.0' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.12.0.817'
Unfortunately, System.Linq.Queryable 4.0.0 requires NuGet 3.0 or above. So this isn't going to work on Visual Studio 2013.
Luckily, the newer System.Linq.Queryable 4.3.0 only requires NuGet 2.12 which is available for Visual Studio 2013.
So, to successfully install WindowsAzure.Storage in Visual Studio 2013 via NuGet:
Download and Install NuGet 2.12 if you don't already have it. (OP has confirmed already having this version)
In NuGet, Install System.Linq.Queryable 4.3.0
In NuGet, Install WindowsAzure.Storage
Open your Visual Studio 2013. Go to Tools > NuGet Package Manager > Package Manager Console
In the packet manager console type:
Install-Package NuGet.Client -Version 3.2.0
I tried this using NuGet Client version 3.2.0. The current latest version is 4.3 (beta) or 4.2. So I'm not sure if it will work for versions 4.2 and 4.3, but it surely works for NuGet 3.2.0. NuGet >3 was all I needed for SendGrid and other packages.
Clearly for Visual Studio 2013 you can only use NuGet 2.12,
https://www.nuget.org
If you want to use NuGet 3.x as well as those packages that require NuGet 3.x, you have to upgrade to Visual Studio 2015 and above.

Unable to Install Microsoft.Net.Http through Nuget

When trying to installing Microsoft.Net.Http in a Windows Phone 8 project. I'm getting this error:
Attempting to resolve dependency 'Microsoft.Bcl (≥ 1.1.3)'.
Attempting to resolve dependency 'Microsoft.Bcl.Build (≥ 1.0.4)'.
Successfully installed 'Microsoft.Bcl.Build 1.0.10'.
Successfully installed 'Microsoft.Bcl 1.1.3'.
Successfully installed 'Microsoft.Net.Http 2.2.13'.
Successfully added 'Microsoft.Bcl.Build 1.0.10' to WinPhone.Data.
Executing script file 'D:\WinPhone\packages\Microsoft.Bcl.Build.1.0.10\tools\Install.ps1'.
This reference cannot be removed from the project because it is always referenced by the compiler.
This reference cannot be removed from the project because it is always referenced by the compiler.
This reference cannot be removed from the project because it is always referenced by the compiler.
This reference cannot be removed from the project because it is always referenced by the compiler.
Executing script file 'D:\WinPhone\packages\Microsoft.Bcl.Build.1.0.10\tools\Uninstall.ps1'.
Successfully uninstalled 'Microsoft.Bcl 1.1.3'.
Successfully uninstalled 'Microsoft.Bcl.Build 1.0.10'.
Install failed. Rolling back...
Failed to add reference to 'System.IO'
It says it's supported for Windows Phone 8 : https://www.nuget.org/packages/Microsoft.Net.Http/2.2.13
Anyone with any suggestions ?
The problem was Nuget; after someone answered this on msdn to update and try again. It worked after that.

Categories