Visual Studio 2017 - User Macro for Build Event

750 Views Asked by At

I cannot find any option to add custom Macros (for Build Events). I am in a .Net environment and its about Visual Studio 2017.

I want to define a "var" which can be used both in the Build Events $(myVar) and in Code. Is this even possible?

1

There are 1 best solutions below

0
SLaks On

You can define a pre-build event that generates a C# file (using echo ... > file.cs) that declares a class with a constant.

You would define the variable as an MSBuild variable in a tag in the project file.