0

This related question deals with the retrieval of an app's build date in C#, but there's gotta be a more efficient way to do it. So here's a little idea I had...

Does Visual C# have a compiler macro that will insert the build date on a given position when the project is being compiled? It would be nice if the compiler could auto-generate the build date that will be displayed in my app's About screen. After all, having to change the date manually every time is a pain in the neck.

Community
  • 1
  • 1
Pieter
  • 31,619
  • 76
  • 167
  • 242
  • 1
    What's wrong with the "the old way" in your 'related question' link? It's built into Visual C#, works fine, takes 3 lines of code, and is dead easy to do. – Jason Williams Nov 10 '10 at 20:27
  • Three lines of code? The accepted answer is about twenty lines of code. Not too efficient considering that if all that could potentially be replaced by a macro that apparently doesn't exist. – Pieter Nov 11 '10 at 09:27

1 Answers1

0

I think no.
Here is the list of c# preprocessor directives: http://msdn.microsoft.com/en-us/library/ed8yd1ha(vs.71).aspx

We are using msbuild with generate assemblyinfo task for such a thing. it is easy and works like a charm.

PS
Also you can modify project file *.proj and add this custom task into it.

Sergey Mirvoda
  • 3,209
  • 2
  • 26
  • 30