MSBuild.CSharp.DefineConstants 2.0.0.2

dotnet add package MSBuild.CSharp.DefineConstants --version 2.0.0.2                
NuGet\Install-Package MSBuild.CSharp.DefineConstants -Version 2.0.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MSBuild.CSharp.DefineConstants" Version="2.0.0.2">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MSBuild.CSharp.DefineConstants --version 2.0.0.2                
#r "nuget: MSBuild.CSharp.DefineConstants, 2.0.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MSBuild.CSharp.DefineConstants as a Cake Addin
#addin nuget:?package=MSBuild.CSharp.DefineConstants&version=2.0.0.2

// Install MSBuild.CSharp.DefineConstants as a Cake Tool
#tool nuget:?package=MSBuild.CSharp.DefineConstants&version=2.0.0.2                

Helper MSBuild target to generate a C# code file with constants.

Example project file:

  <ItemGroup>
    <PackageReference Include="MSBuild.CSharp.DefineConstants" />
  </ItemGroup>
  <PropertyGroup>
    <CSharpDefineConstantsNamespace>MyNamespace</CSharpDefineConstantsNamespace>
    <CSharpDefineConstantsClassName>MyConstants</CSharpDefineConstantsClassName>
    <CSharpDefineConstantsTargetPath>$(IntermediateOutputPath)MyConstants.cs</CSharpDefineConstantsTargetPath>

    <MyStringArray>val1;val2;val3;;</MyStringArray>
  </PropertyGroup>
  <ItemGroup>
    <CSharpDefineConstants Include="MyStr=some string">
      <Type>String</Type>
    </CSharpDefineConstants>
    <CSharpDefineConstants Include="MyBoolTrue=TrUe">
      <Type>Bool</Type>
    </CSharpDefineConstants>
    <CSharpDefineConstants Include="MyBoolFalse=false">
      <Type>Bool</Type>
    </CSharpDefineConstants>
    <CSharpDefineConstants Include="MyBool0=0">
      <Type>Bool</Type>
    </CSharpDefineConstants>
    <CSharpDefineConstants Include="MyBool8=8">
      <Type>Bool</Type>
    </CSharpDefineConstants>
    <CSharpDefineConstants Include="MyInt14534543=14534543">
      <Type>Int</Type>
    </CSharpDefineConstants>
    <CSharpDefineConstants Include="MyInt_14534543=-14534543">
      <Type>Int</Type>
    </CSharpDefineConstants>
    <CSharpDefineConstants Include="MyStringArray=$(MyStringArray.Replace(';', ';'))">
      <Type>StringArray</Type>
    </CSharpDefineConstants>
  </ItemGroup>
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0.2 2,209 10/4/2023
1.3.0 11,148 5/7/2019
1.2.0 552 5/7/2019
1.1.0 594 5/1/2019
1.0.0 606 4/10/2019