VS Removes Usings and Can't Find Types

So I was working tonight and ran into a goofy issue with Visual Studio 2013. I had it Remove and Sort Usings for the entire solution. It did but along the way I kept getting a "Your project doesn't compile...Do you want to continue" message. Figuring it was some small issue with a quick fix, I hit Yes. Doh!! When it got done, I had a bunch of "The type or namespace name...could not be found (are you missing a using directive or assembly reference?)" errors. I also had a bunch of metadata errors but they weren't the problem.

When I'd add the needed Using, VS would remove it when I'd save and close the file. Wait a minute, I needed that reference and VS should have known that!! If I added the Using and did a Rebuild, it would leave it there and I could close the file. If the file is open it would give me the same error, red squiggles and Remove Usings would take it back out.

There were two projects that had issues, Entities and Infrastructure. Didn't matter how many times I'd Rebuild these projects. It was only these two projects.

Solution:

I opened the folder containing the solution (right-click on the solution and the option is towards the bottom of the menu).

I closed the solution in VS but left VS open.

I went into each project and deleted the Bin and Obj folders.

I re-opened the solution in VS and did a Rebuild on the solution.



Comments

Popular posts from this blog

Migrating Legacy Apps to the New SimpleMembership Provider

Windows 8 Keyboard Shortcuts

Get Asp.Net Profile properties from Sql