Search code examples
xamarinvisual-studio-2017

How do I save a solution in Visual Studio 2017


Coming from a Unix background and used to working with the Makefileto build stuff, I now have to find my way through the maze of twisty little passages known as Visual Studio 2017.

Basically: I just want to save a solution that I've imported into Visual Studio 2017 (e.g. to move it to another machine) to some sensible structure. I am unable to figure out how to do that!

The solution I work with comes from GitHub and the package is about 590 Kbyte and consists of 32 files. (I downloaded the .zip and unpacked it, then opened in the IDE by clicking on the .sln-file.

After running it (unchanged) in Visual Studio, it has ballooned to 4 Mbyte and 134 files. Obviously a lot of temporary files has been created as a result of me running it. Making a copy of this bloated directory structure is not practical - and some other way (i.e. the method for saving used by the guy who shared his solution on GitHub) must exist.

I want to save it with all those temporary files removed.

There is Build » Clean Solution – but it does not seem to get get rid of the temporary files.

I've also tried: File » Save all. I do no understand how this commend is supposed to work. It does not ask where to save tings, but just says "Item(s) saved" at the status bar at the bottom of the screen. Looking at things in the file system, I am unable to located anything saved. To me, it looks like this command does nothing.

I've searched, but so far found nothing for Visual Studio 2017 (recipes for older versions does not seem to work anymore.)

Saving a solution is something developers do a lot, so there must be something obvious I've missed.


Solution

  • There is not really the concept of "Save As..." for a solution. If you want to copy the whole solution elsewhere you would usually just copy the whole folder it's in to somewhere else.

    The reasons you have many extra files are:

    • There will be a .git sub-folder which contains the Git repository. If you don't need to retain any link to this, you can delete / avoid copying this. Depending on how much history is in the Git repo this folder can even be much larger than the solution itself.

    • VS will create a .vs sub-folder for various housekeeping activities; you can usually avoid copying this.

    • In each project's folder, after you've built the solution, there will be obj and bin sub-folders. These are recreated as needed at build time and are not needed for a copy.

    If you copy everything ignoring the above, you will probably find the size of the target is more as you were expecting.