Configuration With Same Name Already Exists - visual-studio

I have a solution with 10+ projects (VS2010 SP1). I have the following configurations defined in the solution:
Debug
Debug-QA
Release-UAT
Release-Production
This allows me to easily setup specific settings for each deployment scenario. However, for some reason I can't get things setup as I'd like. Please see this screenshot:
Notice the highlighted projects/configurations. I am unable to create a "Debug-QA" configuration for these projects (by selecting <New> in the cell for that particular project). When I try to add a new "Debug-QA" configuration to the DataUtility project, for instance, Visual Studio yells at me:
This configuration could not be created because a solution configuration of the same name already exists.
I know it does! I'm trying to add the configuration to the project! What am I missing here? I want all projects to have all 5 configuration. I have the same problem when trying to match up (create) platforms (for instance, adding an "Any CPU" platform to the DataUtility project).

Make sure you're using the drop down list from the grid (not the one at the top of the dialog), and do not check the "Create new solution configurations" checkbox when adding your new project configuration.

Here's a workaround if already checked the Create new solution configurations checkbox:
Open Explorer and navigate to the location of the solution for the project that is missing platforms.
Move the solution .sln file to a temorary location where Visual Studio won't locate it.
Open the .csproj file for the project that is missing platforms.
Click the Solutions Platform dropdown.
Click Configuration Manager...
In the table, Click the dropdown in the Platform column for the project and select , to add a new platform.
Click OK.
Repeat adding new platforms as needed.
Save the project.
Return the previously moved solution file back to where it was.
Reopen the combined project solution.
source: https://developercommunity.visualstudio.com/content/problem/972/adding-a-platform-when-one-with-the-same-name-alre.html

The above solution didn't quite work, but I did find a solution on a forum that worked. Described below is to set the builds to x64 for each project that was set to "Any CPU", but the steps would also work for x86.
Open the main solution. Unload each project with a conflict (not
remove).
Leave the solution open.
In Explorer, navigate to the
project folders and open the csproj file in Visual Studio.
In this
screwed up project, navigate to Build->Configuration Manager.
If
needed, "Add New" and set it to x64 and save.
Right-click the
project and set the build architecture to the new x64.
Save this,
but when you close the project in VS, do not save to the solution.
That's unnecessary.
Repeat for each project with a misaligned architecture.
Finally, in the original solution with all the offending projects,
reload each project.
Open the Build->Configuration Manager for the solution. Then, one by
one, reset "Any CPU" to the desired platform, in my case x64.
Save the changes for the solution and rebuild all. You should be OK,
now.

Related

In VS2010 the configuration list in Project Property Pages does not match the one in Configuration manager. How do I fix this?

I have an old Visual Studio 2010 Project with a lot of configurations. In an effort to refactor/make sense of the project I decided to shuffle around and re-name some of those configurations (Using the Edit option in the Configuration Manager). The problem? The list of the configurations available in the Project Property Pages (where one can change compiler or linker options etc.) still displays the old names! This can be very confusing and the lack of consistency is infuriating.
I tried restarting Visual Studio and deleting the .user and .sdf files - those didn't help. I even tried to manually Search&Replace the old names with new ones in .vcxproj and .sln files. The only result of that was being unable to open the project properly (does not build).
Is there anything I have done wrong? Can I do anything to restore some order into this project?
I suspect the behaviour I described is a bug in Visual Studio 2010 but I have eventually found a way to do what I wanted despite it.
In order to fully change the name of a Project/Solution Configuration:
Open Configuration Manager
Select <Edit...> from the "Active solution configuration" drop-down list
Change the name of the configuration you want to edit and close the Edit Solution Configurations window
In the "Project contexts" section of Configuration Manager, open the "Configuration" drop-down list. You will notice that the configuration which name you've just changed still has it's old one there. Select <Edit...> once again and change it to whatever you did in step 3.
Visual Studio will notify you in an error prompt that "The operation could not be completed". This is (partially) wrong.
Close the prompt, the Configuration Manager and finally close the solution (from the File menu) saving any changes to it.
Re-open the solution.
Go into the Configuration Manager and once again inspect the relevant "Configuration" drop down in the "Project contexts" menu. You will notice that although initially the old configuration name is displayed, the drop down figures only the new one. Select it. Otherwise attempting to access Project Properties will now generate another "The operation could not be completed" error.
The configuration should now function under its new name.

Creating an installer for Visual Studio 2010 solutions (one or more projects)

