I have a major problem with project configurations. Everything started when I wanted to add new solution configuration (named "Dev_WithSource") based on existing "Debug" configuration and checked "Create project configurations". For some reason project configurations were registered inside sln file, properly showing in Configuration manager, but "PropertyGroup Condition" blocks in csproj files weren't created. That resulted in "OutputPath not set ..." error.
So, I tried to repeat whole procedure. After deleting all lines mentioning "Dev_WithSource" from sln file, "Dev_WithSource" project configurations are still showing in configuration manager. I searched all csproj and sln file in my solution. Neither of them contain text "Dev_WithSource".
After all that I event tried developing add-in. I can fetch phantom configurations with project.ConfigurationManager.ConfigurationRowNames but I also can't delete them.
Am I missing something? Are those configurations stored in some other files and not csproj/sln?
Thanks.
Access the configuration manager in one of two ways:
From the menus on top: Build > Configuration Manager...
From the drop down listing your configurations on the main tool bar select Configuration Manager...
In the configuration manager dialog under Active solution configuration: choose <Edit...> from the drop down.
A dialog opens showing all the configurations for your solution. Here you can select and click the Remove button.
Right-click->Unload your project with the configurations you want to remove.
Right-click->Edit project file xml directly.
Delete the Property groups containing conditions containing the name of the platforms/configurations you wish gone.
Save and load project again. Unwanted configurations should be gone.
If a configuration seems set up right but OutPutPath is still "not set", try moving its propertygroup tag up in the xml.
Let's suppose you want to remove "Release" configuration from the entire solution and the projects. So, first you go to Tools -> Nuget Package Manager -> Package Manager Console.
Copy and past the following command in the console to remove the build from all the projects. You may want to replace "Release" with the configuration name you wish to delete.
Get-Project -All | Foreach { $_.ConfigurationMAnager.DeleteConfigurationRow("Release") }
Finally, remove the configuration solution-wise as explained by Mike Grimm's answer.
I know this is an old thread, but this was the answer for me:
In the Configuration Manager, select "Edit..." in the "Configuration" column for each project (not via the dropdown named Active solution configuration) that has configurations you want to remove.
In the dialog that pops up, mark each unwanted configuration and select "Remove".
Copied from How do I remove a project configuration in Visual Studio 2008?
You need to remove the configuration from the solution AND the project. From the Configuration Manager:
Active solution configuration > Edit > Remove
Project contexts > Configuration > Edit > Remove
I solved this with utility which parses csproj files and inserts necessary propertygroup blocks into csproj files. Old project configurations still appear in configuration manager but I gave up trying to delete them.
In my case the issue was that the solution file was not in the same folder as project file so I had to copy the nuget folder into the solution folder to resolve this issue.
In Visual Studio for MAC -
Double click your Solution > Configurations > General.
Click on your 'ConfigToRemove' in the list then Remove (Ensure you tick delete also Configurations in Solution items), then Yes.
Click OK to save your changes.
Now, right Click on Solution and Tools > Edit File.
Go to "GlobalSection(SolutionConfigurationPlatforms) = preSolution" and remove all the Configurations you no longer need otherwise they will still show up in Configuration Mappings even though there are no mappings in the project!
Save and your done.
I know I am bit Late but here is complete solution.
To remove configuration completely from solution and project property then open .sln file in any IDE as Plain text and delete all information regarding the configuration.
NOTE- don't delete GUID values and debug/release configurations
Then open .vcxproj file in XML format and delete all information regarding the configuration. This includes fundamental property for it, Platform Toolset and Assosiated property elements in XML language.
NOTE- make sure to delete end tags.
when you go back to visual studio, click replace all and you are good to go.
Related
I have a solution with 4 projects in it. I wish to start them all.
For example, I had somebody new clone by work. This means that startup projects wouldn't be configured. However what I want is a file that defines what startup projects should be set when you run for the first time.
From what I found this information is written by Visual Studio to *.suo file in .vs directory that Visual uses to store some user solution settings and options.
Maybe you could develop Visual Studio extension that could persist selection of start up project. You can find some information here.
More about .suo file in this SO post.
Solution explorer > "yourcoolprojectname" right click> properties> common properties> multiple startup project> choose projects
Since a few days, I'm having strange behavior, when I want to debug a project:
It always opens the connection properties window, although I have no database connection set up in that project.
Maybe this problem occurs because I set up another project with azure?
Does anyone know how to fix this?
Thanks,
Dennis
You can try to exclude the file from your project.
Try this:
To temporarily exclude an item that represents a file
--> In Solution Explorer, select the item you want to exclude.
--> On the Project menu, select Exclude From Project.
In your project open up the Properties tab, and there probably is a Publishprofiles folder. Delete it. Afterwards, open up the Web.config file in the project. See if there is any <connectionString> tag and delete them all if you dont have database connections.
I see how to update the registry manually, by right-clicking on the project, select View, then Registry, but I have alot of registry changes that I need to incorporate into my setup project, and I've already exported each of them to a *.reg file. I don't want to have to go through and add each of them for the setup project manually again.
How can I add my *.reg registry files into the setup project?
As noted in the comment, right-click the "Registry on Target Machine" root node and click Import. It will ask for a .reg file. And will populate the tree with what it found in the .reg file. Just repeat this if you have more than one .reg file.
The Setup project designer doesn't exactly have the most discoverable user interface. It uses right-click context menus a lot and commands are scattered between context menus, regular menus and buttons. So if you are looking for a feature that you think ought to be there then some wishful left and right-clicking on UI widgets can help you get lucky. Spending ten Friday afternoon minutes clicking away is advisable. Note that it was removed from VS2012 and won't come back, it is still available in the gallery.
Just right click the project and add the file to your setup project. Have your application go through the .reg file on first run to make sure the registry is properly set up.
You may add or update your .reg files programatically. Let's say, for example, that you may want to merge a given file.reg to your registry:
Process _re = Process.Start("regedit.exe", "/s file.reg");
_re.WaitForExit();
(Just keep in mind that newer Windows versions use Unicode instead of ANSI when creating/consuming .reg files.)
When I am compiling my .csproj file using .NET Framework 4.0 MSBUILD.EXE file, I am getting an error: "lable01" not found in the current context of "website01.csproj".
Actually, I need to add every ASP.NET page with its code-behind file's reference. I've done it, it's working fine, but the above error is pending.
I hope it means that I need to add form name "LABLE01" in that .csproj file, but I do not know the syntax. Anybody please do provide me with the syntax to add form name in .csproj file.
The CSPROJ file, saved in XML format, stores all the references for your project including your compilation options. There is also an SLN file, which stores information about projects that make up your solution.
If you are using Visual Studio and you have the need to view or edit your CSPROJ file, while in Visual Studio, you can do so by following these simple steps:
Right-click on your project in solution explorer and select Unload Project
Right-click on the project (tagged as unavailable in solution explorer) and click "Edit yourproj.csproj". This will open up your CSPROJ file for editing.
After making the changes you want, save, and close the file. Right-click again on the node and choose Reload Project when done.
Since the question is not directly mentioning Visual Studio, I will post how to do this in JetBrains Rider.
From context menu
Right-click your project
Go to edit
Edit '{project-name.csproj}'
With shortcut
Select project
Press F4
You can right click the project file, select "Unload project" then you can open the file directly for editing by selecting "Edit project name.csproj".
You will have to load the project back after you have saved your changes in order for it to compile.
See How to: Unload and Reload Projects on MSDN.
Since project files are XML files, you can also simply edit them using any text editor that supports Unicode (notepad, notepad++ etc...)
However, I would be very reluctant to edit these files by hand - use the Solution explorer for this if at all possible. If you have errors and you know how to fix them manually, go ahead, but be aware that you can completely ruin the project file if you don't know exactly what you are doing.
There is an easier way so you don't have to unload the project. Just install this tool called EditProj in Visual Studio:
https://marketplace.visualstudio.com/items?itemName=EdMunoz.EditProj
Then right click edit you will have a new menu item Edit Project File :)
in vs 2019 Version 16.8.2
right click on you project name
and click on "Edit Project File"
Here is my option to Edit the project file without the need to Unload the project:
Open Solution Explorer and switch to folder view:
Navigate to the Project which you want to edit inside the Solution folders and right-click on it.
Choose Open from the Context Menu.
That is it!
You will see the *.csproj file opened inside Visual Studio Editor.
After you can switch back to a Solution/Project view (see step 1).
Update:
Starting from the Visual Studio 2019 (v. 16) you can edit the *.csproj file by double-clicking on the Project, just make sure that you have the option turned On from the settings.
For JetBrains Rider:
First Option
Unload Project
Double click the unloaded project
Second option:
Click on the project
Press F4
That's it!
Sorry, most efficient way with out stuffing your proj file is.
right click the file.
goto properties
where Build Action option is set it to NONE.
Do a build (yes you may get build error if you do even better)
go back to properties of that file
set Build Action option is set it back to Compile.
rebuild.
Congratulate your self for being smarter than everyone else and not ****ing you project. For me this exercise took under 10 seconds. Where as manually trying to input the compile... line into the csproj not only can render your project unusable but it is also impossible to maintain on large scale application. Better to keep source version control software to do the updates. If you need to cross merge branches then doing the above is amazing :).
To open the .csproj file:
open the solution explorer
1
Click on the Edit Project File option
2
You can also open the .csproj by double-clicking on the project file. So no need to right click and select edit project file. Just double click and that is it.
It is a built-in option .Net core and .Net standard projects
For Visual Studio-version: 8.1.5,
Right click on the project folder.
Click "Tools", then "Edit File".
A little late to the conversation but I found a better option.
In rider you can enable "open project files with single click"
Just go to the solution options menu and then click in open project files with single click
It seems like this setting should be stored in the solution file so it's shared across all users and part of source code control. Since we don't check in the suo file, each user has to set this separately which seems strange.
It is absolutely necessary that everyone can define their StartUp Project themselves, as Jon has already said. But to have a dedicated default one would be great, and as I can tell, it is possible!
If you don’t have a .suo file in your solution directory, Visual Studio picks the first project in your .sln file as the default startup project.
Close your Visual Studio and open the .sln file in your favorite text editor. Starting in line 4, you see all your projects encapsulated in Project – EndProject lines.
Cut and paste the desired default startup project to the top position.
Delete your .suo file.
Open your solution in Visual Studio. Ta daa!
In most cases, it does make sense to have a default on this.
It would be much better to accommodate a default startup project and store this in the .sln file, but which can be overridden by a developer in their .suo file. If the startup setting isn’t found in the .suo file, the default startup project in the .sln would be used.
Actually, this has been suggested on Visual Studio’s UserVoice.
Why should it be a non-user-specific preference?
If I've got a solution with 10 files in, and one developer is primarily testing/using one of those tools, why should that affect what I start up?
I think MS made the right choice on this one. The project I want to start is far from necessarily the project that other developers want to start.
I wrote a little command line utility for Windows called slnStartupProject to set the Startup Project automatically:
slnStartupProject slnFilename projectName
I personally use it to set the startup project after generating the solution with cmake that always sets a dummy ALL_BUILD project as the first project in the solution.
The source is on GitHub. Forks and feedback are welcome.
If you are using GIT, you can commit the default SUO file and then mark it as unchanged using
git update-index --assume-unchanged YourSolution.suo
It works also if you want to have more than one project in your default start group. The only disadvantage that I know about is that this command must be run by everyone who don't want to commit the SUO file.