[RESOLVED] Can I make the .sdf file subject to project cleaning?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: [RESOLVED] Can I make the .sdf file subject to project cleaning?

Hybrid View

  1. #1
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,594

    [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.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  2. #2
    Join Date
    Apr 1999
    Posts
    3,585

    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.
    Gort...Klaatu, Barada Nikto!

  3. #3
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Can I make the .sdf file subject to project cleaning?

    Quote Originally Posted by Eri523 View Post
    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

  4. #4
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,594

    Re: Can I make the .sdf file subject to project cleaning?

    Quote Originally Posted by Mike Harnad View Post
    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 View Post
    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...
    Last edited by Eri523; May 11th, 2011 at 11:41 PM.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  5. #5
    Join Date
    Apr 1999
    Posts
    3,585

    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.
    Gort...Klaatu, Barada Nikto!

  6. #6
    Join Date
    Jan 2002
    Location
    Houston, TX
    Posts
    1,421

    Re: Can I make the .sdf file subject to project cleaning?

    Quote Originally Posted by Eri523 View Post
    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.
    Be sure to rate those who help!
    -------------------------------------------------------------
    Karl - WK5M
    PP-ASEL-IA (N43CS)
    PGP Key: 0xDB02E193
    PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

  7. #7
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,594

    Re: Can I make the .sdf file subject to project cleaning?

    Quote Originally Posted by Mike Harnad View Post
    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 View Post
    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.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  8. #8
    Join Date
    Jan 2002
    Location
    Houston, TX
    Posts
    1,421

    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.
    Be sure to rate those who help!
    -------------------------------------------------------------
    Karl - WK5M
    PP-ASEL-IA (N43CS)
    PGP Key: 0xDB02E193
    PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center