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

后端 未结 26 2864
夕颜
夕颜 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条回答
  •  -上瘾入骨i
    2020-12-07 14:06

    I just ran into this problem on VS 2013. Something I could (did?) not isolate was changing the GUID in the CSPROJ file. Since the CSPROJ files are checked into SVN, I could not simply change the GUID on my local dev. Instead, I was constantly SVN reverting the local change each time it happened.

    First, I had to solve the changing GUID problem.

    1. Revert the CSPROJ to the checked-in version.
    2. Open the CSPROJ via a text editor, NOT VS.
    3. Extract value from the pristine CSPROJ file.

      {B1234567-5123-4AAE-FE43-8465767788ED}

    4. Open the SLN file via a text editor, NOT VS.

    5. Locate the Project reference in the solution.

      Project("{FAE12345-3210-1357-B3EB-00CA4F396F7C}") = "Some.Project", "....\assemblies\Some.Project\Some.Project.csproj", "{B7654321-5321-4AAE-FE3D-ED20900088ED}" EndProject

    6. The first GUID listed is the Solution GUID. For every project referenced in your SLN, you should see this value repeated at the first argument. The GUID following the .csproj is the one you want to replace with the pristine GUID.

    This should solve the first problem, but the "Go to Definition" landing in meta data is not solved. In our SLN file, there is a master project (our web site), so its entry in the SLN file should contain a ProjectSection entry with multiple GUID values. Here is an example:

    ProjectSection(ProjectDependencies) = postProject
    {AC50D230-24C4-4DCA-BAAD-355E6AF5EFBD} = {AC50D230-24C4-4DCA-BAAD-355E6AF5EFBD}
    EndProjectSection
    

    Notice the missing GUID in this collection is the one from my pristine project.

    1. Add the missing GUID as the last entry between ProjectSection and EndProjectSection. The format appears to be per-line, and it is {GUID} = {GUID}.
    2. Save the file.
    3. Open your solution.
    4. Right-click a reference in the newly-added project and "Go to Definition."

提交回复
热议问题