Search code examples
wpf.net-6.0csproj

Define variables in csproj SDK style


I have converted a WPF project to the new csproj SDK format. It shows some properties such as:

Company: $(Authors)

Where do I define the variable $(Authors) and similar such variables? I am building my project both locally and in Azure DevOps.


Solution

  • This is MSBuild specific, it does not depend on SDK project style in particular, see:

    Define a tag with the name of the property inside a PropertyGroup.

    <Project Sdk="Microsoft.NET.Sdk">
    
       <!-- ... -->
    
       <PropertyGroup>
          <Authors>John Doe, Jane Doe</Authors>
       </PropertyGroup>
       
       <!-- ... -->
    
    </Project>
    

    Since you refer to a property named Authors, you probably mean a special property that is used for NuGet packaging, see pack target inputs and Package properties.