Proper steps 'save as' vb2013 solution with another solution name

jana
jana used Ask the Experts™
on
Please advice on the recommended or proper steps to 'save as' vb2013 solution with a new name.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2015

Commented:
I have not worked with VB2013, but in all the previous versions, the way to do this is to first click on the Solution in the Solution Explorer, and you will get the Save As in the File menu.

If you cannot do it in 2013, then it is probably because the thing is still in beta and is not complete.

Author

Commented:
(we meant vb2012)

We assume your meant right-click, because just clicking doesn't do anything.

Here is an image of right-click:

vbsaveas
Most Valuable Expert 2012
Top Expert 2014
Commented:
Create a copy of the solution folder and then follow these steps

http://msdn.microsoft.com/en-us/library/3e92t91t(v=vs.90).aspx
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Author

Commented:
Ok just read it.  So basically is
- create a copy
- open the copy
- rename solution
(In the link has rename solution, project and item)

Should the rename only be on solution.
(We're not in a PC)

Please comment.
Most Valuable Expert 2012
Top Expert 2014

Commented:
That depends on your needs whether you need to just rename solution or project as well. I cannot dictate that.

Author

Commented:
Our need is to save a current solution with another name and another location.

The same exact procedure when we want to save a document for another name.  For example word, if we want to save a document named X as XB but with another location, we can do it as many time as we want.  we can save a word or excel document as many time as we want.

We want or do this in vb 2012.

By what has been said here, is not as simple as word or excel where one just "file >> save as".

This being said, how can we take a solution and save an exact copy but with a different name and another location; also when we open it, we can start working ip with it.


Hope we explained what we want.

Thanx in advance.
Most Valuable Expert 2012
Top Expert 2014

Commented:
Then the steps would be

1) Copy the solution folder and paste in the target location
2) Open solution in VS and right click on it in solution explorer then select Rename.

Author

Commented:
That's it?

What about the forms and all related to solution?
Top Expert 2015
Commented:
Sorry, I have been out of touch for a couple of days.

My answer was OK, I meant a Click, because I was then telling you to go "in the File menu", not in the context menu as you show in your illustration. And it was incomplete because you were talking only about the Save As, not the renaming. Please, try to be precise and complete when you ask a question, you will get your answer faster.

And just to set things straight, the illustration shows that this is not a solution, this is a project.

A solution contains many projects (application, with one or many dlls, with deployment setting, with help system, ect.) and there is only one project there, not a solution.

The Solution Explorer is a little misnamed because it can show a single project even if it is not part of a solution, which is the case according to the illustration.

This difference is minor in the Solution Explorer, but a solution and a project are not the same thing. It's important that you know the difference, because this can be important when you ask a question or when you try to understand the documentation.

CodeCruiser answer will work because replacing "solution" by "project" happened to work in this particular case. But it would have been different if you really had a solution instead of a project, because in such a case, copying and renaming as often not enough.
Top Expert 2015

Commented:
"all related" is quite large and might mean many things for many people.

You can rename any of the code files, as long as you do it with a right click inside of the Solution Explorer (do not do it in Windows Explorer).

As for the name of the forms as used in the code, open the code window for the form, right click on the name of the form in the Class line at the beginning of the form, and activate Rename.

Author

Commented:
I am being precise from the beginning: we want to open a solution and save the entire solution with another name an another folder.  We are not looking to rename a solution.

This being said and all being written in this thread, can we conclude that Visual Basic 2012 does not have a  "save as" (like Word and Excel) in order to save en entire solution with another name and to another folder.

Can somebody tell me if this is a correct assumption?
Top Expert 2015
Commented:
There is a Save As, but as I said in my first post, you first need to LEFT-click on the project (or the solution) in the Solution Explorer, and then  Save name.sln As  or  Save name.vproj As  (depending on whether you are in a solution or a project) will appear in the FILE menu (upper left corner of the screen).

But the same as in Word and Excel, this does not save a directory, it saves only the one file that defines the solution or the project, not all the other files.

This is why CodeCruiser told you that you need to copy the folder first, and then rename the solution with a right click, which does something similar to a Save As because it renames the .sln or .vbproj file underneath.

The fact that you do not have a Save As that can copy all the files as well as the solution is not an overlook by Microsoft. It makes a lot of sense when you think that Visual Studio was created first for professional developers, whose needs can be varied, and when you understand what a solution is.

You have to understand that a solution or a project is just a list of files with a few extra properties saved along them. Open the .vproj or .sln files that you have in your source code directory and you will see what a solution or a project is. It's a list, nothing more. They are similar. It's just that a solution (.sln) is a list of projects with a few files, while a project (.vbproj) is just a list of files. I will stick with project for now on for simplicity and because that is what I think you have from your screenshot. The discussion applies to both.

By default, all the files for a project are in the same directory and its subdirectories, so some consider the directory to be the solution or project. But this is not the case. When developing some types of applications, or complex applications, or when a big team is working on an application, the source code files for the application can reside in many different directories and even different computers.

