Posts

Showing posts with the label visual-studio

Version your Visual Studio Builds by Git Commit Hash

Image
Semantic versioning is great, but more often than not, when I'm looking at a folder of deployed binaries, I want to know the git commithash of the source code that was used to generate them (a versioned container might be better in some cases, but that's not applicable in every situation at the moment).

A simple way to accomplish this is to generate a "version.txt" file at build time that will eventually be deployed with the code. Visual Studio makes it pretty easy to automatically generate this version.txt file with it's built in "build events". Simply add the following line to the "Post-build event command line:" textbox, and a version.txt file will appear in your build output directory with the current commit hash after a successful build.

"C:\Program Files\Git\bin\git.exe" rev-parse HEAD > "$(ProjectDir)$(OutDir)version.txt"




If you'd like to generate this file after an Azure Kudu deployment, see here: https://aaro…

Get Line Numbers In Exception Stack Trace

Image
If you want to ensure you get line numbers in your Exception Stack Trace, you need to make sure your project is set up to provide "full" debug info on build. By default, for "Release" configuration, this is set to "pdb-only".

Steps to enable:

In Visual Studio...

1. Ensure your project is set to "Release" Solution Configuration (or whichever config you use for deployments)

2. Go to Project > Properties > Build

3. Click the Advanced Button in the bottom right.

4. Under Output > "Debug Info", choose "full" from the dropdown.

5. Save all settings and build your project. You will now see line numbers in Exception Stack Traces.


Hope this helps,
Aaron