PostSharp.Engineering.BuildTools.AWS 1.0.97-alpha.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
This is a prerelease version of PostSharp.Engineering.BuildTools.AWS.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package PostSharp.Engineering.BuildTools.AWS --version 1.0.97-alpha.1
NuGet\Install-Package PostSharp.Engineering.BuildTools.AWS -Version 1.0.97-alpha.1
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="PostSharp.Engineering.BuildTools.AWS" Version="1.0.97-alpha.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PostSharp.Engineering.BuildTools.AWS --version 1.0.97-alpha.1
#r "nuget: PostSharp.Engineering.BuildTools.AWS, 1.0.97-alpha.1"
#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 PostSharp.Engineering.BuildTools.AWS as a Cake Addin
#addin nuget:?package=PostSharp.Engineering.BuildTools.AWS&version=1.0.97-alpha.1&prerelease

// Install PostSharp.Engineering.BuildTools.AWS as a Cake Tool
#tool nuget:?package=PostSharp.Engineering.BuildTools.AWS&version=1.0.97-alpha.1&prerelease

PostSharp Engineering

Table of contents

Content

This repository contains common development, build and publishing scripts. It produces two NuGet packages:

  • PostSharp.Engineering.BuildTools is meant to be added as a package reference from the facade C# build program.

  • PostSharp.Engineering.Sdk is meant to be used as an SDK project.

    • AssemblyMetadata.targets: Adds package versions to assembly metadata.
    • BuildOptions.props: Sets the compiler options like language version, nullability and other build options like output path.
    • TeamCity.targets: Enables build and tests reporting to TeamCity.
    • SourceLink.props: Enables SourceLink support.
    • Coverage.props: Enabled code coverage. This script should be imported in test projects only (not in projects being tested). This script adds a package to coverlet so there is no need to have in in test projects (and these references should be removed).
    • MetalamaBranding.props and PostSharpBranding.props: Configure the proper icon for the nuget package.
    • PackagesConfig.targets: Makes the Restore and Pack targets work for projects referencing NuGet using packages.config.
    • WebPublish.targets: Configures the release build of web projects to be published as a zipped artifact.
    • TestsPublish.targets: Configures the release build of test projects to be published as a zipped artifact.

Both packages must be used at the same time.

Concepts

Terminology

A product is almost synonym for repository. There is a single product per repository, and the product name must be the same as the repository name. A product can contain several C# solutions.

Build and testing locally

For details, do Build.ps1 in PowerShell and read the help.

Versioning

Objectives

A major goal of this SDK is to allow to build and test repositories that have references to other repositories without having to publish the nuget package. That is, it is possible and quite easy, with this SDK, to perform builds that reference local clones of repositories. All solutions or projects in the same product share have the same version.

Configuring the version of the current product

The product package version and package version suffix configuration is centralized in the eng\MainVersion.props script via the MainVersion and PackageVersionSuffix properties, respectively. For RTM products, leave the PackageVersionSuffix property value empty.

Configuring the version of dependent products or packages.

Package dependencies versions configuration is centralized in the eng\Versions.props script. Each dependency version is configured in a property named <[DependencyName]Version>, eg. <SystemCollectionsImmutableVersion>.

This property value is then available in all MSBuild project files in the repository and can be used in the PackageReference items. For example:

<ItemGroup>
    <PackageReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" />
</ItemGroup>

Using a local build of a referenced product

Dependencies must be checked out under the same root directory (typically c:\src) under their canonic name.

Then, use Build.ps1 dependencies set local <DEPENDENCY> to specify which dependencies should be run locally.

This will generate eng/Versions.g.props, which you should have imported in eng/Versions.props.

Installation

The easiest way to get started is from this repo template: https://github.com/postsharp/PostSharp.Engineering.ProductTemplate.

Step 1. Edit global.json

Add or update the reference to PostSharp.Engineering.Sdk in global.json.

{
  "sdk": {
    "version": "5.0.206",
    "rollForward": "disable"
  },
  "msbuild-sdks": {
    "PostSharp.Engineering.Sdk": "1.0.0"
  }
}

Step 2. Packaging.props

Create eng\Packaging.props file. The content should look like this:

