I have 2 different projects in 1 solution but the .sln file is in one of these projects. I want the .sln file to be above them. You will understand better when you see images.
The ss of my solution explorer:
Here you can see there are 2 projects in 1 solution. Also the name of solution and one of my projects is the same here.
Here is the place .sln file is located:
I want this .sln file to be located in here above them:
How do I do that? Thank you, have a nice day
If you have existing solution with projects I think the easiest way would be to select File -> Save *.sln as and select the location you need.
Visual studio will automatically update paths to projects.
I had something like this in the old solution
Project("{FAE04... "ConsoleApp7\ConsoleApp7.csproj", "{E0C7925E..."
The new one has
Project("{FAE04... "ConsoleApp7\ConsoleApp7\ConsoleApp7.csproj", "{E0C7925E..."
Checked for VS 2017 and 2019.
P.S. The solution should be selected in the Solution Explorer, else the "Save *sln as" item doesn't appear(it will suggest to save something else).
The sln file is relatively easy to edit in any text editor.
Close Visual Studio, move the solution to where you want it, then open the solution file in a text editor. Change the references to the proj files so that the relative path is included.
Here is an example from one of mine:
In this case, each of the proj files is in a subfolder and the sln file is in the root directory.
Related
I think this is a known problem with real folders and solution folders in visual studio. I'm facing now the same issue. I got a project handedover from other developer and he already created, directly under the solution some folders and sub folders. All these directories and sub directories are appearing in visual studio solution explorer and also on the file system. As I mentioned, I'm using VS 2015. Here a screenshot:
I have no idea how he did this or if he used any tool for that.
When I try to create a sub folder under SQL-Scripte folder and add some files to it, then the added files are appearing directly under the solution directory. See this screenshot:
Any help is highly appreciated :).
Thanks!
Actually the folders that you create as solution folders, are virtual ones that you cannot see on the file system. To be able to see the folders on both sides (VS and file system), I managed to fix this with the following work around:
1- Create a solution folder (let us name it newSql) under your SQL-Scripte folder
2- Add the files to it.
3- You will notice that the files are located directly under your solution folder in the file system. Exactly as you mentioned in the second screenshot.
4- Now close your visual studio and navigate to your solution directory.
5- Create under the folder SQL-Scripte (on file system), a folder named newSql and copy the files from your solution directory (in your case the SQL file that starts with 1.17....) to this newSql physical system folder.
6- Then open your (.sln) file with Notepad or Notepad++
7- Locate the entry for the new added newSql folder and there change the path to point to your new file system newSql folder. Like this: SQL-Scripte\newSql\1.17.sql
8- Save and again open VS. If you are using TFS then you should right click on the 1.17.sql file and click add to source control and check in.
Like this, you will see the folder on both sides and you can manage it only from VS.
Hope it helps.
Not sure how to describe my question and ok here it goes:
We already have some existing projects created and under TFS source control.
A typical project is then stored locally as:
SomeDir\SomeNameSpace.SomeName\ProjectName\
then the csproj and sln file inside that directory will be named: SomeNameSpace.SomeName.ProjectName
Now when I want to create that same setup using Visual Studio it goes horribly wrong:
I have tried all possible options on creating a project and either it creates an extra SomeNameSpace.SomeName.ProjectName folder extra under the ProjectName directory and puts the sln and csproj inside that dir or I can create a Project under the proper ProjectName dir only then the name of the sln and csproj files will be ProjectName.snl/csproj which is neither what I want.
Renaming them of course would be the logical thing to do, however, doing that causes the sln to go corrupt. When I try to reopen it will throw a Save as DevEnv.sln in my face and that is not what I want.
Edit: Of course I have renamed inside the sln and csproj file which neither led me to the solution
So how can I create a new VS2015 solution that will nicely sit under
\SomeDir\SomeNamespace.SomeName\ProjectName\ with
SomeNameSpace.SomeName.ProjectName.sln and
SomeNameSpace.SomeName.ProjectName.csproj as it's name?
What am I missing, that it seems impossible to achive this in a simple manner?
Create the Project from the New Project VS Window. The settings you need are:
Name: ProjectName
Do NOT create directory for solution
This should create the csproj and sln files in the appropriate directory.
From here, right clic on the project in Solution Explorer -> Rename -> SomeNameSpace.SomeName.ProjectName
This way, the solution reference will be updated too.
Now, rename the solution too, from Solution Explorer.
File menu, Save All. This saves both the project AND the solution.
And I think that's it.
You should in your new project window have it look like this
Please note the highlighted aria is unticked
Ok we have figured it out.
The solution as posted by A. Chiesa was almost right.
The solution, projects and namespaces need to be set.
- Rename the Solution within the "Solution Explorer" for example name it "NameSpace.SomeName.ProjectName"
- Rename the Project within the "Solution Explorer" for example also name it "NameSpace.SomeName.ProjectName"
- Go to the project properties and rename within Application the "Assembly name:" for example also name it "NameSpace.SomeName.ProjectName"
- Go to the project properties and rename within Application the "Default namespace:" for example also name it "NameSpace.SomeName.ProjectName"
Then if you are lucky, you can use Resharper to rename the namespace for all files throughout your project or you have to do it manually (depending on files count can be a very tedious job to do).
That should do it.
Thanks everyone for your input and advice.
Best regard,
Ed
I want to make a backup from the whole project. I also need to rename every backup. I'dont like the way to copy the project folder and rename the folder and the project file.
I've already tried to make it like that:
http://jasonfaulkner.com/VisualStudioExpressProjectBuildBackups.aspx
But it doesn't work, I am always getting the error "Invalid parameters"
Does anyone already tried this?
Thanks
The DPack extension for Visual Studio includes the Solution Backup tool that creates a zip archive of the solution and auto names it.
Manually edit .sln file
This method is entirely aimed at renaming the directory for the project, as viewed in Windows Explorer.
This method does not suffer from the problems in the Remove/add project file method below (references disappearing), but it can result in problems if your project is under source control (see notes below). This is why step 2 (backup) is so important.
1- Close Visual Studio.
2- Create a backup of your .sln file (you can always roll back).
3- Imagine you want to rename directory "Project1" to "Project2".
If not using source control, rename the folder from "Project1" to "Project2" using Windows Explorer.
4- If using source control, rename the folder from "Project1" to "Project2" using the functions supplied by source control. This preserves the history of the file. For example, with TortoiseSVN, right click on the file, select TortoiseSVN .. Rename.
5- In the .sln file, edit all instances of "Project1" to be "Project2", using a text editor like NotePad.
6- Restart Visual Studio, and everything will work as before, but with the project in a different directory.
Alse would recommend TFS, a powerfull tool to do what you pretend. You will be able even to recover previous versions of specific files,if you have any error and you have troubles find it you can see what changes you did since last "check in " etc. There are many options
I'm using Visual Studio 2013 and I have a solution that contains multiple projects.
I would like to extract one project from a solution to create a new, separate solution, that would only contain this one project.
Does anyone know how to do this?
If by "Extract", you mean "Duplicate" your project and start a new solution with this project, here is what you can do:
Create a new solution in Visual Studio
Copy your Project folder in the root of the new solution
Right click on the solution => Add existing Project and select
the project file (*.csproj in this case)
Copy the project folder into separate folder, open the .csproj file, press CTRL + S, it will open the save dialog and you will save the .sln file. That is it.
Right click on any project, then Exclude from Project. The excluded files will be in the project folder. Move those files to another folder, in the way you want it. Then you can create and add those files in new project by Add existing item
I have created a project of Online Book Shop like Flipkart but now I lost my .sln file of this project, it has a database connection so how can I create a new .sln file and run my project??
I tried to make blank .sln file and want to add all files of my project but failed to do that so anyone has a solution share.....
Go to file-> New Project in Visual Studio. Then go to "Other Project Types"-> "Visual Studio Solutions". You should see "Blank Solution". Just create a blank solution. Once you have that right click on the solution and go to "Add"->"Existing Project" and select your projects.
Solutions contains projects. So you have to add projects to a blank solution.
So, first create a new blank solution. Then right click on the solution icon and select Add existing project. Then browse to the project folder and select the .*proj file.
Finally check if any external reference is missing, and add it to the project references.
At this point you should be able to build the solution.