Reputation: 1726
I need to retrieve a number version from database to add this as dll version.
I can add manually this version each time I publish, but I'll like to run this in an automatic process. So, is it possible at compile time to execute a SQL or any operation to get this number ?
Thanks for your help.
Upvotes: 2
Views: 190
Reputation: 15958
is it possible at compile time to execute a SQL or any operation
to get this number
No you cannot call SQL at compile time. Compiling is purely for creating MSIL (dll or exe) to be executed later by the CLR. All work is performed by the JIT compiler of the CLR (which is at runtime). No work can be done at compile time.
However, you could add a pre build event (that would happen before the compilation), which gets data and writes it into a config file. The app can read the version number from here.
Upvotes: 1
Reputation: 78995
You could write a small simple application (command line) that looks up the version or build number and replaces it in the appropriate file.
Then you could add it as a pre-build event to your Visual Studio project.
Upvotes: 4