I am working in a Web Project in Visual Studio 2008. When I hit F12 (or right-click and select Go To Definition) Visual Studio is consistently going to the Meta data file instead of going to the source.
Some Points:
- All the source code is C#, there is no VB.Net
- All the projects are in the same solution
- Yes, everything is a project reference (checked and double-checked)
- I have tried the Clean/Rebuild Solution approach (even to the point of clearing out the Temp directory, Temporary ASP.NET Files directory, etc).
Has anyone else seen this behavior and/or know how to fix it?
I faced the same issue and one of colleagues gave me the following solution and it worked! If none of the above works for you,
In my case, (using Visual Studio Professional 2015), when I had disabled the XAML designer, the F12 stopped working. As soon as I revert the changes, and restart Visual Studio, the F12 worked again.
Checked the pattern multiple times to confirm and then posted. Hope it helps someone.
Best guess is that you don't have debug information. Maybe you have multiple copies of your assembly on disk and it doesn't have the .pdb file with it.
Do a search for your assembly names from your projects and delete them all and rebuild.
I did all suggested steps but nothing has been changed then
finally right click and add reference menu, project tab
Problem sorted. Hope this will help to some one.
In my case, I had just recently changed
to "true" in my site's .csproj file (to find compile errors in my Razor view files: http://forums.asp.net/t/1909113.aspx?How+to+have+Visual+Studio+2012+returned+compile+errors+on+razor+syntax+error+in+asp+net+web+page+2+ ), and when I then built I was getting errors from my within my site's /obj/Debug/ directory. From any of those files (which were out-of-date), right-clicking and selecting "Go To Definition" would give me the [metadata] version.
So for me, none of the solutions here worked, because I wasn't starting from a file that was actually in my project. Deleted that entire /obj/Debug/ directory, the errors went away, and from any normal file I can correctly use Go To Definition.