I installed this NuGet package through the Package Manager Console. It messed up my project and since System.Net.Http is missing so it is impossible to build my ASP MVC WebApi project anymore.
I tried removing references to System.Web.Http.WebHost.dll from the project and adding the previous one (that used to work) and regardless of which I used now, the Http part of the namespace can't be found.
Have you ever had this problem ? I read trashing the project and starting from scratch solved it for others, but that's not really a solution in my book.
Any ideas ?
Try to run this in Package Manager Console:
Update-Package Microsoft.AspNet.WebApi.Cors -Reinstall
If you get any errors, comment below.
I trashed the project and restarted a new one (Web API). I'm just drag and dropping class files back in the new one.
It wasn't under source control. That'll teach me.
Related
I have an Umbraco 7.6.1 site which I'm trying to upgrade to a later version, I'm not sure which version I'm going to yet, but the problem exists no matter the version jump.
The Umbraco project is set up in Visual Code IDE and uses NuGet.
So I go to the projects NuGet package manager and update UmbracoCMS from 7.6.1 to 7.6.2. I don't overwrite files. I've tried overwriting files and checking what it's doing in git, but with no luck either.
All seems well. I then build the project and load up the site in debugging mode. I get asked to log in and pushed to the upgrade page. I then hit continue and shown "Error during installation" instantly. It also tells me to check the logs, which are non-existent.
What am I doing wrong?
Thanks,
Dan
To fix the issue I was having I commented out any rewrite rules I was including in my main Web.config and cleared out everything in the bin folder and re-built the solution. That seemed to have done the trick.
I have a problem with visual studio and nuget package manger
I was running very good when suddenly the project stopped to compile telling me that the ApplicationDbContext should derive from DbContext or something like that, i couldn't see the problem so i cleaned my solution rebuilt the project it compiled but had stupid runtime erros so I searched stackoverflow and the web And I found out it was a reference error in the first place so I removed the bin folder as described here in this question
higher version than the referenced assembly
then it went all bad i tried to remove all the references and re-install them manually but nuget PMC kept telling me that my project already had a reference to that assembly,, I closed Visual Studio re-cleaned the project and done that once again with no results!
so the question here would be how to re-install the latest version of everything to be compatible with asp.net MVC 5.1 without getting a message telling me that my project has a reference to those assemblies nonsense !
I had this happen to every one of my projects I upgraded to MVC 5.1. I had to add binding-redirects to my web.config. With the Package Manager Console it was easy.
http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference#Add-BindingRedirect
I am building a site using MVC4. I couldn't even begin that I am having a strange error. This is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace MyProject
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
The error message: The type or name of the assembly 'HttpConfiguration' does not exist in the namespace 'System.Web.Http' (are you missing a using directive or an assembly reference?)
It also doesn't recognize the readonly field RouteParameter. It occurs to me that it may have something to do with the version, my System.Web dll is version 4.0.0.0.
Another additional piece of information is that when I type "using System.Web. ", Intellisense DOES recognize the .Http dll
HOWEVER, in the code, it does not recognize any of its parameters.
I solved it. The issue was that, when I created the site, I updated all packages via Nuget. However, as I wasn´t going to use Entity Framework, I uninstalled it. In order to be able to uninstall that package, it required for me to uninstall Microsoft.AspNet.Providers.Core 1.2 as well... and I did.
This missing package messed things up. I cleared the project and started all over again. I could have also used the Update-Package command in the PM Console and would have restored all lost packages. However, since I had done so much mess compared to the little (next to null) work I had done, I decided to start it all over again.
Thanks anyway!
I encountered this error when cloning an MVC 4.0 application which previously worked for me. My problem was that the Microsoft.Net.Http NuGet package wasn't restoring properly. I solved it from the NuGet console:
Update-Package -reinstall Microsoft.Net.Http
For others facing this issue, my solution was different. Firstly I was downgrading a project from .net 4.5 to .net 4.0, but the symptoms were the same as above:
The type or name of the assembly 'HttpConfiguration' does not exist in
the namespace 'System.Web.Http' (are you missing a using directive or
an assembly reference?)
I stumbled across a blog post which explained that there is a link between Newtonsoft.Json and HttpConfiguration, I removed the reference to Newtonsoft.Json from the project and the packages.config file then re-installed Newtonsoft.Json from the package manager console:
Install-Package Newtonsoft.Json
I was not able to uninstall Newtonsoft.Json from the package manage console due to other dependencies, hence the need to manually remove the reference.
Here's the link to the article: Newtonsoft.Json Hidden Dependencny on HttpConfiguration Breaks Compilation
1.In Solution Explorer, right-click the project node and click Add Reference.
2.In the Add Reference dialog box, select Assemblies tab. And type the “system.web.http” in the search box in the upper right corner.
3.Select the components you want to reference, if it is already selected than first remove the reference than **again Add Reference.
Rebuild the project again. Please let me know if it works. Thank you.
We started experiencing this issue on one of our projects since last week. The project was building fine 2 weeks ago & then all of a sudden started throwing out this exception. No changes were made in in the nuget packages for this project. Even checking out an older revision from SVN didn't result in a successful build.
Out of desperation, we upgraded the solution from VS2012 to VS2013 & lo and behold, it built! We suspect, but were unable to confirm, that a tooling update done in Visual Studio 2013 had affected this library in Visual Studio 2012.
This may not work for all, but there is an option to upgrade the solution, this seems to resolve the problem.
Make sure you compile for Framework 4.5 and not 4.0. That solved the problem for me
when you updated and reinstalled all the AspNet packages from Nuget, and seems there were no appropriate solution - restart of Visual Studio saved me.
I had to update Microsoft.Net.Http and after a long struggle it worked for me
Update-Package -reinstall Microsoft.Net.Http
Yet another scenario. I accept that this is only loosely related to the question as I'm purely Web API. However my search led me here so...
I had an existing project in the solution that targeted Framework 4.5.2.
When I added a new project, it went in as 4.5 as I wasn't paying enough attention. HttpConfiguration duly vanished from the Web API Register method.
Changing the target to 4.5.2 resolved the HttpConfiguration issue. Mind you it also caused some other grief with RouteParameter: now I had two definitions, one in System.Web.Http and the other in System.Web.UI.WebControls. Easy enough I guess.
My feeling is that there is more to this...
I have installed NuGet.
When I try to go to Project > Add Library Package Reference
"Add Library Package Reference" is not under the project menu. If I try to install NuGet again it says it is already installed. My application is an MVC 3 application targeting .net 4.
How can I get this option to appear?
You might also run VS as Admin (Ctrl-Shift-Click) then uninstall NuGet from the package manager dialog. Then update to NuGet 1.1 from http://nuget.codeplex.com and see if that fixes it. ASP.NET MVC is not needed.
Is it possible that some of the extensions of your Visual Studio are causing NuGet to not show the menu or crash? You could try to disable/remove them and then install NuGet from here: http://nuget.codeplex.com/
Besides, there is also a PowerShell-based Package Manager Console. You could take a look on that in case everything fails.
Make sure you have the project selected and not the solution in the solution explorer.
As of May 2012, it's now called "Manage NuGet Packages".
Especially confusing because the screenshots in the NuGet Docs have not been updated.
https://stackoverflow.com/a/9844659/24267
Normally NuGet is installed with ASP.NET MVC 3 so it should appear automatically. Try removing the NuGet package that you have installed and reinstall ASP.NET MVC 3.
Had this same issue, just realized that if you're not on the project (i.e., you have the solution highlighted in solution explorer) that the option for the Add Library Package Reference won't show. Select the project and it's there.
Whoops: Didn't notice that was already mention.
I've just had a similar problem, after trying to install a package over dial-up, which timed out.
To fix it, I renamed the registry key (so that I could rename it back if it didn't work) HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\NuGet, then restarted visual studio and opened a project. The Add Library Package Reference now works and the registry key has been recreated.
I've recently installed the MVC CTP5 and VS is now crashing on me when I try to open an aspx, I get the following error in event viewer:
.NET Runtime version 2.0.50727.3053 - Fatal Execution Engine Error (7A035E00) (80131506)
I was able to find This post on the asp.net forums relating to the same issue but nobody has had a working solution yet (at least not for me).
Just wondering if anyone else has run into this issue and what they have done to resolve it?
EDIT: Wanted to add that I have tried all the tips in the article and can open the markup with a code editor but was wondering an actual solution had been found to resolve this issue.. Thanks!
EDIT: I don't have this issue on my Vista box, seems to only occur on my XP VM.
I had a problem with Power Commands and Preview 5. If you have Power Commands installed, try updating or uninstalling it to fix the issue.
Here are a steps to work around from the post that work for me:
1.Open project based on CTP5
2.IN solution Explorer, enable "Show All files"
3.Open "bin" folder and delete "Microsoft.Web.Mvc.dll", "System.Web.Mvc.dll", "System.Web.Abstractions.dll", "System.Web.Routing.dll"
4.Open "References" folder, click ONCE "System.Web.Abstractions" and in Properties window change "Copy Local" to true. Repeat same with System.Web.Routing.
5.Build application (Ctrl+Shift+B)
6.Open site.master in designer. VS will not crash.
FYI - Microsoft has released a hotfix that fixes [at least some variations of] this problem:
https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827&wa=wsignin1.0
http://blogs.msdn.com/jnak/archive/2009/02/26/fix-available-asp-net-mvc-rc-crash-in-a-windows-azure-cloud-service-project.aspx
A bit of a null answer but I’ve been having this too. Not that I restart VS often but cleaning out the bin folder before opening the web project is my workaround.
Have same problem, on vista x64 and vs2008 sp1. Have to do probably something with cleaning bin folder and system.web.routing/abstraction, because it crashes even on webforms project with (mvc) routing in it. When I delete all files from bin, and add references again, it works fine.
Really annoying bug in vs2008+ctp5!