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 126 4/5/2023
1.0.140-preview 93 4/4/2023
1.0.139-preview 96 3/30/2023
1.0.138-preview 185 3/30/2023
1.0.137-preview 100 3/30/2023
1.0.136-preview 101 3/30/2023
1.0.135-preview 108 3/30/2023
1.0.134-preview 184 3/1/2023
1.0.133-preview 109 3/1/2023
1.0.132-preview 119 2/27/2023
1.0.131-preview 106 2/24/2023
1.0.130-preview 115 2/22/2023
1.0.129-preview 104 2/22/2023
1.0.128-preview 113 2/21/2023
1.0.127-preview 98 2/17/2023
1.0.126-preview 164 2/16/2023
1.0.125-preview 99 2/16/2023
1.0.124-preview 107 2/15/2023
1.0.123-preview 91 2/15/2023
1.0.122-preview 114 2/10/2023
1.0.121-preview 94 2/10/2023
1.0.120-preview 97 2/10/2023
1.0.119-preview 100 2/9/2023
1.0.118-preview 111 2/8/2023
1.0.117-preview 120 1/30/2023
1.0.116-preview 126 1/26/2023
1.0.115-preview 101 1/26/2023
1.0.114-preview 215 1/16/2023
1.0.113-preview 126 1/13/2023
1.0.112-preview 121 1/8/2023
1.0.111-preview 111 1/5/2023
1.0.110-preview 110 12/18/2022
1.0.109-preview 115 12/15/2022
1.0.108-preview 101 12/13/2022
1.0.107-preview 106 12/9/2022
1.0.107-alpha.2 97 12/9/2022
1.0.107-alpha.1 93 12/9/2022
1.0.106-preview 101 12/8/2022
1.0.105-preview 111 12/8/2022
1.0.105-alpha.2 108 12/8/2022
1.0.105-alpha.1 105 12/6/2022
1.0.104-preview 104 12/5/2022
1.0.103-preview 107 12/2/2022
1.0.102-preview 108 11/18/2022
1.0.101-preview 309 11/3/2022
1.0.101-alpha.3 108 11/3/2022
1.0.101-alpha.2 112 11/2/2022
1.0.101-alpha.1 99 11/2/2022
1.0.100-preview 138 10/28/2022
1.0.99-preview 116 10/27/2022
1.0.99-alpha.3 113 10/27/2022
1.0.99-alpha.2 126 10/26/2022
1.0.99-alpha.1 113 10/26/2022
1.0.98-preview 150 10/25/2022
1.0.97-preview 189 10/20/2022
1.0.97-alpha.2 148 10/19/2022
1.0.97-alpha.1 143 10/19/2022
1.0.96-preview 110 10/7/2022
1.0.95-preview 107 10/4/2022
1.0.94-preview 122 9/29/2022
1.0.93-preview 123 9/29/2022
1.0.92-preview 121 9/27/2022
1.0.91-preview 146 9/27/2022
1.0.90-preview 161 9/27/2022
1.0.90-alpha.1 134 9/26/2022
1.0.89-preview 119 9/11/2022
1.0.87-preview 228 9/6/2022
1.0.86-preview 105 9/5/2022
1.0.86-alpha.1 106 9/2/2022
1.0.85-preview 117 8/2/2022
1.0.84-preview 121 7/29/2022
1.0.83-preview 118 7/28/2022
1.0.83-alpha.3 122 7/28/2022
1.0.83-alpha.2 126 7/28/2022
1.0.83-alpha.1 132 7/28/2022
1.0.82-preview 194 7/27/2022
1.0.82-beta.3 115 7/27/2022
1.0.82-beta.2 116 7/26/2022
1.0.82-beta 117 7/26/2022
1.0.82-alpha.1 118 7/25/2022
1.0.81-preview 148 7/22/2022
1.0.80-preview 114 7/20/2022
1.0.80-alpha.3 126 7/20/2022
1.0.80-alpha.2 125 7/20/2022
1.0.80-alpha 138 7/20/2022
1.0.79-preview 130 7/19/2022
1.0.79-beta 115 7/15/2022
1.0.79-alpha.1 143 7/2/2022
1.0.78-preview 126 7/12/2022
1.0.78-alpha.1 132 7/2/2022
1.0.77-preview 127 6/24/2022
1.0.76-preview 174 6/22/2022
1.0.75-preview 123 6/21/2022
1.0.74-preview 119 6/18/2022
1.0.73-preview 116 6/16/2022
1.0.72-preview 133 6/15/2022
1.0.71-preview 118 6/10/2022
1.0.70-preview 125 6/6/2022
1.0.70-beta 123 6/3/2022
1.0.69-preview 127 5/24/2022
1.0.68-preview 148 5/23/2022
1.0.68-beta-4 124 5/23/2022
1.0.68-beta-3 130 5/16/2022
1.0.68-beta-2 129 5/16/2022
1.0.68-beta 125 5/12/2022
1.0.67-preview 142 5/11/2022
1.0.67-beta-4 128 5/11/2022
1.0.67-beta-3 136 5/10/2022
1.0.67-beta-2 122 5/10/2022
1.0.67-beta 120 5/10/2022
1.0.66-preview 137 5/9/2022
1.0.65-preview 141 5/4/2022
1.0.65-beta 132 4/29/2022
1.0.64-preview 138 4/26/2022
1.0.63-preview 133 4/22/2022
1.0.63-beta-6 135 4/21/2022
1.0.63-beta-5 120 4/21/2022
1.0.63-beta-4 129 4/21/2022
1.0.63-beta-3 129 4/20/2022
1.0.63-beta-2 131 4/20/2022
1.0.63-beta 129 4/19/2022
1.0.62-preview 137 4/15/2022
1.0.62-beta-6 132 4/14/2022
1.0.62-beta-5 137 4/14/2022
1.0.62-beta-4 134 4/14/2022
1.0.62-beta-3 140 4/13/2022
1.0.62-beta-2 132 4/11/2022
1.0.62-beta 132 4/11/2022
1.0.61-preview 156 4/7/2022
1.0.61-beta 137 4/7/2022
1.0.60-preview 131 4/6/2022
1.0.59-preview 129 4/6/2022
1.0.59-beta 137 4/6/2022
1.0.58-beta-6 125 4/6/2022
1.0.58-beta-5 135 4/5/2022
1.0.58-beta-4 133 4/5/2022
1.0.58-beta-3 141 4/5/2022
1.0.58-beta-2 128 4/5/2022
1.0.58-beta 125 4/5/2022
1.0.56-preview 142 4/1/2022
1.0.56-beta-9 132 3/28/2022
1.0.56-beta-8 140 3/28/2022
1.0.56-beta-7 139 3/28/2022
1.0.56-beta-6 128 3/28/2022
1.0.56-beta-5 136 3/25/2022
1.0.56-beta-4 121 3/24/2022
1.0.56-beta-3 135 3/22/2022
1.0.56-beta-2 133 3/22/2022
1.0.56-beta-14 141 3/29/2022
1.0.56-beta-13 132 3/28/2022
1.0.56-beta-12 132 3/28/2022
1.0.56-beta-11 152 3/28/2022
1.0.56-beta-10 132 3/28/2022
1.0.56-beta 129 3/22/2022
1.0.55-preview 129 3/22/2022
1.0.54-preview 138 3/16/2022
1.0.53-preview 135 3/16/2022
1.0.52-preview 138 3/16/2022
1.0.51-preview 133 3/15/2022
1.0.50-preview 140 3/9/2022
1.0.49-preview 144 3/3/2022