I ran into some troubles when creating an installer for my Visual Studio 2010 solution (which has multiple projects) so I thought I'd make a quick guide to how I got it working...
Here is how I did it:
Create a new Visual Studio Installer project which is located under
Installed Templates/Other Project Types/Setup and Deployment/Visual Studio Installer.
Make sure you add it to you current solution, you can do this by right clicking on the solution name in the solution explorer and clicking Add>New Project
From there select Setup Wizard, give it a name and click OK
A wizard will open, click Next
then select Create a setup for a Windows application
then click Next again. Select all of the groups you want to include, namely: Content Files, Source Files, Primary Output
Then click Finish
In the solution explorer you will see a bunch of buttons find the one that's tool tip says File System Editor and click it. You will see three folders in the file system editor, the only one we really care about is the Application Folder. That folder is where your projects build output should be.
To add files to it if they are not already there right click > Add > File...
Note: You cannot add entire folders (which sucks) and the folder structure in the Application Folder should be identical to that in your projects build.
You should create each folder and then add the files to it.
If you have multiple projects you should set the build directory to the same folder under the release build settings. To do this, open your solution, and for each project, right click/Properties go to the Compile tab, set it's configuration to Releaseand its Build output path to some folder (same for each project) (If you have an XNA project make sure its Content Build/Configuration is also set to Release).
Now select Release from the drop down menu on the tool bar (it most likely says Debug now)
Right click on your solution on the solution explorer and click Build Solution
Now all of your solutions built files will appear in the folder you chose in the compile tab. All of these files are what needs to be added to the Setup Projects Application Folder (in the same structure)
Customise the installer: click on the project name in the solution explorer and look through it's properties, change what you want (i.e Author, Manufacturer, Title - these make a difference to the installers output directory and text)
Build the installer project (same way as mentioned above) and you are done.
Feel free to comment with questions

Visual Studio 2013: How to copy a project's properties to use in another project?

I tried to copy a project's properties to use in another project as instructed in the stackoverflow question Visual Studio: can I copy a project's properties to use in another project? but it does not work. When I open the created PropertySheet it seems that nothing is copied to it from the original property settings. The above link seems to be for VS 2008 but now I am using 2013. What might be the fault.
Caveat: Tested only on a relatively basic C++ project. But it worked!
Right click on your source project (in the solution explorer)
Unload project
Right click on your destination project and unload that as well.
Right click on each project and Edit {project}.vcxproj. The projects' configuration files can now be edited. (Yes you could also just find the file and edit it directly)
Copy/replace elements from the source to the destination.
Reload both projects. They should reload withut problems.
Tips:
If the reload did not work then copy/replace in pieces instead of the entire project to isolate the problem.
Don't replace the "ItemGroup" and the "Globals" PropertyGroup because these (XML) elements identify the projects in the context of the solution. But you should be able to copy/paste everything below these elements from the source .vcxproj file to the destination one without problems.
Try this on two "empty" projects before proceeding to your magnum opus. And definitely make a backup of your projects before trying this. (you are reading all of this before starting, right? Of course you are...)
This solution works better than others I have seen because it sets and unsets settings completely. It's a total replacement, not just an additive one.

exclude assembly from build

I have a solution file with 10 assemblies. When I build the solution I would like to exclude 5 of them from being built and put in the Release folder. I tried going into the properties of the solution and unticking the assemblies in the Build column in the configuration properties, but this did not work.
If may use Configuration Manager tool of visual studio by write clicking on your solution in VS and selecting Configuration Manager and in active solution configuration combo box selection New
deselecting any project.
More configuration options for this newly created build will be possible by right clicking on each project any selecting properties part and going to Build tab(like output path will be editable)