A project is just a file that lists the files required for the development of the application. When you open that .vbproj file, it presents your all the necessary files in only one place, the Solution Explorer, no matter where they are located physically on your hard drive or in the universe.

As an example, one of the applications that I am working with now has code coming from my main station, a portable and a tablet. I need the main station because this is where my SQL database and the service that access it are located. The portable because it is a Windows 8 application and only my portable has Windows 8 installed. The tablet because this is where the application will run and I thus need to test it with the tablet.

When I open my solution on the portable, the Solution Explorer shows me files from the 3 different computers in only one place. I do not have to take care about where a file is in order to work with it. And I do not have to go back and forth between 3 monitors and/or 3 instances of Visual Studio if I have to work with the 3 parts of the application at the same time, I have everything in one copy of Visual Studio and on the same screen.

You understand that since a Solution can be built that way, a simple Save As is absolutely useless. If you want to move or copy a project's file, you do it manually, open it in its new location, and if needed, you rename things with right clicks in the Solution Explorer.

Not as easy as Save As, but power tools that can do more than simple tools sometimes require a little more elbow grease. If I want to saw a plank with my hand saw, I take the saw and saw. If I want to saw a plank with my table saw, I might need to first change the blade, then adjust the blade height, then adjust the fence and then saw. It ends up being beneficial in the long run, but it can take me 5 minutes to set up while there is no set up at all with the hand saw.

Visual Studio is a very powerful tool.

Author

Commented:
Wow! Great info!  Listen, just to make sure you understand our need, is Solution we want to save in another location and in another folder no Project (we're saying this because in your entry you say you will stick to project for now since that is our screenshot); the screenshot was only for the sole purpose of showing there is a "save as" and that when we click on recent, there is no *.sln display.  So if there is any info missing in your entry becuase you directed to just Project, please comment on missing parts related to Solution.

Thank your very much!
Top Expert 2015
Commented:
Because solutions might be built in different ways, there might be issues that you do not find in a project. Most of the time, copying and renaming is sufficient. But not always. It depends on what kind of projects you have in the solution, where they are located, what dlls they reference, where the copy is made.

I won't be able to cover all the possible scenarios here, there are too many, but I will talk about the 2 most commons. Looking at the beginning of a solution file tells you a lot:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "JBWoodwork", "JBWoodwork.vbproj", "{857D7041-BAAE-4BB8-9361-A9CF10B43881}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "JBLib", "..\JBLib\JBLib.vbproj", "{53924F5B-40F6-493B-8556-DDAF7AE75EA4}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "JBWoodworkLib", "JBWoodworkLib\JBWoodworkLib.vbproj", "{F569C3D7-BC5E-4482-9CBD-1409AB04BCB8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F1B0B69D-49FB-4E23-992C-AB79725B8281}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "JBCalc", "..\JBCalc\JBCalc.vbproj", "{B2B45B39-6F46-4D02-BD9E-874B32146AD2}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "JBWoodworkTest", "JBWoodworkTest\JBWoodworkTest.vbproj", "{B2FA567C-25B6-4DD0-A89A-3032B6E4961C}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "JBWoodworkWCF", "JBWoodworkSvc\JBWoodworkWCF.vbproj", "{15B3E0D2-6217-493A-A690-158C497F5318}"
EndProject

Open in new window

This lists all the projects in the solution, with the directory/file that defines them.

As you can see, the directories are specified to a path that is relative to the .sln file.

When you do not have a directory, the project is in the same directory as the solution. If you have a path without the .., then the project is in a directory that is under the .sln directory.

In the first scenario, if all of your projects are located under the solution directory, then copying the solution directory and its subdirectories somewhere else and renaming the solution is wanted will be sufficient.

The second scenario deals with a solution that would have those directories that begins with .., implying a relative path. These are located somewhere else, so they won't be copied along with the solution. Depending on where you make the copy, the relative paths might not work anymore. When you open the copied solution, you will then end up with projects that cannot be found. In such a case, you can either modify the .sln file manually to recreate proper paths, or work in the Solution Explorer to remove the projects whose link is broken, and add them anew to the solution through the FILE menu.

There might be dozens of other problems however. For instance, if you copy the solution to another computer, some of the dlls referenced might missing or be of the wrong version number. Or if you use stuff that is outside of the computer, such as servers or databases, the new computer might not have the same rights as the original one. These problems must be solved individually as they appear.

Author

Commented:
Read entries and tried various ways based on the thread.  The only way it seems to work is the following:

1. Copy the entire folder solution to the desired folder.
2. Go to the new folder
3. Delete *.suo
4. Rename the Solution sub'Folder to the desired name
5. Edit *.sln and correct the folder line
    Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "xxxx", "YYY\xxxx.vbproj"...
2. Open the Solution at the copied folder.
3. In the Solution Explorer, Right-Click and Rename to the new Solution Name.
4. Exit VS

Done!

Please advice if missing instruction or a better way.

Thanx all!

Author

Commented:
will proceed to close the question.

Author

Commented:
Thanx

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial