Quick Fix: Deleting Resource Folders in Visual Studio

Blog Posts ,Programming ,Software
April 13, 2015

Today, in an attempt to get Bootstrap working with my ASP.NET WebVR application, I decided to delete the NuGet generated packages and promptly found myself unable to re-add them. If you’re new to using Visual Studio & ASP.NET, and find yourself in a similar situation, it’s actually a spectacularly easy fix that took me a while to find.

The problem: You’ve used the NuGet package manager to add something (in my case, Bootstrap) to an ASP.NET web application and then deleted the files generated (in my case, the Content directory that contained all of the Bootstrap files). I had not added them to source control when I had deleted them, since I generally only commit once the piece of code is working, and every time I returned to the NuGet manager in Visual Studio, it told me that the files were already included in the project.

The Solution!

It’s really easy to fix this problem, but it took me a while to find it. Go into the packages.config file and delete the line for the package you’ve deleted. In my case, it was:

<package id=”bootstrap” version=”3.3.4″ targetFramework=”net45″ />

Now go back to the NuGet package manger and find the package you were using. You can now add it back into the project and the files will be regenerated.

With that, you’re good to go!

Leave a Reply