Jump to content

Generate compressed RTF file in Visual Studio project when file is modified?


MJW

Recommended Posts

I include my Help files in the DLL as resources. I'd like to follow CodeLab's lead and compress the RTF file in ZIP format or BoltBait's RTZ format. Either will do. I want the RTF file to be automatically compressed upon building whenever the RTF file has been modified. If anyone knows how to do this in Visual Studio, I'd very much appreciate instructions.

 

(This is probably something I could figure out by reading enough MS documentation, but I'm hoping someone knows if it can be done, and if so how to do it, so I dont have to spend my time reading MS's (often infuriating) documentation. (Can anyone describe things more indirectly than Microsoft?))

 

Link to comment
Share on other sites

What you are asking for is not too hard.

 

  1. Open your project in visual studio.
     
  2. Right-click on your project and choose "Open folder in file explorer"
    OpenFolder.png
     
  3. Put this copy of "Compress.exe" into that folder.
         CompressV2.zip
    This build of "Compress" allows command line compressing.
     
  4. In visual studio, open your project properties screen and choose "Build events"
    CompressEvent.png
     
  5. In the "Pre-build event" section, place the following DOS commands:

         cd $(ProjectDir)
         compress help.rtf

    This will compress "help.rtf" into "help.rtfz" before the build begins.  As long as you have "help.rtfz" included in the project as an "embedded resource" everything should work fine.
  • Upvote 2
Link to comment
Share on other sites

Thank you very much BoltBait. I do have a concern, though. I'd prefer that compression only occur when the RTF file has changed. If I make it a pre-build event, won't it be done for every build? (I suppose I could live with that, but I rather not do it each build.)

Link to comment
Share on other sites

I know it's a silly thing to worry about, and if I have to do it every build I will. I'm still curious about whether I can compress the file only when it changes. Back in the days of Makefiles, that would have been easy to achieve.

Link to comment
Share on other sites

  • toe_head2001 changed the title to Generate compressed RTF file in Visual Studio project when file is modified?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...