<Project>

    
    <PropertyGroup>
        <Authors>PostSharp Technologies</Authors>
        <PackageProjectUrl>https://github.com/postsharp/Caravela</PackageProjectUrl>
        <PackageTags>PostSharp Caravela AOP</PackageTags>
        <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
        <PackageIcon>PostSharpIcon.png</PackageIcon>
        <PackageLicenseFile>LICENSE.md</PackageLicenseFile>
    </PropertyGroup>

    
    <ItemGroup>
        <None Include="$(MSBuildThisFileDirectory)..\PostSharpIcon.png" Visible="false" Pack="true" PackagePath="" />
        <None Include="$(MSBuildThisFileDirectory)..\LICENSE.md" Visible="false" Pack="true" PackagePath="" />
        <None Include="$(MSBuildThisFileDirectory)..\THIRD-PARTY-NOTICES.TXT" Visible="false" Pack="true" PackagePath="" />
    </ItemGroup>

</Project>

Make sure that all the files referenced in the previous step exist, or modify the file.

Step 3. MainVersion.props

Create eng\MainVersion.props file. The content should look like:

<Project>
    <PropertyGroup>
        <MainVersion>0.3.6</MainVersion>
        <PackageVersionSuffix>-preview</PackageVersionSuffix>
    </PropertyGroup>
</Project>

Additionally, there may be a property named PatchVersion, which may contain a version number with 4 components. The PatchVersion property value MUST start with the value of the MainVersion property. The use case for this property is when a repo A has a version dependency on another repo B but we want to release a patch of repo B without releasing a new build of repo A.

Step 4. Versions.props

Create eng\Versions.props file. The content should look like this (replace My by the name of the repo without dot):

<Project>

    
    <Import Project="MainVersion.props" Condition="!Exists('MyVersion.props')" />
    
    <PropertyGroup>
        <MyVersion>$(MainVersion)$(PackageVersionSuffix)</MyVersion>
        <MyAssemblyVersion>$(MainVersion)</MyAssemblyVersion>
    </PropertyGroup>

    
    <PropertyGroup>
        <RoslynVersion>3.8.0</RoslynVersion>
        <CaravelaCompilerVersion>3.8.12-preview</CaravelaCompilerVersion>
        <MicrosoftCSharpVersion>4.7.0</MicrosoftCSharpVersion>
    </PropertyGroup>

    
    <Import Project="../artifacts/publish/private/MyVersion.props" Condition="Exists('../artifacts/publish/private/MyVersion.props')" />
    <Import Project="Dependencies.props" Condition="Exists('Dependencies.props')" />

    
    <PropertyGroup>
        <AssemblyVersion>$(MyAssemblyVersion)</AssemblyVersion>
        <Version>$(MyVersion)</Version>
    </PropertyGroup>
    

</Project>

Step 5. Directory.Build.props

Add the following content to Directory.Build.props:

<Project>

  <PropertyGroup>
    <RepoDirectory>$(MSBuildThisFileDirectory)</RepoDirectory>
    <RepoKind>AzureRepos</RepoKind>
  </PropertyGroup>

  <Import Project="eng\Versions.props" />
  <Import Project="eng\Packaging.props" />

  <Import Sdk="PostSharp.Engineering.Sdk" Project="BuildOptions.props" />
  <Import Sdk="PostSharp.Engineering.Sdk" Project="CodeQuality.props" />
  <Import Sdk="PostSharp.Engineering.Sdk" Project="SourceLink.props" />

</Project>

Step 6. Directory.Build.targets

Add the following content to Directory.Build.targets:

<Project>

  <Import Sdk="PostSharp.Engineering.Sdk"  Project="AssemblyMetadata.targets" />
  <Import Sdk="PostSharp.Engineering.Sdk"  Project="TeamCity.targets" />

</Project>

Step 7. Create the front-end build project

Create a file eng\src\Build.csproj with the following content:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net6.0</TargetFramework>
        <AssemblyName>Build</AssemblyName>
        <GenerateDocumentationFile>false</GenerateDocumentationFile>
        <LangVersion>latest</LangVersion>
        <Nullable>enable</Nullable>
        <NoWarn>SA0001;CS8002</NoWarn>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="PostSharp.Engineering.BuildTools.csproj" Version="$(PostSharpEngineeringVersion)" />
    </ItemGroup>

</Project>

Create also a file eng\src\Program.cs with content that varies according to your repo. You can use all the power of C# and PowerShell to customize the build. Note that in the PublicArtifacts, the strings $(Configuration) and $(PackageVersion), and only those strings, are replaced by their value.

using PostSharp.Engineering.BuildTools;
using PostSharp.Engineering.BuildTools.Commands.Build;
using Spectre.Console.Cli;
using System.Collections.Immutable;

namespace BuildCaravela
{
    internal class Program
    {
        private static int Main( string[] args )
        {
            var product = new Product
            {
                ProductName = "Caravela",
                Solutions = ImmutableArray.Create<Solution>(
                    new DotNetSolution( "Caravela.sln" )
                    {
                        SupportsTestCoverage = true
                    },
                    new DotNetSolution( "Tests\\Caravela.Framework.TestApp\\Caravela.Framework.TestApp.sln" )
                    {
                        IsTestOnly = true
                    } ),
                PublicArtifacts = ImmutableArray.Create(
                    "bin\\$(Configuration)\\Caravela.Framework.$(PackageVersion).nupkg",
                    "bin\\$(Configuration)\\Caravela.TestFramework.$(PackageVersion).nupkg",
                    "bin\\$(Configuration)\\Caravela.Framework.Redist.$(PackageVersion).nupkg",
                    "bin\\$(Configuration)\\Caravela.Framework.Sdk.$(PackageVersion).nupkg",
                    "bin\\$(Configuration)\\Caravela.Framework.Impl.$(PackageVersion).nupkg",
                    "bin\\$(Configuration)\\Caravela.Framework.DesignTime.Contracts.$(PackageVersion).nupkg" ),
                 Dependencies = ImmutableArray.Create(
                    new ProductDependency("Caravela.Compiler"), 
                    new ProductDependency("PostSharp.Engineering.BuildTools") )    
            };
            var commandApp = new CommandApp();
            commandApp.AddProductCommands( product );

            return commandApp.Run( args );
        }
    }
}

Step 8. Create Build.ps1, the front-end build script

Create Build.ps1 file in the repo root directory. The content should look like:

if ( $env:VisualStudioVersion -eq $null ) {
    Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
    Enter-VsDevShell -VsInstallPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\" -StartInPath $(Get-Location)
}

& dotnet run --project "$PSScriptRoot\eng\src\Build.csproj" -- $args
exit $LASTEXITCODE

Step 9. Editing .gitignore

Exclude this:

artifacts
eng/tools
*.Import.props

Build Concepts

The code in Program.cs uses the concepts described here.

classDiagram

  class Product {

  }

  class Solution {

  }



  Program o-- "1" Product 
  Product o-- "*" Solution
  Product  o-- "*" DependencyDefinition
  Product  o-- "3" BuildConfigurationInfo
  BuildConfigurationInfo  o-- "*" IBuildTrigger
  BuildConfigurationInfo o-- "*" Publisher
  BuildConfigurationInfo o-- "*" Swapper
  Swapper o-- "*" Tester
  Solution <|-- DotNetSolution
  Solution <|-- MSBuildSolution
  Tester <|-- VSTestTester
  IBuildTrigger <|-- NightlyBuildTrigger
  IBuildTrigger <|-- SourceBuildTrigger
  Publisher <|-- MSDeployPublisher
  Publisher <|-- NuGetPublisher
  Publisher <|-- VsixPublisher
  

  • Program is your program, i.e. BuildMyProduct.
  • Product is a unique instance configured by Program, the root object that defines the build for the whole repo.
  • Solution represents a solution, project, or other build script in your repo. A solution is something that can be restored, built, packed, tested. Two standard implementations are DotNetSolution and MSBuildSolution.
  • BuildConfigurationInfo represents properties that are specific to a build configuration (i.e. Debug, Release or Public) for the product.
  • DependencyDefinition are dependencies to other repositories.
  • Publisher is something that publishes, or deploys, an already-built artefact to a feed, marketplace, deployment slot, or anything. There are standard implementations for NuGet, VSIX, web sites.
  • Swapper is something that swaps a staging deployment slot into the production deployment slot.
  • Tester is a test suite, typically running against a staging deployment, that must execute successfully before the staging deployment is swapped into the production deployment.

