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

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.)

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".

Namespace/Assembly errors in "Views" section in Visual Studio 2017

I have a .Net Core application that I used to develop on "back in the days of Visual Studio 2015". I have now moved on to Visual Studio 2017 and back to this project and I have a need to rename the project. I started following numerous guides online on how to rename a Visual Studio project, however none of them seems to support .Net Core and Visual Studio 2017. I believe it is important to mention that the only part of my project that complains about the namespace is the "Views" section, and it only seems to refer to files that have been created/edited recently.
After doing the following, I have still not found a solution:
Rename Solution in solution explorer.
Rename project in solution explorer.
Changing Assembly name in "Project" -> " Properties".
Changing Default namespace in "Project" -> " Properties".
Going to Program.cs and changing namespace using "Right-click" -> "Rename" -> "Rename all occurances".
Adding "#using " in _ViewImports.cshtml (complains about missing namespace here as well).
I am getting desperate as I feel like I have tried everything and nothing seems to works.
I have recently renamed my project from MobileFront to MSPFrontend and even if I change the "#using" statements inside my _ViewImports.cshtml back to MobileFront it still complains.
I am hoping that I am not the first one to encounter this tedious problem.
EDIT
I noticed the errors occured only when the files were open. I don't know if this is important to know of whether it has some importance for finding the solution.
I ended up downloading Microsoft.AspNetCore version 1.1.1 through NuGet. After doing that I created a completely new project and reopened my original project. That solved the problem. All of a sudden my project could find all namespaces and assemblies.

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

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!

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

"Are you missing an assembly reference?" compile error - Visual Studio

I am currently working on a server control for other applications in our company to interface with a WCF service. Every time I make a change code change and recompile the control, I increment the the AssemblyVerison and AssemblyFileVersion class in the AsseemblyInfo.cs by one. For example, my latest build went from 1.0.07.0 to 1.0.08.0.
When the consuming application updates the file by copying the latest file in the bin directory and tries to compile, they receive the following error:
The type or namespace name 'MyControl'
does not exist in the namespace
'MyNamespace' (are you missing an
assembly reference?)
In order to resolve this error, they have to delete the current reference and re-add the reference.
Is there any way to update the server control without having to delete and re-add the reference?
I am not strong naming the server control.
#JPunyon - Do you mean have the consuming application add the server control project to their solution?
In my case it was a project defined using Target Framework: ".NET Framework 4.0 Client Profile " that tried to reference dll projects defined using Target Framework: ".NET Framework 4.0".
Once I changed the project settings to use Target Framework: ".NET Framework 4.0" everything was built nicely.
Right Click the project->Properties->Application->Target Framework
Right-click the assembly reference in the solution explorer, properties, disable the "Specific Version" option.
If none of the solutions above worked, try this 10-second fix.
Navigate to the startup project in solution explorer. Right click, properties > Application > Target framework. Change the target framework to anything else. Press Yes for the confirmation dialog. Give the changes a few seconds to take effect, then switch the framework back to what it was before.
The error will hopefully go away for you like it did for me!
Are you strong-naming your assemblies? In that case it is not a good idea to auto-increment your build number because with every new build number you will also have to update all your references.
I bumped the answer that pointed me in the right direction, but...
For those who are using Visual C++:
If you need to turn off auto-increment of the version, you can change this value in the "AssemblyInfo.cpp" file (all CLR projects have one). Give it a real version number without the asterisk and it will work the way you want it to.
Just don't forget to implement your own version-control on your assembly!
If the code is working previously and is throwing errors now, as mentioned in the above answers one of the config could have been modified. In brute force approach, close the VS editor and delete .vs folder in the same directory of the .sln file. All the config will be cleared and picked up from the repo files.
In my case, I had to change the Copy Local setting to true (right-click assembly in solution explorer, select properties, locate and change value of Copy Local property). Once this setting was changed, publication of my WCF service copied the file to the server and the error went away.
I encountered this error with an Azure DevOps Services (MS-hosted) build pipeline on a TFVC repo.
In my case, I was working within a branch and had accidentally added the reference from the package folder in trunk instead of from the branch. Once I added the reference from within the branch, it started compiling successfully.
I.e., while working on \branch-beta\sierra.csproj, I accidentally referenced \trunk\packages\delta.dll. Obviously, I needed to reference \branch-beta\packages\delta.dll instead. The mixup occurred because the path is not prominently displayed in the Add Reference window and I didn’t check carefully enough.
I found this issue in Visual Studio 2019 Version 16.4.4
I resolved most issues by discovering that the
packages.config
was missing the appropriate reference
eg:
<package id="System.Runtime" version="4.3.0" targetFramework="net461" />
Delete 'Web.Debug.config' and 'Web.Release.config' file for your solution directory,it should remove all errors
While creating new Blank UWP project in Visual Studio 2017 Community, this error came up:
After restoring the NuGet cache the reference resurfaced in the Project.

Resources