MSBuild lets you set properties on the command line by using the -property (or -p) switch. These global property values override property values that are set in the project file. This includes environment properties, but does not include reserved properties, which cannot be changed.
For example, the path to MSBuild.exe installed with Visual Studio 2019 Community is C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe You can also use the following PowerShell module to locate MSBuild: vssetup. powershell.
In Visual Studio 2019 right-click your project, choose Properties . In the project properties window, select the Debug tab. Then, under Environment variables change the value of your environment from Development to Production or other environments.
In Visual Studio, we can set ASPNETCORE_ENVIRONMENT in the debug tab of project properties. Open project properties by right clicking on the project in the solution explorer and select Properties. This will open properties page. Click on Debug tab and you will see Environment Variables as shown below.
Comprehensive lists from Microsoft Docs (New Docs):
Comprehensive lists from MSDN (Legacy Docs):
Other useful lists:
First link shows the MSBuild property for project name:
MSBuildProjectName The file name of the project file without the file name extension
http://msdn.microsoft.com/en-us/library/c02as0cs(loband).aspx
These properties can also be defined by 3rd-party tools so to get the complete list I just use (in a C++ project for example): Properties -> Configuration Properties -> General -> then on the Output or Intermediate Directory drop down choose Edit... and you should see a list of all defined properties.
This seems like a pretty thorough list: Common macros for MSBuild commands and properties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With