Continuous integration

We use TeamCity as our CI/CD pipeline, and we use Kotlin scripts stored in the Git repo. For an example, see the .teamcity directory the current repo.

Artifacts

All TeamCity artifacts are published under artifacts/publish. All build configurations should export and import these artifacts.

Commands

All TeamCity build configurations use the front-end Build.ps1:

  • Debug Build and Test: Build.ps1 test --numbered %build.number%
  • Release Build and Test: Build.ps1 test --public --sign
  • Publish to internal package sources: Build.ps1 publish
  • Publish to internal and public package source: Build.ps1 publish --public

Required environment variables

  • SIGNSERVER_SECRET
  • INTERNAL_NUGET_PUSH_URL
  • INTERNAL_NUGET_API_KEY
  • NUGET_ORG_API_KEY
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. 
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.141-preview 107 4/5/2023
1.0.140-preview 84 4/4/2023
1.0.139-preview 82 3/30/2023
1.0.138-preview 171 3/30/2023
1.0.137-preview 85 3/30/2023
1.0.136-preview 87 3/30/2023
1.0.135-preview 94 3/30/2023
1.0.134-preview 171 3/1/2023
1.0.133-preview 100 3/1/2023
1.0.132-preview 110 2/27/2023
1.0.131-preview 92 2/24/2023
1.0.130-preview 107 2/22/2023
1.0.129-preview 89 2/22/2023
1.0.128-preview 99 2/21/2023
1.0.127-preview 89 2/17/2023
1.0.126-preview 147 2/16/2023
1.0.125-preview 84 2/16/2023
1.0.124-preview 93 2/15/2023
1.0.123-preview 84 2/15/2023
1.0.122-preview 99 2/10/2023
1.0.121-preview 86 2/10/2023
1.0.120-preview 88 2/10/2023
1.0.119-preview 91 2/9/2023
1.0.118-preview 96 2/8/2023
1.0.117-preview 102 1/30/2023
1.0.116-preview 111 1/26/2023
1.0.115-preview 92 1/26/2023
1.0.114-preview 200 1/16/2023
1.0.113-preview 111 1/13/2023
1.0.112-preview 107 1/8/2023
1.0.111-preview 103 1/5/2023
1.0.110-preview 94 12/18/2022
1.0.109-preview 100 12/15/2022
1.0.108-preview 86 12/13/2022
1.0.107-preview 97 12/9/2022
1.0.107-alpha.2 87 12/9/2022
1.0.107-alpha.1 83 12/9/2022
1.0.106-preview 92 12/8/2022
1.0.105-preview 98 12/8/2022
1.0.105-alpha.2 91 12/8/2022
1.0.105-alpha.1 89 12/6/2022
1.0.104-preview 95 12/5/2022
1.0.103-preview 100 12/2/2022
1.0.102-preview 99 11/18/2022
1.0.101-preview 300 11/3/2022
1.0.101-alpha.3 91 11/3/2022
1.0.101-alpha.2 95 11/2/2022
1.0.101-alpha.1 88 11/2/2022
1.0.100-preview 122 10/28/2022
1.0.99-preview 101 10/27/2022
1.0.99-alpha.3 99 10/27/2022
1.0.99-alpha.2 107 10/26/2022
1.0.99-alpha.1 96 10/26/2022
1.0.98-preview 140 10/25/2022
1.0.97-preview 179 10/20/2022
1.0.97-alpha.2 139 10/19/2022
1.0.97-alpha.1 134 10/19/2022
1.0.96-preview 102 10/7/2022
1.0.95-preview 100 10/4/2022
1.0.94-preview 111 9/29/2022
1.0.93-preview 113 9/29/2022
1.0.92-preview 108 9/27/2022
1.0.91-preview 136 9/27/2022
1.0.90-preview 148 9/27/2022
1.0.90-alpha.1 116 9/26/2022
1.0.89-preview 106 9/11/2022
1.0.87-preview 219 9/6/2022
1.0.86-preview 98 9/5/2022
1.0.86-alpha.1 97 9/2/2022
1.0.85-preview 109 8/2/2022
1.0.84-preview 113 7/29/2022
1.0.83-preview 111 7/28/2022
1.0.83-alpha.3 113 7/28/2022
1.0.83-alpha.2 117 7/28/2022
1.0.83-alpha.1 117 7/28/2022
1.0.82-preview 187 7/27/2022
1.0.82-beta.3 106 7/27/2022
1.0.82-beta.2 107 7/26/2022
1.0.82-beta 110 7/26/2022
1.0.82-alpha.1 103 7/25/2022
1.0.81-preview 141 7/22/2022
1.0.80-preview 107 7/20/2022
1.0.80-alpha.3 111 7/20/2022
1.0.80-alpha.2 110 7/20/2022
1.0.80-alpha 125 7/20/2022
1.0.79-preview 117 7/19/2022
1.0.79-beta 108 7/15/2022
1.0.79-alpha.1 134 7/2/2022
1.0.78-preview 114 7/12/2022
1.0.78-alpha.1 123 7/2/2022
1.0.77-preview 119 6/24/2022
1.0.76-preview 161 6/22/2022
1.0.75-preview 110 6/21/2022
1.0.74-preview 112 6/18/2022
1.0.73-preview 109 6/16/2022
1.0.72-preview 120 6/15/2022
1.0.71-preview 111 6/10/2022
1.0.70-preview 118 6/6/2022
1.0.70-beta 110 6/3/2022
1.0.69-preview 113 5/24/2022
1.0.68-preview 135 5/23/2022
1.0.68-beta-4 117 5/23/2022
1.0.68-beta-3 116 5/16/2022
1.0.68-beta-2 115 5/16/2022
1.0.68-beta 118 5/12/2022
1.0.67-preview 135 5/11/2022
1.0.67-beta-4 115 5/11/2022
1.0.67-beta-3 123 5/10/2022
1.0.67-beta-2 109 5/10/2022
1.0.67-beta 107 5/10/2022
1.0.66-preview 123 5/9/2022
1.0.65-preview 126 5/4/2022
1.0.65-beta 119 4/29/2022
1.0.64-preview 123 4/26/2022
1.0.63-preview 119 4/22/2022
1.0.63-beta-6 120 4/21/2022
1.0.63-beta-5 112 4/21/2022
1.0.63-beta-4 115 4/21/2022
1.0.63-beta-3 115 4/20/2022
1.0.63-beta-2 118 4/20/2022
1.0.63-beta 121 4/19/2022
1.0.62-preview 123 4/15/2022
1.0.62-beta-6 118 4/14/2022
1.0.62-beta-5 122 4/14/2022
1.0.62-beta-4 120 4/14/2022
1.0.62-beta-3 126 4/13/2022
1.0.62-beta-2 119 4/11/2022
1.0.62-beta 125 4/11/2022
1.0.61-preview 146 4/7/2022
1.0.61-beta 123 4/7/2022
1.0.60-preview 123 4/6/2022
1.0.59-preview 121 4/6/2022
1.0.59-beta 124 4/6/2022
1.0.58-beta-6 118 4/6/2022
1.0.58-beta-5 122 4/5/2022
1.0.58-beta-4 123 4/5/2022
1.0.58-beta-3 125 4/5/2022
1.0.58-beta-2 119 4/5/2022
1.0.58-beta 117 4/5/2022
1.0.56-preview 132 4/1/2022
1.0.56-beta-9 125 3/28/2022
1.0.56-beta-8 127 3/28/2022
1.0.56-beta-7 126 3/28/2022
1.0.56-beta-6 120 3/28/2022
1.0.56-beta-5 122 3/25/2022
1.0.56-beta-4 113 3/24/2022
1.0.56-beta-3 120 3/22/2022
1.0.56-beta-2 119 3/22/2022
1.0.56-beta-14 127 3/29/2022
1.0.56-beta-13 124 3/28/2022
1.0.56-beta-12 124 3/28/2022
1.0.56-beta-11 138 3/28/2022
1.0.56-beta-10 124 3/28/2022
1.0.56-beta 121 3/22/2022
1.0.55-preview 120 3/22/2022
1.0.54-preview 123 3/16/2022
1.0.53-preview 121 3/16/2022
1.0.52-preview 124 3/16/2022
1.0.51-preview 125 3/15/2022
1.0.50-preview 123 3/9/2022
1.0.49-preview 128 3/3/2022