开发者

Auto version files in VS Custom Build Step

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 proj开发者_开发技巧ects that happen to be in the same directory)?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