Find all references and Go to definition not working for a specific project in vs solution - visual-studio-2013

In a VS 2013 solution with several projects I have added an existing project (dll) and referenced it in one of the other DLLs.
The problem is that when I use "Go to definition" for a class that is defined in this project the text from the metadata is displayed as if the text files of this dll are not in the solution.
Similar problem with "Find all references".
Language is the same C#.
Any ideas?

Problem solved.
When I added the reference of the existing project that I added in the solution I did not select it from the projects of the solution but browsed and select it from its output folder (debug or release).
That simple!

Related

Visual Studio 2017 not updating references

I have a VS solution with three projects. When I make changes to the class library the references doesn't update and it keeps expecting the old namespaces and classes and results in error when building since it can't find the old namespace.
It also results in build errors if I try "using LC.Tools.API.Models" since it can't find the namespace and intellisense shows the old namespaces (LC.Tools.API.Model) with the old classes.
The solution contains two ASP.NET Core web projects and one ASP.NET Core Class Library. The class library is referenced as a project reference in the other two projects.
I've tried deleting the bin and obj folder on all projects, re added the references, rebuild, build, clean solution.. Is there a way I can fix this without having to recreate the projects?
Sometimes had similar issue in Visual Studio 2015 Update 3.
Solved it by right clicking on project in Solution Explorer and then choose the "Unload the project" option and after that right click on unloaded project again and choose "Reload the project".

Visual Studio 2013 Set as start up project does not change the project

I have several projects in the solution. When I set the "Set as start up project" (In VS 2013) to the Console application project and when I hit F5, it sets the start up project to a particular class library project (Class Library 1). I cannot change the start up project from "Class Library 1" to anything else. I tried to change the start up project by right clicking the project as well as right clicking the solution and then set the start up project from there.
When I set the start up project as the "Console App1" project, it indicates that it has been selected properly (bold the project name). But once I hit F5, it tries to execute "Class Library 1" (bold the Class Library project) and gives an error (A project with Output Type of Class Library cannot be started directly).
I tried to delete the .suo file and open up the solution, still I am getting the issue.
Where is the start up project details are stored? Could not find any clue inside the sln file as well. Any ideas?
Ok, found the issue. Forgot to mention that I am using Resharper. There was a resharper "dotSettings" file (.sln.DotSettings.user) in the solution directory which has the following entry,
<s:String
x:Key="/Default/RunConfigs/Config/=9DF93B60D662E841A397F5FDE870C414/Name/#EntryValue">Class Library 1</s:String>
Solution is to delete this file. (Changing this entry did not solve the issue.)

Visual Studio dependencies between projects: automatically open up related solution when browsing through code references? [duplicate]

I have a C# project which contains references to assemblies in DLL format. I have the PDB information for these DLL files, contained in the same folder. When I press F12 on a referenced member, I want to go to the definition of the member. Instead, it gives me the metadata, which of course I don't want.
When VS is debugging, it does go to the source code if I single step into that method. But if I press F12 on that method, it still brings me to the metadata.
There is a similar question here, but it only applies to project references, and the accepted solution has nothing to do with my issue.
"Go To Definition" in Visual Studio only brings up the Metadata
To summarize:
Referenced project is a DLL
I have the PDB information
Single-stepping in debug-mode brings me to the source code
F12 brings me to metadata
I want F12 to bring me to the source code as debug does.
EDIT: Adding as a "Project" is not an option as it creates additional complexity as our solution file references about five other projects which are all under separate source control repositories.
In Visual Studio expand the References section, select the reference to your related project (the one that contains the source code you want to F12 into) right click on it and select "Remove".
Then add the reference back to the project by right clicking on References and selecting Add Reference, under the Projects tab (if your using VS 2012) select (or browse for) the project you want to add a reference to and then click the OK button.
This will rebuild the reference and you will be able to F12 into the referenced projects source code. You will need to do this with all the projects in your solutions that are having this issue.
I don't know why this happens but at least the solution to the problem is rather simple
If you have ReSharper installed, you should bring up ReSharper options, and look for External Sources. There you can specify the relevant options:
It appears that this issue has been solved in Visual Studio 2013. Having the PDB information in the same folder as the DLL is showing me the source code when I use Go To Definition. I do not have the Reflector extension installed.
Is the referenced DLL a project in your solution? I find that when I have the source code for the project, and it's in my solution, Visual Studio is able to link to this code much more easily. (without showing me meta data).
Also, be sure to add the reference by "Project" in the References popup.
This is generally what I do anyways when I have this problem
Hope this helps!
PS. PDB files are usually just for debugging (both locally and remote) and are not used for source code reading in the way you are attempting to use it. ("Go To Definition")
One solution to this issue is to use .NET Reflector, VS or VSPro edition. This program will modify Visual Studio to provide the required functionality.
http://www.reflector.net/
Unfortunately, it costs $135 to $195, which isn't an option for everybody.
Add the reference as a project instead of ..\bin\Debug\referenceFile.dll
That solved my issue
I also used add reference as a project and my problem has been resolved and it's working great. Actually I was stuck at this point from very long time and finally i resolved this issue.
References -> Add References -> Solution -> Projects -> Select reference

Upgrade to Visual Studio 2010 throws a build error

Recently upgraded to VS 2010 from 2008, the previously built solutions are throwing the following error.
Error 14 Encountered multiple versions of the assembly with GUID 'a5851ea0-2f9a-40b2-a73a-cd7db32f09c5'. Try pre-importing one of these assemblies
I tried re-installing VS 2010 and it didnot help. Any ideas?
Is it the VS 2010 application itself crashing, or does it not like your solution? Can you open VS 2010 by itself? If so, it sounds like it doesn't like some of your references in one or more of your projects. Check the project references. If that doesn't work, start removing projects until you find the offending one.
This may happen, if you copy-paste-renamed a project file to re-use its settings but didn't changed the project GUID of it. Also could be a project migration error, anyway you will have to manually edit the project file and remove the duplicate references if the project fails to load because of the error.
I had the same issue when migrating 2008 -> 2013.
It was caused that we use same linked AssemblyInfo.cs for all projects in solution.
And only for the assembly that used some COM objects (MSMQ) it seems that it starts looking on referenced assemblies GUID and two of them from our solution...
So when I provide individual AssemblyInfo.cs for projects with unique GUIDs it start working.
Hope this info will helpful.
Try to remove the references to the debug folder.
In Visual Studio right click on Project
Select Properties
Select the references tab.
Check to see if any of the references are from the obj\Debug folder and remove them.
See similar question here.

Visual Studio Project References inside solution

What is the best way to reference a project inside solution.
I added references via Add Reference --> Projects. However it links to either release DLL or Debug dll.
I want to have project itself in the reference, when we compile the projects, all the references projects must be compiled (through dependencies).
How to do this?
If you want to reference a project itself, and NOT a DLL/assembly (from the Browse tab in the Add Reference dialog), then you should add the project you want to reference to the Solution (Add... Existing Project). Once it's in the Solution, the Add Reference dialog will let you reference one project in the solution from another project in the solution (via the Projects tab in the Add Reference dialog).

Resources