Khanzor
Khanzor

Reputation: 5010

List of MSBuild built-in variables

How can I get a list of built-in MSBuild variables?

I need to know how to determine the current project's csproj name, and thought it might be useful to know what else I can find out in MSBuild.

Upvotes: 204

Views: 131796

Answers (6)

si618
si618

Reputation: 16858

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

Upvotes: 271

ckkkitty
ckkkitty

Reputation: 165

There are also Agent and Build predefined variables for pipelines: https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml. These are the variables I was looking for when I came across this article, so I thought I'd pass the link along when I finally found them.

Upvotes: 2

JonathonW
JonathonW

Reputation: 867

This seems like a pretty thorough list: Common macros for MSBuild commands and properties

Upvotes: 6

SoftwareCarpenter
SoftwareCarpenter

Reputation: 3923

I would also include a list of List of Common Properties and Parameters for MSBuild.

Also, the properties depend on which version of MSBuild you are using. There are 3 versions.

Upvotes: 1

user2189331
user2189331

Reputation:

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.

Upvotes: 4

Related Questions