26

I've downloaded a website and in VS express open it through file => open website. When I press F5 to debug I get build errors:

The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft'

I guess I'm missing a reference but how come it works on the server? References for these projects can be found in the bin directory right?

Under website => start options => build I've set the following: "Build web site" and target framework ".net framework 4" this is the same as the server.

I guess it's looking for a dll that contains Microsoft.aspNet which probably is in totallyUnrelatedName.dll in the folder scratchYourHeadAndLookSomeMore

Could someone help me out and give me a clue as to why Microsoft.aspNet would be missing from my computer?

I'm tempted to quit this job since all projects are web projects without any documentation that won't run locally but do need major changes. Client has no problem to implement changes on the live site but I do.

1
  • Had this issue in relation to stackoverflow.com/questions/34920895/… ; the solution on that thread was to remove C:\Users[Username]\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache which resolved both issues for me. Commented Jan 31, 2017 at 12:37

6 Answers 6

40

Go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution.

Click on the Online Tab.

Search for Microsoft ASP.NET Identity Framework.

Install this package.

Rebuild Solution.

Sign up to request clarification or add additional context in comments.

1 Comment

Just in case one can't find it through manager(I couldn't, no idea why), you can install it by Package Manager Console Install-Package Microsoft.AspNet.Identity.Core -Pre
7

I guess I'm missing a reference but how come it works on the server? References for these projects can be found in the bin directory right?

Not if the used libraries are installed on the server. You might want to install them on your workstation too, or add the proper references (for example via NuGet) and do a bin-deploy.

On how to find out which libraries you're missing: find class names, not namespace names.

4 Comments

Thank you codecaster, got this error out but next one is waiting. The time to finish these projects is very short and would spend 5 times the amount just to get it running. I'll give up on asp.net if it means having clients with messy projects like these.
(off topic) Every project contains an average of 30 SqlDataSource in aspx. Did you ever encounter such a mess?
@HMR unfortunately, messes emerge everywhere where time is short and requirements high. Good luck on your inherited projects; don't give up on frameworks because you've seen bad projects created with them.
You're right but this is the too many times time I've been asked to maintain a project that If I'd wrote that for my pref employer I'd be fired.
6

I had this error message too so I reinstalled all of my nuget packages again via the package manager console. Unfortunately this did not sort my issue and after loading up a completely separate project within a different solution to the one in which I was experencing: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' error, I noticed that it was occurring there too. This meant that there was an issue with my Visual Studio rather than a problem with individual packages or projects.

It turns out that my MEF Component Cache was corrupted - to fix this I deleted my Visual Studio's component model cache folder which can be found here:

%LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache

Mads Kristensen has created a Clear MEF Component Cache Visual Studio extention which you may find useful:

Clear MEF Component Cache

1 Comment

%LocalAppData% mostly located C:\Users\[Username]
0

i have the same issue, on mac vs 2019, reinstall all Associated nuget of the error you get, you caמ find them on simpale search on google "nuget + " for example "nuget AddNewtonsoftJson", then go to "project > manage nuget packages" ...

Comments

0

If your code is older, you may be missing an older .Net Framework SDK or "targeting pack".

Ensure you have the correct ones by running Visual Studio Installer and clicking on the tab "Individual Components". Scroll down and select the framework/pack needed. It shouldn't break anything to select them all like seen below.

enter image description here

Comments

-2

I try all above solution but It did not resolve my issue.

If still you cannot resolve this following solution might help you

https://www.nuget.org/packages/DotNetOpenAuth.AspNet/

NuGet Installation:

Go to Tools -> NuGet Package Manager -> Package Manager Console

PM> Install-Package DotNetOpenAuth.AspNet

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.