21

I'm running VS2005, and when I right click on an object and select Go to Definition it brings me to the object browser instead of the actual code.

Is there some settings that I can change to fix this? Note: it works properly for C# solutions, I am having the problem with Basic.

DevDave
  • 6,700
  • 12
  • 65
  • 99
Kevin
  • 3,574
  • 10
  • 38
  • 43

4 Answers4

14

I usually see this when I have a reference to the library added as a "binary" reference rather than a "project" reference. You might need to remove the reference and add it back from the projects tab.

Eric Nicholson
  • 4,053
  • 1
  • 28
  • 29
  • your right, it's referenced to a dll. Is this the only way to reference something in VB.NET that is written in C#? – Kevin Jan 27 '10 at 21:20
  • 1
    You should be able to add both C# and VB.NET projects to a single soluion and should be able to access code from the VB project from the C# project and vice versa. You just can't mix C# and VB.NET in within a project. – Partha Choudhury Jan 27 '10 at 21:53
  • You can't navigate in a single solution between vb.net and c# code using Visual Studio Go to Definition (F12), for that purpose you need something like resharper. – Giulio Caccin Feb 19 '14 at 09:40
  • @ParthaChoudhury - After reading your comment I tried to do it myself - and I can confirm it did NOT work. Go to definition is not working between C# and VB.NET. – BornToCode Jun 29 '15 at 14:58
14

This can also be caused by mismatched versions of the .Net framework in your advanced compile options.

http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/MigratinganOutlookClienttoVisualStudio20_CB9A/image_4.png

I noticed that one of my projects was set as .net 3.5 and another was .net 4.0.

When I clicked Go To Definition (f12) on the .net 4.0 project, the code in the .net 3.5 project would only be shown in the object browser.

Luckily I am able to change both to be the same without any issues, but those with established code libraries may need to beware when changing the .net version.

Ash Clarke
  • 4,807
  • 1
  • 37
  • 48
3

I saw this too while using Visual Studio 2015, in (C/C++) native projects, after switching between different git branches. The solution is to close VS, go in $(SolutionDir) and delete the .sdf file, then reopen the solution.

  • I had this issue with VS2015 Update 2 C/C++ native projects as well. I followed your solution but did not have any .sdf file. Nevertheless I removed the .db file and ipch folder and it worked. – ajcaruana Apr 13 '18 at 11:51
0

I'm not sure exactly why, but I had my Solution in Release mode when I was seeing this issue. When I put the solution into Debug mode debugging/navigating worked properly.

John B
  • 20,062
  • 35
  • 120
  • 170