[RESOLVED] Can I make the .sdf file subject to project cleaning?
First, in case this matters (and I'm sure it does ;)), this is about VC++ 2010 (Express).
I noticed that the .sdf file contained in my projects can become pretty fat, particularly if there's an #include <windows.h> somewhere in the project (regardless of whether it's a pure native or an interop project), and that's particularly inconvenient if I want to upload a project to CG. I tried to add this extension to the list of extensions subject to the project cleaning operation but to no avail, probably because this file is located in the solution directory instead of the project directory (or directories).
Can I include that file in the project cleaning operation somehow? Well, it's not too annoying either to delete it manually before zipping and uploading the project, but you know, laziness is one of the natural habits of a programmer... ;)
OTOH, files with the extension .xml are by default subject to cleaning and I consider that dangerous because IMO XML files can very well be part of a project in the role of a sourse file rather than an intermediate or output file. Ok, I can remove this extension manually from the cleaning list of each individual project containing such files, but is there a way to change the default cleaning list for new projects? At least I didn't find one.
Re: Can I make the .sdf file subject to project cleaning?
You might be able to accomplish that by adding a custom build step. I'm not sure what the Express versoin will allow, and, keep in mind, you will be deleting some potentially helpful information that could be used the next time you're working in the same solution.
Re: Can I make the .sdf file subject to project cleaning?
Quote:
Originally Posted by
Eri523
OTOH, files with the extension .xml are by default subject to cleaning and I consider that dangerous because IMO XML files can very well be part of a project in the role of a sourse file rather than an intermediate or output file. Ok, I can remove this extension manually from the cleaning list of each individual project containing such files, but is there a way to change the default cleaning list for new projects? At least I didn't find one.
True, but if the XML files are part of the source, they should be in the source directory, not the object file directory.
Viggy
Re: Can I make the .sdf file subject to project cleaning?
Quote:
Originally Posted by
Mike Harnad
You might be able to accomplish that by adding a custom build step. I'm not sure what the Express versoin will allow, and, keep in mind, you will be deleting some potentially helpful information that could be used the next time you're working in the same solution.
Interesting. So you mean I can turn a custom build step into a "custom destruction step"? And how would I do that (in particular considering the fact that this file in question isn't located in the actual project directory at all)?
I don't care too much about these .sdf files. They appear to exist mainly for convenience respectively IDE processing speedup and will be recreated the next time I work on the project without any action needed to be taken on my part anyway, just taking up some CPU power.
Quote:
Originally Posted by
MrViggy
True, but if the XML files are part of the source, they should be in the source directory, not the object file directory.
So you mean they won't get cleaned if they're located in a (or "the", i.e. SolutionName\ProjectName) source file directory? In that case I actually wouldn't need to worry... :)
Re: Can I make the .sdf file subject to project cleaning?
Custom build steps allow you to apply batch commands to a project or files. For example, we use it to copy target files to another folder.
Re: Can I make the .sdf file subject to project cleaning?
Quote:
Originally Posted by
Eri523
but is there a way to change the default cleaning list for new projects? At least I didn't find one.
Actually, there is a way to do this - but I really don't recommend it. The clean action only deletes files from your intermediate and output folders - not from the project folder, so if you have xml files in the project folder, they won't be deleted.
Having said that, if you REALLY want to remove .xml files from the clean operation on all new projects, you will need to edit the MSBuild configuration file. The file is normally located in the C:\Program Files\MSBuild\Microsoft.Cpp\v4.0 directory (for VS2010) and the file you need to edit is Microsoft.Cpp.props.
There is a line in that file containing ExtensionsToDeleteOnClean - change that line to change your new project defaults.
I would strongly recommend making a backup copy of this file first.
USE AT YOUR OWN RISK!
Hope that helps.
Re: Can I make the .sdf file subject to project cleaning?
Quote:
Originally Posted by
Mike Harnad
Custom
build steps allow you to apply batch commands to a project or files. For example, we use it to copy target files to another folder.
Thanks for the link. That perfectly clarifies what you mean. However, since the .sdf file doesn't seem to be entirely useless, I don't want to delete it during every build of the project. It's just a bit bulky for projects I want to upload to the forum, for instance. That's why I wanted to delete it during the project cleaning operation that I run anyway before uploading a project. Looks like I have to stick with deleting the file manually which isn't really that annoying either.
Quote:
Originally Posted by
krmed
Actually, there is a way to do this - but I really don't recommend it. [...]
[...]
Thanks for the insight into the VS build infrastructure. However, since XML files in source file directories are obviously safe I don't really see a need to apply risky tweaks anymore. (BTW, I found that configuration file at the location you pointed me to and it looks quite interesting. Maybe I'll have some compelling reason to mess around with it in the future, but not now.)
So it starts looking like what I wanted to do is not possible, at least not the way I wanted to do it. However, I learned something from that thread so it hasn't been a complete waste of time. :)
Re: Can I make the .sdf file subject to project cleaning?
You're welcome.
The config files in that folder have a lot of good information. You could even modify them to make your default "output folder", "intermediate folder" or many other items be the way YOU want them.
As always, make a backup if you decide to change any of them, and I'm not sure if this happens, but it's possible that a service pack or secrurity update could replace your modified one with a new one from Microsoft.
Good luck.