Black.Beard.Build 1.0.73

There is a newer version of this package available.
See the version list below for details.
dotnet add package Black.Beard.Build --version 1.0.73
                    
NuGet\Install-Package Black.Beard.Build -Version 1.0.73
                    
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="Black.Beard.Build" Version="1.0.73" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Black.Beard.Build" Version="1.0.73" />
                    
Directory.Packages.props
<PackageReference Include="Black.Beard.Build" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Black.Beard.Build --version 1.0.73
                    
#r "nuget: Black.Beard.Build, 1.0.73"
                    
#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.
#:package Black.Beard.Build@1.0.73
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Black.Beard.Build&version=1.0.73
                    
Install as a Cake Addin
#tool nuget:?package=Black.Beard.Build&version=1.0.73
                    
Install as a Cake Tool

Black.Beard.Roslyn

Build status

Helpers for compile Csharp with Roslyn. The way use the tool installed on your machine. It does'nt work if dotnet is not installed.

Sample the use Black.Beard.Build for create a csproj


    //Usings
    using Bb.Build;
    using System;
    using System.IO;

    // create a folder for store the generated project file
    var name = "Black.Beard.tests";
    var dir = new DirectoryInfo(Path.Combine(this._baseDirectory.FullName, name));

    var project = MsProjectsForBuild
                    .CreateProject((name, dir)        
                    .Sdk(ProjectSdk.MicrosoftNETSdk)    // Specify the target build

                    .SetPropertyGroup(c =>              // set the properies of the build
                    {
                        c.TargetFramework(TargetFramework.Net6)
                         .RootNamespace("Bb")
                         .Description("My description")
                         .RepositoryUrl(new System.Uri("http://github.com"))
                        ;
                    })

                    .Packages(p =>                      // Reference packages
                    {
                        p.PackageReference("Black.Beard.ComponentModel", new Version("1.0.36"))
                         .PackageReference("Black.Beard.Helpers.ContentLoaders", new Version("1.0.8"))
                        ;

                    });

    // Build
    var result = project.Build(inMemory: true, load: true);

    // fetch the new assembly
    var assembly = project.Assembly;

or the helper


    var project = MsProjects.CreateCsProject(dir.FullName, name, 
    TargetFramework.Net6, 
    "Bb"                
    )
    .SetPropertyGroup(a =>
    {
        a.Description("MyDescription");
    })
    .Packages(p =>
    {
        p.PackageReference("Black.Beard.ComponentModel", new Version("1.0.36"))
         .PackageReference("Black.Beard.Helpers.ContentLoaders", new Version("1.0.8"))
        ;
    
    });

This way use Roslyn for generate the assembly


    // Use NJsonSchema for generate json schema
    JsonSchema schema = JsonSchema.FromType(typeof(Sample1));

    // Helper for manipulate codeDom object
    var samples = "CodeDOMSample".ToNamespace()
        .Import("System")       // append usings

        .AppendPoco(schema)     // add a poco class from schema

        .ToCSharp(Path.Combine(_dir.FullName, "class1.cs")) // Generate csharp code
        ;

    // compile
    AssemblyResult assembly = GetCsharpBuilder(samples.FullName);

    // consumme the result assembly
    if (assembly.Success)
    {
        var ass = assembly.LoadAssembly();
        var type = ass.GetTypes().First(c => c.Name == "Sample1");
        Assert.NotNull(type);
    
        var property = type.GetProperties().FirstOrDefault(c => nameof(Sample1.Name) == c.Name);
        Assert.NotNull(property);
    
    }
    else
    {
        var payload = File.ReadAllText(samples.FullName);
        throw new Exception();
    }


    private static Bb.Compilers.AssemblyResult GetCsharpBuilder(string filepathCode)
    {

        var fileInfo = new FileInfo(filepathCode);

        // Build assembly

        Action<CSharpCompilationOptions> action = (r) =>
        {

        };

        BuildCSharp builder = new BuildCSharp()
        {
            ResolveAssembliesInCode = true,
            Debug = true,
            LanguageVersion = LanguageVersion.CSharp7,
        }
        .AddSource(fileInfo)
        .Suppress("CS1702", "CS1998")
        ;

        // System.Collections
        builder.References.AddRange(
            typeof(object),
            typeof(RequiredAttribute)
        );

        var assembly = builder.Build();
        return assembly;

    }        




var builder = ProjectRoslynBuilderHelper.CreateCsharpBuild("project.csproj", true);
    var result = builder.Build();

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.140 252 4/14/2025
1.0.138 239 4/14/2025
1.0.137 210 4/3/2025
1.0.136 198 4/1/2025
1.0.135 202 4/1/2025
1.0.134 200 4/1/2025
1.0.133 151 1/27/2025
1.0.132 173 12/21/2024
1.0.131 154 12/7/2024
1.0.130 153 11/27/2024
1.0.129 160 11/24/2024
1.0.128 139 11/19/2024
1.0.127 150 11/19/2024
1.0.126 153 11/18/2024
1.0.125 143 11/17/2024
1.0.124 154 11/17/2024
1.0.123 150 11/17/2024
1.0.122 144 11/17/2024
1.0.121 149 11/17/2024
1.0.120 148 10/28/2024
1.0.119 174 5/3/2024
1.0.118 165 5/2/2024
1.0.117 200 4/7/2024
1.0.116 162 4/6/2024
1.0.115 183 4/6/2024
1.0.114 197 4/3/2024
1.0.113 180 3/31/2024
1.0.112 202 3/19/2024
1.0.111 193 3/16/2024
1.0.110 197 3/16/2024
1.0.109 187 3/15/2024
1.0.108 200 3/13/2024
1.0.107 195 3/12/2024
1.0.106 171 3/9/2024
1.0.105 181 3/6/2024
1.0.104 193 3/5/2024
1.0.103 188 3/4/2024
1.0.102 176 3/4/2024
1.0.101 181 3/4/2024
1.0.100 184 3/4/2024
1.0.99 196 3/3/2024
1.0.98 176 2/29/2024
1.0.97 168 2/29/2024
1.0.96 187 2/29/2024
1.0.95 188 2/27/2024
1.0.94 178 2/26/2024
1.0.93 190 2/25/2024
1.0.92 191 2/24/2024
1.0.91 205 2/24/2024
1.0.90 184 2/24/2024
1.0.89 200 2/24/2024
1.0.88 181 2/24/2024
1.0.87 195 2/23/2024
1.0.86 188 2/23/2024
1.0.85 188 2/23/2024
1.0.84 189 2/23/2024
1.0.83 203 2/23/2024
1.0.82 191 2/23/2024
1.0.81 196 2/22/2024
1.0.80 188 2/22/2024
1.0.79 176 2/22/2024
1.0.78 176 2/22/2024
1.0.77 199 2/21/2024
1.0.76 185 2/19/2024
1.0.75 178 2/19/2024
1.0.74 180 2/18/2024
1.0.73 181 2/17/2024
1.0.72 281 12/12/2023
1.0.70 242 10/17/2023
1.0.69 190 10/17/2023
1.0.68 207 10/17/2023
1.0.67 210 10/16/2023
1.0.66 200 10/16/2023
1.0.65 198 10/13/2023
1.0.64 188 10/10/2023
1.0.63 196 9/13/2023
1.0.62 225 7/31/2023
1.0.61 223 7/28/2023
1.0.60 216 7/28/2023
1.0.59 227 7/28/2023
1.0.58 229 7/28/2023
1.0.57 249 7/28/2023
1.0.56 217 7/27/2023
1.0.55 231 7/27/2023
1.0.54 255 7/27/2023
1.0.53 233 7/27/2023
1.0.52 256 7/27/2023
1.0.51 254 7/25/2023
1.0.50 251 7/25/2023
1.0.49 265 7/4/2023
1.0.48 262 6/30/2023
1.0.47 241 6/30/2023
1.0.45 268 6/17/2023
1.0.44 254 6/17/2023
1.0.43 265 6/17/2023
1.0.42 281 6/6/2023
1.0.41 264 6/5/2023
1.0.40 263 6/5/2023
1.0.39 249 6/5/2023
1.0.38 266 5/31/2023
1.0.37 257 5/30/2023
1.0.36 260 5/30/2023
1.0.35 264 5/30/2023
1.0.33 251 5/30/2023
1.0.32 256 5/30/2023
1.0.31 276 5/30/2023
1.0.30 286 5/29/2023
1.0.29 272 5/25/2023
1.0.28 274 5/24/2023
1.0.27 280 5/18/2023
1.0.20 251 5/14/2023
1.0.18 608 5/18/2022
1.0.17 631 5/17/2022
1.0.16 604 5/17/2022
1.0.15 593 4/3/2022