Question

I want to do two things in a custom build step (pre build) but my batch file skills are a little rusty to say the least so am having a little trouble figuring it out!

I need to:

  • Find all resource files and update the version to 1.0.[CustomDateFormat].[BuildOfday]
  • Copy this version number into a HTML file

Will I have to write a separate program to do this then run it from the custom build process or is there another way?

Also, if I were to use a separate program how would I pass in information about the projects loaded in the solution (so I don't go off versioning unrelated projects that happen to be in the same directory)?

Was it helpful?

Solution

I'd recommend using PowerShell for file manipulation.

The easiest way to find resource files is by project directory (use $(ProjectDir) macro). However, if you really have such a situation, where you have several projects in the same folder, you will have problems to figure out which resource files belong to which project. My first recommendation would be to split projects into their own folders.

If that's not option (do you know that it's possible to add file as a link?), maybe your PowerShell script can find resource files based on project name. Otherwise I don't have a better idea than manually parsing .csproj file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top