Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Tool for shrinking Visual C++ projects


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Serapth   Members   -  Reputation: 3279

Like
0Likes
Like

Posted 25 August 2011 - 08:38 PM

Recently I've been zipping/sharing/backing up a number of Visual C++ projects and I noticed unlike other Visual Studio projects the bloat is somewhat obscene. Intellisense and precompiled header files alone can cause your folder to grow by an order of magnitude. A folder that would zip up to under a meg was taking over 100! Even worse, most of these files are generated automatically on start or at compile time, so every time I wanted to share a change, or push a backup to my Dropbox folder I had to take the manual task of deleting all this crap again.


So anyways, long story short, I got sick of it and wrote a simple tool that does it for me. I am just throwing it out there in case anyone is interested you can download the app ( and source code) here. It's written in C# and compiled against .NET 4.0, but I don't think I do anything that wouldn't compile on .NET 1.1 or Mono if you dont have .net 4 runtimes installed.


Of course, all these temporary files do something and there is a cost for deleting them. First off, they need to rebuild the next time you open or compile your project, so its obviously going to be slower the next time you start up. That said, my savings in time from copying backups more than makes up for this penalty! Not to mention my poor Dropbox account is bulging at its 2GB seams!


Anyways, if you find yourself in the same boat, I hope I have saved you a small bit of time.

Ad:

#2 fastcall22   Members   -  Reputation: 1868

Like
0Likes
Like

Posted 26 August 2011 - 12:13 AM

Windows Powershell! :D

get-childitem -path . -recurse -include ("*.ilk", "*.pdb", "*.sdf", "*.suo", "*.vcxproj.user", "Debug", "Release", "ipch") | foreach-object -process { remove-item $_ }

Of course you can get fancy with reading the project name and parsing the vcxproj to find what configurations it has and what-not ...
Or you could use the "Clean solution" under "Build" in Visual Studio ...

#3 Codarki   Members   -  Reputation: 463

Like
0Likes
Like

Posted 26 August 2011 - 01:57 AM

I usually just do Build -> Batch Build... -> Select All -> Clean.

#4 Slavik81   Members   -  Reputation: 360

Like
0Likes
Like

Posted 26 August 2011 - 02:47 AM

I don't think clean removes the intellisense archive, though. At least, a simple build->clean won't.

Personally, I just use a file extension exclusion list in my mercurial configuration for the project. Most version control software handles this sort of thing pretty well.

Though, I found it was a little more complicated to set up a dedicated version control solution than just installing dropbox + 7zip.

#5 Serapth   Members   -  Reputation: 3279

Like
0Likes
Like

Posted 26 August 2011 - 06:26 AM

As Slavik81 said, build clean wont touch the intellisense files although it will accomplish most of the same task. Perhaps more important ( with my primary audience ), in it's infinite wisdom, Microsoft did not include Build->Clean in Visual C++ Express.

That said, the same thing could be built with relative ease in Powershell, then again, Powershell can be pretty much considered a first class langauge these days, so just about anything could be created in powershell.

#6 jwezorek   Crossbones+   -  Reputation: 1328

Like
1Likes
Like

Posted 27 August 2011 - 05:31 AM

Recently I've been zipping/sharing/backing up a number of Visual C++ projects and I noticed unlike other Visual Studio projects the bloat is somewhat obscene. Intellisense and precompiled header files alone can cause your folder to grow by an order of magnitude.

So delete them.

#7 Serapth   Members   -  Reputation: 3279

Like
0Likes
Like

Posted 28 August 2011 - 02:34 PM


Recently I've been zipping/sharing/backing up a number of Visual C++ projects and I noticed unlike other Visual Studio projects the bloat is somewhat obscene. Intellisense and precompiled header files alone can cause your folder to grow by an order of magnitude.

So delete them.


... well, that's what the tool does, it deletes the crap for me. Granted, its a 2 minute job, but a 2 minute job I have had to perform 40 or 50 times thus far since writing the tool.

#8 Sirisian   Members   -  Reputation: 1281

Like
0Likes
Like

Posted 28 August 2011 - 02:40 PM

If you store your projects in a version control system you normally don't include extra stuff like bin and obj and those extra files. Then people can just pull a cleaned version magically after you commit changes.

#9 Serapth   Members   -  Reputation: 3279

Like
0Likes
Like

Posted 28 August 2011 - 05:02 PM

If you store your projects in a version control system you normally don't include extra stuff like bin and obj and those extra files. Then people can just pull a cleaned version magically after you commit changes.


True, but this isn't exactly massive projects I am dealing with. These are short one offs and tutorials.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS