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

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