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

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.2                
NuGet\Install-Package PostSharp.Engineering.BuildTools.AWS -Version 1.0.97-alpha.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="PostSharp.Engineering.BuildTools.AWS" Version="1.0.97-alpha.2" />                
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.2                
#r "nuget: PostSharp.Engineering.BuildTools.AWS, 1.0.97-alpha.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 PostSharp.Engineering.BuildTools.AWS as a Cake Addin
#addin nuget:?package=PostSharp.Engineering.BuildTools.AWS&version=1.0.97-alpha.2&prerelease

// Install PostSharp.Engineering.BuildTools.AWS as a Cake Tool
#tool nuget:?package=PostSharp.Engineering.BuildTools.AWS&version=1.0.97-alpha.2&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 128 4/5/2023
1.0.140-preview 95 4/4/2023
1.0.139-preview 98 3/30/2023
1.0.138-preview 187 3/30/2023
1.0.137-preview 102 3/30/2023
1.0.136-preview 103 3/30/2023
1.0.135-preview 110 3/30/2023
1.0.134-preview 186 3/1/2023
1.0.133-preview 113 3/1/2023
1.0.132-preview 121 2/27/2023
1.0.131-preview 108 2/24/2023
1.0.130-preview 117 2/22/2023
1.0.129-preview 106 2/22/2023
1.0.128-preview 115 2/21/2023
1.0.127-preview 100 2/17/2023
1.0.126-preview 166 2/16/2023
1.0.125-preview 101 2/16/2023
1.0.124-preview 109 2/15/2023
1.0.123-preview 95 2/15/2023
1.0.122-preview 116 2/10/2023
1.0.121-preview 96 2/10/2023
1.0.120-preview 99 2/10/2023
1.0.119-preview 102 2/9/2023
1.0.118-preview 113 2/8/2023
1.0.117-preview 122 1/30/2023
1.0.116-preview 128 1/26/2023
1.0.115-preview 105 1/26/2023
1.0.114-preview 217 1/16/2023
1.0.113-preview 128 1/13/2023
1.0.112-preview 123 1/8/2023
1.0.111-preview 113 1/5/2023
1.0.110-preview 112 12/18/2022
1.0.109-preview 117 12/15/2022
1.0.108-preview 103 12/13/2022
1.0.107-preview 108 12/9/2022
1.0.107-alpha.2 99 12/9/2022
1.0.107-alpha.1 95 12/9/2022
1.0.106-preview 103 12/8/2022
1.0.105-preview 113 12/8/2022
1.0.105-alpha.2 110 12/8/2022
1.0.105-alpha.1 107 12/6/2022
1.0.104-preview 106 12/5/2022
1.0.103-preview 111 12/2/2022
1.0.102-preview 110 11/18/2022
1.0.101-preview 311 11/3/2022
1.0.101-alpha.3 110 11/3/2022
1.0.101-alpha.2 114 11/2/2022
1.0.101-alpha.1 101 11/2/2022
1.0.100-preview 140 10/28/2022
1.0.99-preview 118 10/27/2022
1.0.99-alpha.3 115 10/27/2022
1.0.99-alpha.2 128 10/26/2022
1.0.99-alpha.1 115 10/26/2022
1.0.98-preview 152 10/25/2022
1.0.97-preview 191 10/20/2022
1.0.97-alpha.2 150 10/19/2022
1.0.97-alpha.1 145 10/19/2022
1.0.96-preview 112 10/7/2022
1.0.95-preview 109 10/4/2022
1.0.94-preview 124 9/29/2022
1.0.93-preview 125 9/29/2022
1.0.92-preview 123 9/27/2022
1.0.91-preview 148 9/27/2022
1.0.90-preview 163 9/27/2022
1.0.90-alpha.1 136 9/26/2022
1.0.89-preview 121 9/11/2022
1.0.87-preview 230 9/6/2022
1.0.86-preview 107 9/5/2022
1.0.86-alpha.1 108 9/2/2022
1.0.85-preview 119 8/2/2022
1.0.84-preview 123 7/29/2022
1.0.83-preview 120 7/28/2022
1.0.83-alpha.3 124 7/28/2022
1.0.83-alpha.2 128 7/28/2022
1.0.83-alpha.1 134 7/28/2022
1.0.82-preview 196 7/27/2022
1.0.82-beta.3 117 7/27/2022
1.0.82-beta.2 118 7/26/2022
1.0.82-beta 119 7/26/2022
1.0.82-alpha.1 120 7/25/2022
1.0.81-preview 150 7/22/2022
1.0.80-preview 116 7/20/2022
1.0.80-alpha.3 128 7/20/2022
1.0.80-alpha.2 127 7/20/2022
1.0.80-alpha 140 7/20/2022
1.0.79-preview 132 7/19/2022
1.0.79-beta 117 7/15/2022
1.0.79-alpha.1 145 7/2/2022
1.0.78-preview 128 7/12/2022
1.0.78-alpha.1 134 7/2/2022
1.0.77-preview 129 6/24/2022
1.0.76-preview 176 6/22/2022
1.0.75-preview 125 6/21/2022
1.0.74-preview 121 6/18/2022
1.0.73-preview 118 6/16/2022
1.0.72-preview 135 6/15/2022
1.0.71-preview 120 6/10/2022
1.0.70-preview 127 6/6/2022
1.0.70-beta 125 6/3/2022
1.0.69-preview 129 5/24/2022
1.0.68-preview 150 5/23/2022
1.0.68-beta-4 126 5/23/2022
1.0.68-beta-3 132 5/16/2022
1.0.68-beta-2 131 5/16/2022
1.0.68-beta 127 5/12/2022
1.0.67-preview 144 5/11/2022
1.0.67-beta-4 130 5/11/2022
1.0.67-beta-3 138 5/10/2022
1.0.67-beta-2 124 5/10/2022
1.0.67-beta 122 5/10/2022
1.0.66-preview 139 5/9/2022
1.0.65-preview 143 5/4/2022
1.0.65-beta 134 4/29/2022
1.0.64-preview 140 4/26/2022
1.0.63-preview 135 4/22/2022
1.0.63-beta-6 137 4/21/2022
1.0.63-beta-5 122 4/21/2022
1.0.63-beta-4 131 4/21/2022
1.0.63-beta-3 131 4/20/2022
1.0.63-beta-2 133 4/20/2022
1.0.63-beta 131 4/19/2022
1.0.62-preview 139 4/15/2022
1.0.62-beta-6 134 4/14/2022
1.0.62-beta-5 139 4/14/2022
1.0.62-beta-4 136 4/14/2022
1.0.62-beta-3 142 4/13/2022
1.0.62-beta-2 134 4/11/2022
1.0.62-beta 134 4/11/2022
1.0.61-preview 158 4/7/2022
1.0.61-beta 139 4/7/2022
1.0.60-preview 133 4/6/2022
1.0.59-preview 131 4/6/2022
1.0.59-beta 139 4/6/2022
1.0.58-beta-6 127 4/6/2022
1.0.58-beta-5 137 4/5/2022
1.0.58-beta-4 135 4/5/2022
1.0.58-beta-3 143 4/5/2022
1.0.58-beta-2 130 4/5/2022
1.0.58-beta 127 4/5/2022
1.0.56-preview 144 4/1/2022
1.0.56-beta-9 134 3/28/2022
1.0.56-beta-8 142 3/28/2022
1.0.56-beta-7 141 3/28/2022
1.0.56-beta-6 130 3/28/2022
1.0.56-beta-5 138 3/25/2022
1.0.56-beta-4 123 3/24/2022
1.0.56-beta-3 137 3/22/2022
1.0.56-beta-2 135 3/22/2022
1.0.56-beta-14 143 3/29/2022
1.0.56-beta-13 134 3/28/2022
1.0.56-beta-12 134 3/28/2022
1.0.56-beta-11 154 3/28/2022
1.0.56-beta-10 134 3/28/2022
1.0.56-beta 131 3/22/2022
1.0.55-preview 131 3/22/2022
1.0.54-preview 140 3/16/2022
1.0.53-preview 137 3/16/2022
1.0.52-preview 140 3/16/2022
1.0.51-preview 135 3/15/2022
1.0.50-preview 142 3/9/2022
1.0.49-preview 146 3/3/2022