"Go To Definition" in Visual Studio only brings up the Metadata

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 instead of going to the source.
Some Points:
All the source code is C#, there is no VB.Net
All the projects are in the same solution
Everything is a project reference as opposed to a file reference (checked and double-checked)
I have tried the Clean/Rebuild Solution approach (even to the point of clearing out the Temp directory, Temporary ASP.NET Files directory, etc).
Has anyone else seen this behavior and/or know how to fix it?
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
It happens when you don't add reference as a project but point to a dll or exe using Browse tab in Add Reference dialog. If you add reference using Projects tab you should go directly to the source code when you select Go To Definition.
However, if you install ReSharper, you'll go to source code even if you added your reference to a dll/exe using Browse tab.
Looks like it needs to be setup in Resharper as well. My Visual Studio does not navigate to .NET Framework source code until I enable it in Resharper.
1. close your solution.
2. delete hidden <name of the solution>.suo file in folder where your solution's <name of the solution>.sln file exists.
3. open your solution.
4. rebuild your solution.
For those using VS 2017 (I'm at version 15.3.4 at this moment) here are the simple steps:
Open your solution in Windows Explorer and close down Visual Studio
In the explorer menu, select View and ensure that the "Hidden items" checkbox is marked
Navigate to the subfolder .vs\[your solution name]\v15
Delete the .suo file
Restart VS and build your solution
That fixed it for me: F12 opened the actual source file, not the "from metadata" version.
Visual studio often suffer from a problem of going to metadata rather than your project if you shift location where you are building the project, ie you may have several versions to test things out.
Simply delete the reference and immediately add it back and everything will be sorted out.
The marked solution does not always work. You must make sure that the referenced project GUID in the project files is the correct GUID for the project you are trying to reference. Visual Studio does allow them to get out of synch in some circumstances. You can get the project GUID from the project file with a text editor.
So if project A reference project B. Open up project B.csproj in text editor, copy out project GUID from the tag. Then open up project A.csproj in text editor, and make sure that you are using the correct GUID. Search for project name "B" in this case. It should be at . Replace the GUID in the tag with the correct one. Save and reload.
Of course also make sure file based references to your projects are removed. You only want project references.
I've kill all VS instances, deleted the SUO, launch sln and it worked for me...
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).
#1
Check "View - Object Browser" and if you see more than one assembly with the same name - that's why your getting this error.
For us it was a bug in VS 2019:
If you have ASP.NET "Razor helpers" in App_Code folder the Visual Studio 2019 interprets that as a different assembly but with the same name, that hides the actual assembly.
There's no fix for that other than rewrite those helpers to partial views or HTML helpers (you will have to do that anyway if you plan migrating to .NET Core).
See this workaround on MS's site and please upvote the bug there so MS fixes it
https://developercommunity.visualstudio.com/solutions/1008795/view.html (please upvote)
#2
Another reason why same assembly can be loaded twice in the object browser is if you have a unit-test project that starts iis-express process and never kills it properly.
I figured out how to solve my problem from this post, maybe it will also work for some of you.
I followed these steps:
Close the solution.
Delete the intellisense database file for the solution: .ncb
Open the solution.
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.
In my case, (using Visual Studio Professional 2015), when I had disabled the XAML designer, the F12 stopped working.
As soon as I revert the changes, and restart Visual Studio, the F12 worked again.
Checked the pattern multiple times to confirm and then posted. Hope it helps someone.
Symptom:
Visual Studio 2010 Ultimate was repeatedly failing to find references to functions, #defines, includes, etc when using the "Go To Definition" or "Go To Declaration" or "Find All References" features - oddly Intellisense was working.
Fix:
Close Visual Studio
Delete (rename if you want to be conservative) the solution .sdf file
Reopen Visual Studio
The .sdf file will automatically be rebuilt by parsing the include files in your solution
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!
Just found another cause. I upgraded my web project to 4.0 but left the class libraries at 2.0. At that point all the class libraries in my solution were treated as file references from my web project. Might help someone else...
I faced the same issue and one of colleagues gave me the following solution and it worked!
If none of the above works for you,
Remove all the references and add them back (make sure the path is
correct)
Go to Solution properties, and recheck the Project
Dependencies of all projects. Make sure the project that you'll be
using is added as a dependent in the project that you are working
on.
I did all suggested steps but nothing has been changed then
finally
right click and add reference menu, project tab
simply unselected the reference project.
save the solution.
select the same project.
Rebuild the solution.
Problem sorted. Hope this will help to some one.
Below steps worked for me.
Go to .csproj file
Open it in Notepad Go to line where dll is referred.<Reference Include="">
Delete the line
<SpecificVersion>False</SpecificVersion>
or
<SpecificVersion>True</SpecificVersion>
After deleting dll files from Visual Studio first and adding them back manually from Solution Explorer --> Website --> Add --> Reference and enabling 32-bit Applications in IIS fixed it for me.
VS2017 VB.Net Windows 10 Pro - I use an assembly names "SharedCollection" which includes a VB Module named MyGlobals. One of the globals is a FileVersion. References showed metadata and the Windows Service that referenced it had an outdated setting. I had tried some of the SUO remedies above and none of them worked.
This Worked
I deleted and recreated the project reference for ShareCollection in References.
click on web site menu from VS.
Add reference...
Click on project tab from dialog box
Select ddl
Click on ok button
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.
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.
Revert the CSPROJ to the checked-in version.
Open the CSPROJ via a text editor, NOT VS.
Extract value from the pristine CSPROJ file.
{B1234567-5123-4AAE-FE43-8465767788ED}
Open the SLN file via a text editor, NOT VS.
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
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.
Add the missing GUID as the last entry between ProjectSection and EndProjectSection. The format appears to be per-line, and it is {GUID} = {GUID}.
Save the file.
Open your solution.
Right-click a reference in the newly-added project and "Go to Definition."
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!
This one worked for me:
Right click the dll in the reference folder in your solution
explorer
Remove dll file
Right click the Reference folder, then
Add reference to the dll file again
This can happen if you're trying to jump to the definition in a project that has been unloaded (Unavailable). Right-click the unloaded project and select "Reload Project".
I modified the .csproj file and in the Reference -> HinPath changed obj to bin and it solved the problem.
I had a variation of this issue, where when I loaded my solution my referencing project had errors until I compiled the project it was referencing. At that point the errors disappeared but F12 took me to metadata.
The issue was a dependency in the project being referenced that conflicted with a dependency in the referencing project. I manually removed dependencies from the project being referenced until one of them resolved the errors in the referencing project. After that I was able to F12 to the actual code, and the project would load without errors.
If anyone knows exactly why this happens I'm interested to know in the comments.
This little trick solved it for me - unload the referencing project from the solution and then just reload it
Best guess is that you don't have debug information. Maybe you have multiple copies of your assembly on disk and it doesn't have the .pdb file with it.
Do a search for your assembly names from your projects and delete them all and rebuild.

Resources