“Go To Definition” in Visual Studio only brings up the Metadata

后端 未结 26 2714
夕颜
夕颜 2020-12-07 13:33

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 Metadata file in

相关标签:
26条回答
  • 2020-12-07 13:55

    For me, the GUID solution didn't work and I couldn't find my .ncb file. (Or maybe I'm lazy and didn't look hard enough, but that's not important.) Rebuilding and restarting visual studio didn't help either.

    What I did was close visual studio and delete the .dll and .pdb being referenced in the top of the Meta Data file that my intellisense kept linking to. In my case it meant I deleted my .dll and it's .pdb file from Utilities/bin/Release. (Utilities is the name of the .dll project I was having issues with.) Then I restarted visual studio and rebuilt the .dll then the whole solution. No more problems!

    0 讨论(0)
  • 2020-12-07 13:56

    I figured out how to solve my problem from this post, maybe it will also work for some of you.

    I followed these steps:

    1. Close the solution.
    2. Delete the intellisense database file for the solution: .ncb
    3. Open the solution.
    4. Rebuild the solution.

    (I believe either step 3 or 4 regenerates the intellisense database file when it is missing)

    Intellisense, "go to defintion" and "find all references" should be working again.

    0 讨论(0)
  • 2020-12-07 13:56

    In my case, I had just recently changed

    <mvcBuildViews>
    

    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.

    0 讨论(0)
  • 2020-12-07 13:58

    Remove the reference dll, Build (will get errors), ADD THE reference (you removed) then build again ... F12 on your function should then work (worked for me).

    0 讨论(0)
  • 2020-12-07 13:59

    Well, another developer found the answer. The specific project we had an issue with was originally added as a file reference, then removed and added as a Project Reference. Visual Studio however, kept both in the csproj file for the web site, causing the issue. He went in and manually edited the csproj file to remove the file reference to the problem project and all is fixed now

    0 讨论(0)
  • 2020-12-07 14:00

    I had a circular reference between the two projects involved (which is a no-no). Had to restructure my code a bit in order to solve it as both projects were truly dependant on each other. Removing one of the references solved the intellisense problem. It was logically flawed and I probably wouldn't have noticed without this error!

    0 讨论(0)
提交回复
热议问题