From 05f49ce799c1f9cc696d53eea89699d80f59f833 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 16 Jun 2019 07:01:14 -0600 Subject: [PATCH 001/889] Initial commit --- .gitattributes | 63 ++++ .gitignore | 349 +++++++++++++++++++++++ .vscode/extensions.json | 18 ++ CONTRIBUTING.md | 24 ++ LICENSE | 21 ++ README.md | 31 ++ azure-pipelines.yml | 58 ++++ azure-pipelines/collect-deployables.yml | 15 + azure-pipelines/collect-logs.yml | 9 + azure-pipelines/dotnet.yml | 64 +++++ azure-pipelines/install-dependencies.yml | 25 ++ global.json | 5 + nuget.config | 8 + src/.editorconfig | 157 ++++++++++ src/Directory.Build.props | 35 +++ src/Directory.Build.targets | 8 + src/Library.Tests/CalculatorTests.cs | 28 ++ src/Library.Tests/Library.Tests.csproj | 29 ++ src/Library.Tests/app.config | 5 + src/Library/Calculator.cs | 29 ++ src/Library/Library.csproj | 10 + src/lib.template.sln | 28 ++ src/shipping.ruleset | 74 +++++ src/strongname.snk | Bin 0 -> 596 bytes src/stylecop.json | 15 + src/tests.ruleset | 83 ++++++ version.json | 8 + 27 files changed, 1199 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .vscode/extensions.json create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 azure-pipelines.yml create mode 100644 azure-pipelines/collect-deployables.yml create mode 100644 azure-pipelines/collect-logs.yml create mode 100644 azure-pipelines/dotnet.yml create mode 100644 azure-pipelines/install-dependencies.yml create mode 100644 global.json create mode 100644 nuget.config create mode 100644 src/.editorconfig create mode 100644 src/Directory.Build.props create mode 100644 src/Directory.Build.targets create mode 100644 src/Library.Tests/CalculatorTests.cs create mode 100644 src/Library.Tests/Library.Tests.csproj create mode 100644 src/Library.Tests/app.config create mode 100644 src/Library/Calculator.cs create mode 100644 src/Library/Library.csproj create mode 100644 src/lib.template.sln create mode 100644 src/shipping.ruleset create mode 100644 src/strongname.snk create mode 100644 src/stylecop.json create mode 100644 src/tests.ruleset create mode 100644 version.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..1ff0c423 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..846c8c0a --- /dev/null +++ b/.gitignore @@ -0,0 +1,349 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..f910c687 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,18 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "ms-azure-devops.azure-pipelines", + "ms-vscode.csharp", + "k--kato.docomment", + "editorconfig.editorconfig", + "pflannery.vscode-versionlens", + "davidanson.vscode-markdownlint" + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [ + + ] +} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..2f36ba66 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,24 @@ +# Contributing + +This project has adopted the [Microsoft Open Source Code of +Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct +FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) +with any additional questions or comments. + +## Prerequisites + +The only prerequisite for building, testing, and deploying from this repository +is the [.NET SDK](https://get.dot.net/). +You should install the version specified in `global.json` or a later version within +the same major.minor.Bxx "hundreds" band. +For example if 2.2.300 is specified, you may install 2.2.300, 2.2.301, or 2.2.310 +while the 2.2.400 version would not be considered compatible by .NET SDK. +See [.NET Core Versioning](https://docs.microsoft.com/en-us/dotnet/core/versions/) for more information. + +This repository can be built on Windows, Linux, and OSX. + +## Building + +Building, testing, and packing this repository can be done by using the standard dotnet CLI commands (e.g. `dotnet build`, `dotnet test`, `dotnet pack`, etc.). diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..3bb6360c --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) PLACEHOLDER + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..e99ca933 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# Your Library + +***An awesome template for your awesome library*** + +![NuGet package](https://img.shields.io/badge/nuget-your--package--here-yellow.svg) +[![Build Status](https://dev.azure.com/andrewarnott/OSS/_apis/build/status/AArnott.Library.Template?branchName=master)](https://dev.azure.com/andrewarnott/OSS/_build/latest?definitionId=29&branchName=master) +[![codecov](https://codecov.io/gh/aarnott/library.template/branch/master/graph/badge.svg)](https://codecov.io/gh/aarnott/library.template) + +## Features + +* Follow the best and simplest patterns of build, pack and test with dotnet CLI. +* Static analyzers: [FxCop](https://docs.microsoft.com/en-us/visualstudio/code-quality/fxcop-analyzers?view=vs-2019) and [StyleCop](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) +* Read-only source tree (builds to top-level bin/obj folders) +* Auto-versioning (via [Nerdbank.GitVersioning](https://github.com/aarnott/nerdbank.gitversioning)) +* Azure Pipeline via YAML with all dependencies declared for long-term serviceability. +* Testing on .NET Framework, multiple .NET Core versions +* Testing on Windows, Linux and OSX +* Code coverage published to Azure Pipelines +* Code coverage published to codecov.io so GitHub PRs get code coverage results added as a PR comment + +## Consumption + +Once you've expanded this template for your own use, you should: + +1. Verify the license is suitable for your goal as it appears in the LICENSE and stylecop.json files + and the Directory.Build.props file's `PackageLicenseExpression` property. +1. Search the repo for all `PLACEHOLDER` occurrences and replace them. +1. Regenerate `src\strongname.snk` file: `sn -k src\strongname.snk` +1. Rename project files, directories, namespaces, and update sln file to match. +1. Reset or remove the `codecov_token` variable in `azure-pipelines.yml` +1. Reset or replace the badges at the top of this file. diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..6d7cf769 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,58 @@ +trigger: + branches: + include: + - master + - validate/* + paths: + exclude: + - doc/ + - '*.md' + - .vscode/ + +variables: + TreatWarningsAsErrors: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + BuildConfiguration: Release + BuildPlatform: Any CPU + codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # PLACEHOLDER - Get a new one from https://codecov.io/ + +jobs: +- job: Windows + pool: Hosted Windows 2019 with VS2019 + steps: + - template: azure-pipelines/install-dependencies.yml + + - powershell: | + dotnet tool install --tool-path .. nbgv + ../nbgv cloud + displayName: Set build number + workingDirectory: src + + - template: azure-pipelines/dotnet.yml + - template: azure-pipelines/collect-deployables.yml + - template: azure-pipelines/collect-logs.yml + + - task: NuGetCommand@2 + displayName: Push packages to CI feed + inputs: + command: push + packagesToPush: $(Build.ArtifactStagingDirectory)/deployables/*.nupkg;$(Build.ArtifactStagingDirectory)/deployables/*.snupkg + nuGetFeedType: internal + publishVstsFeed: /a5a3bad0-e566-4c53-be83-6458be8d1653 # PLACEHOLDER + allowPackageConflicts: true + +- job: Linux + pool: + vmImage: Ubuntu 16.04 + steps: + - template: azure-pipelines/install-dependencies.yml + - template: azure-pipelines/dotnet.yml + - template: azure-pipelines/collect-logs.yml + +- job: macOS + pool: + vmImage: macOS 10.13 + steps: + - template: azure-pipelines/install-dependencies.yml + - template: azure-pipelines/dotnet.yml + - template: azure-pipelines/collect-logs.yml diff --git a/azure-pipelines/collect-deployables.yml b/azure-pipelines/collect-deployables.yml new file mode 100644 index 00000000..5d77acfc --- /dev/null +++ b/azure-pipelines/collect-deployables.yml @@ -0,0 +1,15 @@ +steps: +- task: CopyFiles@1 + inputs: + Contents: | + bin/Packages/$(BuildConfiguration)/* + TargetFolder: $(Build.ArtifactStagingDirectory)/deployables + flattenFolders: true + displayName: Collecting deployable artifacts + +- task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/deployables + ArtifactName: deployables + ArtifactType: Container + displayName: Publish deployables artifacts diff --git a/azure-pipelines/collect-logs.yml b/azure-pipelines/collect-logs.yml new file mode 100644 index 00000000..ab39d91f --- /dev/null +++ b/azure-pipelines/collect-logs.yml @@ -0,0 +1,9 @@ +steps: + +- task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/build_logs + ArtifactName: build_logs-$(Agent.JobName) + ArtifactType: Container + displayName: Publish build_logs artifacts + condition: succeededOrFailed() diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml new file mode 100644 index 00000000..f53bc803 --- /dev/null +++ b/azure-pipelines/dotnet.yml @@ -0,0 +1,64 @@ +steps: +- script: dotnet restore /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/restore.binlog" + displayName: dotnet restore + workingDirectory: src + +- script: dotnet build --no-restore -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" + displayName: dotnet build + workingDirectory: src + +- script: dotnet pack --no-build -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/pack.binlog" + displayName: dotnet pack + workingDirectory: src + +- script: dotnet test --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n -l "trx;LogFileName=$(Build.ArtifactStagingDirectory)/testlogs/net472.trx" /p:CollectCoverage=true + displayName: dotnet test -f net472 + workingDirectory: src + condition: eq(variables['Agent.OS'], 'Windows_NT') + +- script: dotnet test --no-build -c $(BuildConfiguration) -f netcoreapp2.0 --filter "TestCategory!=FailsInCloudTest" -v n -l "trx;LogFileName=$(Build.ArtifactStagingDirectory)/testlogs/netcoreapp2.0.trx" /p:CollectCoverage=true + displayName: dotnet test -f netcoreapp2.0 + workingDirectory: src + +- script: dotnet test --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n -l "trx;LogFileName=$(Build.ArtifactStagingDirectory)/testlogs/netcoreapp2.1.trx" /p:CollectCoverage=true + displayName: dotnet test -f netcoreapp2.1 + workingDirectory: src + +- script: dotnet test --no-build -c $(BuildConfiguration) -f netcoreapp2.2 --filter "TestCategory!=FailsInCloudTest" -v n -l "trx;LogFileName=$(Build.ArtifactStagingDirectory)/testlogs/netcoreapp2.2.trx" /p:CollectCoverage=true + displayName: dotnet test -f netcoreapp2.2 + workingDirectory: src + +- task: PublishTestResults@2 + displayName: Publish test results + inputs: + testRunner: VSTest + #mergeTestResults: true + testResultsFormat: trx + testResultsFiles: $(Build.ArtifactStagingDirectory)/testlogs/*.trx + failTaskOnFailedTests: true + +- task: PublishCodeCoverageResults@1 + displayName: Publish code coverage results to Azure DevOps + inputs: + codeCoverageTool: cobertura + summaryFileLocation: '**/coverage.cobertura.xml' + +- bash: bash <(curl -s https://codecov.io/bash) + displayName: Publish code coverage results to codecov.io + condition: ne(variables['codecov_token'], '') + +- task: CopyFiles@1 + inputs: + Contents: | + obj/**/project.assets.json + TargetFolder: $(Build.ArtifactStagingDirectory)/projectAssetsJson + displayName: Collecting project.assets.json artifacts + condition: succeededOrFailed() + +- task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/projectAssetsJson + ArtifactName: projectAssetsJson-$(Agent.JobName) + ArtifactType: Container + displayName: Publish projectAssetsJson artifacts + condition: succeededOrFailed() diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml new file mode 100644 index 00000000..80830cc7 --- /dev/null +++ b/azure-pipelines/install-dependencies.yml @@ -0,0 +1,25 @@ +steps: +- script: dotnet --info + displayName: .NET Core SDK/runtimes (on host) + workingDirectory: $(Agent.HomeDirectory) + +- task: UseDotNet@2 + displayName: Install .NET Core SDK 2.2.300 + inputs: + packageType: sdk + version: 2.2.300 + +- task: UseDotNet@2 + displayName: Install .NET Core runtime 2.0.x + inputs: + packageType: runtime + version: 2.0.x + +- task: UseDotNet@2 + displayName: Install .NET Core runtime 2.1.x + inputs: + packageType: runtime + version: 2.1.x + +- script: dotnet --info + displayName: .NET Core SDK/runtimes (explicitly installed) diff --git a/global.json b/global.json new file mode 100644 index 00000000..93238784 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "2.2.300" + } +} \ No newline at end of file diff --git a/nuget.config b/nuget.config new file mode 100644 index 00000000..4941d22b --- /dev/null +++ b/nuget.config @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/.editorconfig b/src/.editorconfig new file mode 100644 index 00000000..94cda0d5 --- /dev/null +++ b/src/.editorconfig @@ -0,0 +1,157 @@ +# EditorConfig is awesome:http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Don't use tabs for indentation. +[*] +indent_style = space + +# (Please don't specify an indent_size here; that has too many unintended consequences.) + +# Code files +[*.{cs,csx,vb,vbx,h,cpp,idl}] +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true + +# Xml project files +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] +indent_size = 2 + +# Xml config files +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] +indent_size = 2 + +# JSON files +[*.json] +indent_size = 2 + +# Dotnet code style settings: +[*.{cs,vb}] +# Sort using and Import directives with System.* appearing first +dotnet_sort_system_directives_first = true +dotnet_style_qualification_for_field = true:warning +dotnet_style_qualification_for_property = true:warning +dotnet_style_qualification_for_method = true:warning +dotnet_style_qualification_for_event = true:warning + +# Use language keywords instead of framework type names for type references +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion + +# Suggest more modern language features when available +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion + +# Non-private static fields are PascalCase +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style + +dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field +dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected internal, private protected +dotnet_naming_symbols.non_private_static_fields.required_modifiers = static + +dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case + +# Constants are PascalCase +dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants +dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style + +dotnet_naming_symbols.constants.applicable_kinds = field, local +dotnet_naming_symbols.constants.required_modifiers = const + +dotnet_naming_style.constant_style.capitalization = pascal_case + +# Static fields are camelCase +dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion +dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields +dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style + +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.required_modifiers = static + +dotnet_naming_style.static_field_style.capitalization = camel_case + +# Instance fields are camelCase +dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion +dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields +dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style + +dotnet_naming_symbols.instance_fields.applicable_kinds = field + +dotnet_naming_style.instance_field_style.capitalization = camel_case + +# Locals and parameters are camelCase +dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion +dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters +dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style + +dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local + +dotnet_naming_style.camel_case_style.capitalization = camel_case + +# Local functions are PascalCase +dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions +dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style + +dotnet_naming_symbols.local_functions.applicable_kinds = local_function + +dotnet_naming_style.local_function_style.capitalization = pascal_case + +# By default, name items with PascalCase +dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members +dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style + +dotnet_naming_symbols.all_members.applicable_kinds = * + +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# CSharp code style settings: +[*.cs] +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_switch_labels = true +csharp_indent_labels = flush_left + +# Prefer "var" everywhere +csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion +csharp_style_var_elsewhere = true:suggestion + +# Prefer method-like constructs to have a block body +csharp_style_expression_bodied_methods = false:none +csharp_style_expression_bodied_constructors = false:none +csharp_style_expression_bodied_operators = false:none + +# Prefer property-like constructs to have an expression-body +csharp_style_expression_bodied_properties = true:none +csharp_style_expression_bodied_indexers = true:none +csharp_style_expression_bodied_accessors = true:none + +# Suggest more modern language features when available +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion + +# Newline settings +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true + +# Blocks are allowed +csharp_prefer_braces = true:silent diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 00000000..c3f28530 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,35 @@ + + + + Debug + $(MSBuildThisFileDirectory)..\obj\$(MSBuildProjectName)\ + $(MSBuildThisFileDirectory)..\bin\$(MSBuildProjectName)\ + $(MSBuildThisFileDirectory)..\bin\Packages\$(Configuration)\ + 7.3 + true + + true + $(MSBuildThisFileDirectory)\strongname.snk + + PLACEHOLDER + PLACEHOLDER + MIT + true + true + true + snupkg + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets new file mode 100644 index 00000000..1ddcba6f --- /dev/null +++ b/src/Directory.Build.targets @@ -0,0 +1,8 @@ + + + cobertura + [xunit.*]* + + $(OutputPath)/ + + diff --git a/src/Library.Tests/CalculatorTests.cs b/src/Library.Tests/CalculatorTests.cs new file mode 100644 index 00000000..506ca1b8 --- /dev/null +++ b/src/Library.Tests/CalculatorTests.cs @@ -0,0 +1,28 @@ +// Copyright (c) PLACEHOLDER. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using Library; +using Xunit; +using Xunit.Abstractions; + +public class CalculatorTests +{ + private readonly ITestOutputHelper logger; + + public CalculatorTests(ITestOutputHelper logger) + { + this.logger = logger; + } + + [Fact] + public void AddOrSubtract() + { + // This tests aggregation of code coverage. +#if NETCOREAPP2_0 + Assert.Equal(3, Calculator.Add(1, 2)); +#else + Assert.Equal(-1, Calculator.Subtract(1, 2)); +#endif + } +} diff --git a/src/Library.Tests/Library.Tests.csproj b/src/Library.Tests/Library.Tests.csproj new file mode 100644 index 00000000..fc885418 --- /dev/null +++ b/src/Library.Tests/Library.Tests.csproj @@ -0,0 +1,29 @@ + + + + net472;netcoreapp2.0;netcoreapp2.1;netcoreapp2.2 + false + $(NoWarn);CS1591 + true + ..\tests.ruleset + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/src/Library.Tests/app.config b/src/Library.Tests/app.config new file mode 100644 index 00000000..61890f05 --- /dev/null +++ b/src/Library.Tests/app.config @@ -0,0 +1,5 @@ + + + + + diff --git a/src/Library/Calculator.cs b/src/Library/Calculator.cs new file mode 100644 index 00000000..82679050 --- /dev/null +++ b/src/Library/Calculator.cs @@ -0,0 +1,29 @@ +// Copyright (c) PLACEHOLDER. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Library +{ + using System; + + /// + /// My first class. + /// + public static class Calculator + { + /// + /// Adds two integers. + /// + /// The first integer. + /// The second integer. + /// The sum of the two integers. + public static int Add(int a, int b) => a + b; + + /// + /// Subtracts one integer from another. + /// + /// The original integer. + /// The integer to subtract. + /// The difference between the two integers. + public static int Subtract(int a, int b) => a - b; + } +} diff --git a/src/Library/Library.csproj b/src/Library/Library.csproj new file mode 100644 index 00000000..aa8cf2c6 --- /dev/null +++ b/src/Library/Library.csproj @@ -0,0 +1,10 @@ + + + + netstandard2.0 + ..\shipping.ruleset + + PLACEHOLDER + + + diff --git a/src/lib.template.sln b/src/lib.template.sln new file mode 100644 index 00000000..17645391 --- /dev/null +++ b/src/lib.template.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library", "Library\Library.csproj", "{C06D702E-6FC7-453B-BDDF-608F825EC003}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library.Tests", "Library.Tests\Library.Tests.csproj", "{DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C06D702E-6FC7-453B-BDDF-608F825EC003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C06D702E-6FC7-453B-BDDF-608F825EC003}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C06D702E-6FC7-453B-BDDF-608F825EC003}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C06D702E-6FC7-453B-BDDF-608F825EC003}.Release|Any CPU.Build.0 = Release|Any CPU + {DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/shipping.ruleset b/src/shipping.ruleset new file mode 100644 index 00000000..72903546 --- /dev/null +++ b/src/shipping.ruleset @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/strongname.snk b/src/strongname.snk new file mode 100644 index 0000000000000000000000000000000000000000..a4d0a2ce39df5f7c284340b4a2c4690385c44208 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50097Td7B6KsP|cl#<{bONo_!&t)QUG9wW^j zM1zvNAOI=XF}potSO>54lS%MGl8tv)xYTSw?~K<1McvNlJ;DITeY__C?><|;F`bgX zj;&2ME}KBWPb0zVSK+iW?{2`tzZR-#x0K_|t&0FhD+3urA!lNmCH;&b|?g|_AC39ox-0 zcV%KJis3}%`RVWSXN58fc}#LF$A#kcB2VWh=MH0zs+k7{ zQT<5V>NGhWzC7Jnt4A?n%Kk`fPt&FR4k~q{TSW%@D{plIpotzop}i+x`~C))*Vr-i zrW2)aE17f*=wCRa_#bHkYlQko_Jh)wN@;?yML9mYk)XZ`l6IQ*D7xZmmL=m(T|zMG i={(T>StYQl!YSPV literal 0 HcmV?d00001 diff --git a/src/stylecop.json b/src/stylecop.json new file mode 100644 index 00000000..f1d8168c --- /dev/null +++ b/src/stylecop.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + "documentationRules": { + "companyName": "PLACEHOLDER", + "copyrightText": "Copyright (c) {companyName}. All rights reserved.\nLicensed under the {licenseName} license. See {licenseFile} file in the project root for full license information.", + "variables": { + "licenseName": "MIT", + "licenseFile": "LICENSE" + }, + "fileNamingConvention": "metadata", + "xmlHeader": false + } + } +} \ No newline at end of file diff --git a/src/tests.ruleset b/src/tests.ruleset new file mode 100644 index 00000000..c74c6ed3 --- /dev/null +++ b/src/tests.ruleset @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/version.json b/version.json new file mode 100644 index 00000000..38da1662 --- /dev/null +++ b/version.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "version": "0.1-beta", + "publicReleaseRefSpec": [ + "^refs/heads/master$", + "^refs/heads/v\\d+(?:\\.\\d+)?$" + ] +} \ No newline at end of file From 9a6c1df41cb75c41b7b5039aaddbe59456a93366 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 16 Jun 2019 21:32:09 -0600 Subject: [PATCH 002/889] Add VS Code whitespace settings --- .vscode/settings.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..f0cafc05 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true +} From 26696c117d5f65dbcdf91209ae0b0816593cec4d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 16 Jun 2019 22:24:54 -0600 Subject: [PATCH 003/889] Add script for proper expansion Closes #3 --- Expand-Template.ps1 | 148 ++++++++++++++++++++++++++ LICENSE | 2 +- README.md | 13 +-- azure-pipelines.yml | 11 +- azure-pipelines/expand-template.yml | 10 ++ src/Directory.Build.props | 6 +- src/Library.Tests/CalculatorTests.cs | 2 +- src/{lib.template.sln => Library.sln} | 0 src/Library/Calculator.cs | 2 +- src/Library/Library.csproj | 2 - src/stylecop.json | 4 +- 11 files changed, 179 insertions(+), 21 deletions(-) create mode 100644 Expand-Template.ps1 create mode 100644 azure-pipelines/expand-template.yml rename src/{lib.template.sln => Library.sln} (100%) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 new file mode 100644 index 00000000..edde82a0 --- /dev/null +++ b/Expand-Template.ps1 @@ -0,0 +1,148 @@ +<# +.SYNOPSIS +Expands this template into an actual project, taking values for placeholders +.PARAMETER Name +The name of the library +#> +[CmdletBinding()] +Param( + [Parameter(Mandatory=$true)] + [string]$LibraryName, + [Parameter(Mandatory=$true)] + [string]$Author, + [Parameter()] + [string]$CodeCovToken, + [Parameter()] + [string]$CIFeed +) + +function Replace-Placeholders { + [CmdletBinding()] + param( + [Parameter(Mandatory=$true)] + [string]$Path, + [Parameter(Mandatory=$true)] + $Replacements + ) + + $Path = Resolve-Path $Path + Write-Host "Replacing tokens in `"$Path`"" + $content = Get-Content -Path $Path | Out-String + $Replacements.GetEnumerator() |% { + $modifiedContent = $content -replace $_.Key,$_.Value + if ($modifiedContent -eq $content) { + Write-Error "No $($_.Key) token found to replace." + } + $content = $modifiedContent + } + $content = $content.TrimEnd(("`r","`n")) + [System.IO.File]::WriteAllLines($Path, $content) # Don't use Set-Content because that adds a UTF8 BOM + git add $Path +} + +# Try to find sn.exe if it isn't on the PATH +$sn = Get-Command sn -ErrorAction SilentlyContinue +if (-not $sn) { + $snExes = Get-ChildItem -Recurse "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\sn.exe" + if ($snExes) { + $sn = Get-Command $snExes[0].FullName + } else { + Write-Error "sn command not found on PATH and SDK could not be found." + exit(1) + } +} + +# Verify all commands we use are on the PATH +('git','dotnet') |% { + if (-not (Get-Command $_ -ErrorAction SilentlyContinue)) { + Write-Error "$_ command not found on PATH." + exit(1) + } +} + +Push-Location $PSScriptRoot +try { + # Rename project directories and solution + Set-Location src + git mv Library.sln "$LibraryName.sln" + git mv Library/Library.csproj "Library/$LibraryName.csproj" + git mv Library "$LibraryName" + git mv Library.Tests/Library.Tests.csproj "Library.Tests/$LibraryName.Tests.csproj" + git mv Library.Tests "$LibraryName.Tests" + + # Refresh solution file both to update paths and give the projects unique GUIDs + dotnet sln remove Library/Library.csproj + dotnet sln remove Library.Tests/Library.Tests.csproj + dotnet sln add "$LibraryName" + dotnet sln add "$LibraryName.Tests" + git add "$LibraryName.sln" + + # Update project reference in test project. Add before removal to keep the same ItemGroup in place. + dotnet add "$LibraryName.Tests" reference "$LibraryName" + dotnet remove "$LibraryName.Tests" reference Library/Library.csproj + git add "$LibraryName.Tests/$LibraryName.Tests.csproj" + + # Establish a new strong-name key + & $sn.Path -k 2048 strongname.snk + git add strongname.snk + + Set-Location .. + + # Replace placeholders in source files + Replace-Placeholders -Path "src/$LibraryName/Calculator.cs" -Replacements @{ + 'Library'=$LibraryName + 'COMPANY-PLACEHOLDER'=$Author + } + Replace-Placeholders -Path "src/$LibraryName.Tests/CalculatorTests.cs" -Replacements @{ + 'Library'=$LibraryName + 'COMPANY-PLACEHOLDER'=$Author + } + Replace-Placeholders -Path "LICENSE" -Replacements @{ + 'COMPANY-PLACEHOLDER'=$Author + } + Replace-Placeholders -Path "src/stylecop.json" -Replacements @{ + 'COMPANY-PLACEHOLDER'=$Author + } + Replace-Placeholders -Path "src/Directory.Build.props" -Replacements @{ + 'COMPANY-PLACEHOLDER'=$Author + } + Replace-Placeholders -Path "README.md" -Replacements @{ + "(?m)^.*\[NuGet package\][^`r`n]*"="[![NuGet package](https://img.shields.io/nuget/v/$LibraryName.svg)](https://nuget.org/packages/$LibraryName)" + "(?m)^.*\[Build Status\].*`r?`n"="" + "(?m)^.*\[codecov\].*`r?`n"="" + } + + # Specially handle azure-pipelines.yml edits + $YmlReplacements = @{ + "(?m).*expand-template\.yml(?:\r)?\n" = "" + } + if ($CodeCovToken) { + $YmlReplacements['(codecov_token: ).*(#.*)'] = "`$1$CodeCovToken" + } else { + $YmlReplacements['(codecov_token: ).*(#.*)'] = "#`$1`$2" + } + if ($CIFeed) { + $YmlReplacements['(ci_feed: ).*(#.*)'] = "`$1$CIFeed" + } else { + $YmlReplacements['(ci_feed: ).*(#.*)'] = "#`$1`$2" + } + Replace-Placeholders -Path "azure-pipelines.yml" -Replacements $YmlReplacements + + # Self destruct + $Invocation = (Get-Variable MyInvocation -Scope 1).Value + git rm Expand-Template.ps1 + git rm :/azure-pipelines/expand-template.yml + + # Self-integrity check + Get-ChildItem -Recurse -File -Exclude bin,obj,README.md,Expand-Template.ps1 |? { -not $_.FullName.Contains("obj") } |% { + $PLACEHOLDERS = Get-Content -Path $_.FullName |? { $_.Contains('PLACEHOLDER') } + if ($PLACEHOLDERS) { + Write-Error "PLACEHOLDER discovered in $($_.FullName)" + } + } +} finally { + Pop-Location +} + +# When testing this script, all the changes can be quickly reverted with this command: +# git reset HEAD :/README.md :/LICENSE :/azure-pipelines.yml :/src :/azure-pipelines; git co -- :/README.md :/LICENSE :/azure-pipelines.yml :/src :/azure-pipelines; git clean -fd :/src diff --git a/LICENSE b/LICENSE index 3bb6360c..44122ac6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) PLACEHOLDER +Copyright (c) COMPANY-PLACEHOLDER Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index e99ca933..d05ac0d7 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,9 @@ ## Consumption -Once you've expanded this template for your own use, you should: - -1. Verify the license is suitable for your goal as it appears in the LICENSE and stylecop.json files - and the Directory.Build.props file's `PackageLicenseExpression` property. -1. Search the repo for all `PLACEHOLDER` occurrences and replace them. -1. Regenerate `src\strongname.snk` file: `sn -k src\strongname.snk` -1. Rename project files, directories, namespaces, and update sln file to match. -1. Reset or remove the `codecov_token` variable in `azure-pipelines.yml` +Once you've expanded this template for your own use, you should **run the `Expand-Template.ps1` script** to customize the template for your own project. + +Further customize your repo by: + +1. Verify the license is suitable for your goal as it appears in the LICENSE and stylecop.json files and the Directory.Build.props file's `PackageLicenseExpression` property. 1. Reset or replace the badges at the top of this file. diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6d7cf769..a670bbef 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,13 +8,14 @@ trigger: - doc/ - '*.md' - .vscode/ - + variables: TreatWarningsAsErrors: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release BuildPlatform: Any CPU - codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # PLACEHOLDER - Get a new one from https://codecov.io/ + codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ + ci_feed: /a5a3bad0-e566-4c53-be83-6458be8d1653 # find guid used by Azure DevOps Artifacts for the feed jobs: - job: Windows @@ -31,6 +32,7 @@ jobs: - template: azure-pipelines/dotnet.yml - template: azure-pipelines/collect-deployables.yml - template: azure-pipelines/collect-logs.yml + - template: azure-pipelines/expand-template.yml - task: NuGetCommand@2 displayName: Push packages to CI feed @@ -38,8 +40,9 @@ jobs: command: push packagesToPush: $(Build.ArtifactStagingDirectory)/deployables/*.nupkg;$(Build.ArtifactStagingDirectory)/deployables/*.snupkg nuGetFeedType: internal - publishVstsFeed: /a5a3bad0-e566-4c53-be83-6458be8d1653 # PLACEHOLDER + publishVstsFeed: $(ci_feed) allowPackageConflicts: true + condition: ne(variables['ci_feed'], '') - job: Linux pool: @@ -48,6 +51,7 @@ jobs: - template: azure-pipelines/install-dependencies.yml - template: azure-pipelines/dotnet.yml - template: azure-pipelines/collect-logs.yml + - template: azure-pipelines/expand-template.yml - job: macOS pool: @@ -56,3 +60,4 @@ jobs: - template: azure-pipelines/install-dependencies.yml - template: azure-pipelines/dotnet.yml - template: azure-pipelines/collect-logs.yml + - template: azure-pipelines/expand-template.yml diff --git a/azure-pipelines/expand-template.yml b/azure-pipelines/expand-template.yml new file mode 100644 index 00000000..74960e56 --- /dev/null +++ b/azure-pipelines/expand-template.yml @@ -0,0 +1,10 @@ +steps: +- script: git clean -fdx + displayName: Cleaning repo for template expansion +- powershell: ./Expand-Template.ps1 -LibraryName Calc -Author "Andrew Arnott" + displayName: Expanding template + failOnStderr: true +# TODO: Verify that all changes are staged to the git index +- script: dotnet build + workingDirectory: src + displayName: dotnet build (expanded template) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index c3f28530..7b354beb 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -11,8 +11,8 @@ true $(MSBuildThisFileDirectory)\strongname.snk - PLACEHOLDER - PLACEHOLDER + COMPANY-PLACEHOLDER + COMPANY-PLACEHOLDER MIT true true @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/src/Library.Tests/CalculatorTests.cs b/src/Library.Tests/CalculatorTests.cs index 506ca1b8..2166fb1f 100644 --- a/src/Library.Tests/CalculatorTests.cs +++ b/src/Library.Tests/CalculatorTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) PLACEHOLDER. All rights reserved. +// Copyright (c) COMPANY-PLACEHOLDER. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; diff --git a/src/lib.template.sln b/src/Library.sln similarity index 100% rename from src/lib.template.sln rename to src/Library.sln diff --git a/src/Library/Calculator.cs b/src/Library/Calculator.cs index 82679050..9156a1a3 100644 --- a/src/Library/Calculator.cs +++ b/src/Library/Calculator.cs @@ -1,4 +1,4 @@ -// Copyright (c) PLACEHOLDER. All rights reserved. +// Copyright (c) COMPANY-PLACEHOLDER. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Library diff --git a/src/Library/Library.csproj b/src/Library/Library.csproj index aa8cf2c6..ae6eca97 100644 --- a/src/Library/Library.csproj +++ b/src/Library/Library.csproj @@ -3,8 +3,6 @@ netstandard2.0 ..\shipping.ruleset - - PLACEHOLDER diff --git a/src/stylecop.json b/src/stylecop.json index f1d8168c..37918949 100644 --- a/src/stylecop.json +++ b/src/stylecop.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", "settings": { "documentationRules": { - "companyName": "PLACEHOLDER", + "companyName": "COMPANY-PLACEHOLDER", "copyrightText": "Copyright (c) {companyName}. All rights reserved.\nLicensed under the {licenseName} license. See {licenseFile} file in the project root for full license information.", "variables": { "licenseName": "MIT", @@ -12,4 +12,4 @@ "xmlHeader": false } } -} \ No newline at end of file +} From 159d180e61350798bbbc3fc94845ac0242a8fc11 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 18 Jun 2019 07:08:34 -0600 Subject: [PATCH 004/889] Fix test run names --- azure-pipelines/dotnet.yml | 42 +++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index f53bc803..3e294f0b 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -11,37 +11,45 @@ steps: displayName: dotnet pack workingDirectory: src -- script: dotnet test --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n -l "trx;LogFileName=$(Build.ArtifactStagingDirectory)/testlogs/net472.trx" /p:CollectCoverage=true +- task: DotNetCoreCLI@2 displayName: dotnet test -f net472 - workingDirectory: src + inputs: + command: test + arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true + testRunTitle: net472-$(Agent.JobName) + workingDirectory: src condition: eq(variables['Agent.OS'], 'Windows_NT') -- script: dotnet test --no-build -c $(BuildConfiguration) -f netcoreapp2.0 --filter "TestCategory!=FailsInCloudTest" -v n -l "trx;LogFileName=$(Build.ArtifactStagingDirectory)/testlogs/netcoreapp2.0.trx" /p:CollectCoverage=true +- task: DotNetCoreCLI@2 displayName: dotnet test -f netcoreapp2.0 - workingDirectory: src + inputs: + command: test + arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.0 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true + testRunTitle: netcoreapp2.0-$(Agent.JobName) + workingDirectory: src -- script: dotnet test --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n -l "trx;LogFileName=$(Build.ArtifactStagingDirectory)/testlogs/netcoreapp2.1.trx" /p:CollectCoverage=true +- task: DotNetCoreCLI@2 displayName: dotnet test -f netcoreapp2.1 - workingDirectory: src - -- script: dotnet test --no-build -c $(BuildConfiguration) -f netcoreapp2.2 --filter "TestCategory!=FailsInCloudTest" -v n -l "trx;LogFileName=$(Build.ArtifactStagingDirectory)/testlogs/netcoreapp2.2.trx" /p:CollectCoverage=true + inputs: + command: test + arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true + testRunTitle: netcoreapp2.1-$(Agent.JobName) + workingDirectory: src + +- task: DotNetCoreCLI@2 displayName: dotnet test -f netcoreapp2.2 - workingDirectory: src - -- task: PublishTestResults@2 - displayName: Publish test results inputs: - testRunner: VSTest - #mergeTestResults: true - testResultsFormat: trx - testResultsFiles: $(Build.ArtifactStagingDirectory)/testlogs/*.trx - failTaskOnFailedTests: true + command: test + arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.2 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true + testRunTitle: netcoreapp2.2-$(Agent.JobName) + workingDirectory: src - task: PublishCodeCoverageResults@1 displayName: Publish code coverage results to Azure DevOps inputs: codeCoverageTool: cobertura summaryFileLocation: '**/coverage.cobertura.xml' + failIfCoverageEmpty: true - bash: bash <(curl -s https://codecov.io/bash) displayName: Publish code coverage results to codecov.io From 42d3ae5b22f73214c17035277317bf324a430eeb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 20 Jun 2019 15:25:57 -0600 Subject: [PATCH 005/889] Fill in missing parameter docs in the ps1 script --- Expand-Template.ps1 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index edde82a0..c1447d4c 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -1,8 +1,15 @@ <# .SYNOPSIS Expands this template into an actual project, taking values for placeholders -.PARAMETER Name -The name of the library +.PARAMETER LibraryName +The name of the library. Should consist only of alphanumeric characters and periods. +.PARAMETER Author +The name to use in copyright and owner notices. +.PARAMETER CodeCovToken +A token obtained from codecov.io for your repo. If not specified, code coverage results will not be published to codecov.io, +but can be added later by editing the Azure Pipelines YAML file. +.PARAMETER CIFeed +The `/{guid}` path to the Azure Pipelines artifact feed to push your nuget package to as part of your CI. #> [CmdletBinding()] Param( From 0f19c143cae80dbcf9079d18d6aba4592abbbd10 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 21 Jun 2019 07:32:46 -0600 Subject: [PATCH 006/889] Publish merged code coverage from all test runs on Windows agent Merge code coverage from all test runs on each agent. Although we capture that merged result from each agent as its own build artifact, we have to pick just one agent's merged result to publish to ADO as the summary file. --- azure-pipelines/dotnet.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 3e294f0b..b86e4bd3 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -44,12 +44,27 @@ steps: testRunTitle: netcoreapp2.2-$(Agent.JobName) workingDirectory: src +- powershell: | + dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool + $Inputs = [string]::join(';', (Get-ChildItem bin/coverage.cobertura.xml -Recurse |% { Resolve-Path -Relative $_ })) + obj/reportgenerator -reports:"$Inputs" -targetdir:"$(Build.ArtifactStagingDirectory)/coverageResults" -reporttypes:Cobertura + displayName: Merge code coverage results + +- task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/coverageResults + ArtifactName: coverageResults-$(Agent.JobName) + ArtifactType: Container + displayName: Publish coverageResults artifacts + condition: succeededOrFailed() + - task: PublishCodeCoverageResults@1 displayName: Publish code coverage results to Azure DevOps inputs: codeCoverageTool: cobertura - summaryFileLocation: '**/coverage.cobertura.xml' + summaryFileLocation: $(Build.ArtifactStagingDirectory)/coverageResults/Cobertura.xml failIfCoverageEmpty: true + condition: eq(variables['Agent.OS'], 'Windows_NT') # We have to pick just one agent to publish the code coverage summary file (https://github.com/tonerdo/coverlet/issues/474#issuecomment-504446150) - bash: bash <(curl -s https://codecov.io/bash) displayName: Publish code coverage results to codecov.io From fc34ef4c21bed5c1c06c5df75800f74db297d03a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 21 Jun 2019 11:57:51 -0600 Subject: [PATCH 007/889] Merge code coverage from all test runs and agents (#9) --- azure-pipelines.yml | 11 ++++++++ azure-pipelines/dotnet.yml | 28 ++++++++++--------- azure-pipelines/publish-codecoverage.yml | 34 ++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 12 deletions(-) create mode 100644 azure-pipelines/publish-codecoverage.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a670bbef..a41bc336 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -61,3 +61,14 @@ jobs: - template: azure-pipelines/dotnet.yml - template: azure-pipelines/collect-logs.yml - template: azure-pipelines/expand-template.yml + +- job: MergeCoverage + dependsOn: + - Windows + - Linux + - macOS + pool: + vmImage: Ubuntu 16.04 + steps: + - template: azure-pipelines/install-dependencies.yml + - template: azure-pipelines/publish-codecoverage.yml diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index b86e4bd3..72f3b5a2 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -44,11 +44,23 @@ steps: testRunTitle: netcoreapp2.2-$(Agent.JobName) workingDirectory: src +- task: CopyFiles@1 + inputs: + Contents: | + bin/**/coverage.cobertura.xml + obj/**/*.cs + TargetFolder: $(Build.ArtifactStagingDirectory)/coverageResults + displayName: Collecting coverage.cobertura.xml artifacts + condition: succeededOrFailed() + - powershell: | - dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool - $Inputs = [string]::join(';', (Get-ChildItem bin/coverage.cobertura.xml -Recurse |% { Resolve-Path -Relative $_ })) - obj/reportgenerator -reports:"$Inputs" -targetdir:"$(Build.ArtifactStagingDirectory)/coverageResults" -reporttypes:Cobertura - displayName: Merge code coverage results + Write-Host "Substituting $(System.DefaultWorkingDirectory) with {reporoot}" + $reports = Get-ChildItem "$(Build.ArtifactStagingDirectory)/coverageResults/coverage.cobertura.xml" -Recurse + $reports |% { + $content = Get-Content -Path $_ |% { $_ -Replace [regex]::Escape("$(System.DefaultWorkingDirectory)"), "{reporoot}" } + Set-Content -Path $_ -Value $content -Encoding UTF8 + } + displayName: Preparing code coverage reports for merging on another machine - task: PublishBuildArtifacts@1 inputs: @@ -58,14 +70,6 @@ steps: displayName: Publish coverageResults artifacts condition: succeededOrFailed() -- task: PublishCodeCoverageResults@1 - displayName: Publish code coverage results to Azure DevOps - inputs: - codeCoverageTool: cobertura - summaryFileLocation: $(Build.ArtifactStagingDirectory)/coverageResults/Cobertura.xml - failIfCoverageEmpty: true - condition: eq(variables['Agent.OS'], 'Windows_NT') # We have to pick just one agent to publish the code coverage summary file (https://github.com/tonerdo/coverlet/issues/474#issuecomment-504446150) - - bash: bash <(curl -s https://codecov.io/bash) displayName: Publish code coverage results to codecov.io condition: ne(variables['codecov_token'], '') diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml new file mode 100644 index 00000000..fc530781 --- /dev/null +++ b/azure-pipelines/publish-codecoverage.yml @@ -0,0 +1,34 @@ +steps: +- task: DownloadBuildArtifacts@0 + displayName: Download Windows code coverage results + inputs: + artifactName: coverageResults-Windows + downloadPath: $(System.DefaultWorkingDirectory)/bin +- task: DownloadBuildArtifacts@0 + displayName: Download Linux code coverage results + inputs: + artifactName: coverageResults-Linux + downloadPath: $(System.DefaultWorkingDirectory)/bin +- task: DownloadBuildArtifacts@0 + displayName: Download macOS code coverage results + inputs: + artifactName: coverageResults-macOS + downloadPath: $(System.DefaultWorkingDirectory)/bin +- powershell: | + dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.2.2 + Copy-Item -Recurse $(System.DefaultWorkingDirectory)/bin/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj + Write-Host "Substituting {reporoot} with $(System.DefaultWorkingDirectory)" + $reports = Get-ChildItem -Recurse "$(System.DefaultWorkingDirectory)/bin/coverage.cobertura.xml" + $reports |% { + $content = Get-Content -Path $_ |% { $_.Replace("{reporoot}", "$(System.DefaultWorkingDirectory)") } + Set-Content -Path $_ -Value $content -Encoding UTF8 + } + $Inputs = [string]::join(';', ($reports |% { Resolve-Path -relative $_ })) + obj/reportgenerator -reports:"$Inputs" -targetdir:coveragereport -reporttypes:Cobertura + displayName: Merge coverage +- task: PublishCodeCoverageResults@1 + displayName: Publish code coverage results to Azure DevOps + inputs: + codeCoverageTool: cobertura + summaryFileLocation: 'coveragereport/Cobertura.xml' + failIfCoverageEmpty: true From 753dd46974212dafd30b4e60d16f545a84ca695c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 24 Jun 2019 10:33:03 -0600 Subject: [PATCH 008/889] Avoid `var` when type is not apparent --- src/.editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/.editorconfig b/src/.editorconfig index 94cda0d5..03c2bcf3 100644 --- a/src/.editorconfig +++ b/src/.editorconfig @@ -126,7 +126,7 @@ csharp_indent_labels = flush_left # Prefer "var" everywhere csharp_style_var_for_built_in_types = true:suggestion csharp_style_var_when_type_is_apparent = true:suggestion -csharp_style_var_elsewhere = true:suggestion +csharp_style_var_elsewhere = false:warning # Prefer method-like constructs to have a block body csharp_style_expression_bodied_methods = false:none From e1d68f227cc93a873a8903bb25a78c58b979b2cf Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 7 Jul 2019 07:10:13 -0600 Subject: [PATCH 009/889] Update packages (#14) And a few path manipulating msbuild properties --- src/Directory.Build.props | 13 +++++++------ src/Library.Tests/Library.Tests.csproj | 12 +++--------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 7b354beb..f4ef3297 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,9 +2,10 @@ Debug - $(MSBuildThisFileDirectory)..\obj\$(MSBuildProjectName)\ - $(MSBuildThisFileDirectory)..\bin\$(MSBuildProjectName)\ - $(MSBuildThisFileDirectory)..\bin\Packages\$(Configuration)\ + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\')) + $(RepoRootPath)obj\$(MSBuildProjectName)\ + $(RepoRootPath)bin\$(MSBuildProjectName)\ + $(RepoRootPath)bin\Packages\$(Configuration)\ 7.3 true @@ -22,11 +23,11 @@ - - - + + + diff --git a/src/Library.Tests/Library.Tests.csproj b/src/Library.Tests/Library.Tests.csproj index fc885418..b5f05f5f 100644 --- a/src/Library.Tests/Library.Tests.csproj +++ b/src/Library.Tests/Library.Tests.csproj @@ -14,16 +14,10 @@ - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - + + - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + From 835ffb69827c68498e96caf0e27640eb939a48b2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 7 Jul 2019 07:34:44 -0600 Subject: [PATCH 010/889] Drop .NET Core 2.0 targeting in test project (#13) Microsoft's long-term support for .NET Core 1.x and 2.0 [are over][LTS]. Customers targeting these versions are in a really bad place due to no security patches being offered and thus there are likely few to none out there. [LTS]: https://github.com/dotnet/core/blob/e2f22a7106860c0e5dc98bb36dc648a779944ad5/microsoft-support.md#net-core-releases --- azure-pipelines/dotnet.yml | 8 -------- src/Library.Tests/CalculatorTests.cs | 4 ++-- src/Library.Tests/Library.Tests.csproj | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 72f3b5a2..fe055ef7 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -20,14 +20,6 @@ steps: workingDirectory: src condition: eq(variables['Agent.OS'], 'Windows_NT') -- task: DotNetCoreCLI@2 - displayName: dotnet test -f netcoreapp2.0 - inputs: - command: test - arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.0 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true - testRunTitle: netcoreapp2.0-$(Agent.JobName) - workingDirectory: src - - task: DotNetCoreCLI@2 displayName: dotnet test -f netcoreapp2.1 inputs: diff --git a/src/Library.Tests/CalculatorTests.cs b/src/Library.Tests/CalculatorTests.cs index 2166fb1f..84fe9a97 100644 --- a/src/Library.Tests/CalculatorTests.cs +++ b/src/Library.Tests/CalculatorTests.cs @@ -18,8 +18,8 @@ public CalculatorTests(ITestOutputHelper logger) [Fact] public void AddOrSubtract() { - // This tests aggregation of code coverage. -#if NETCOREAPP2_0 + // This tests aggregation of code coverage across test runs. +#if NETCOREAPP2_1 Assert.Equal(3, Calculator.Add(1, 2)); #else Assert.Equal(-1, Calculator.Subtract(1, 2)); diff --git a/src/Library.Tests/Library.Tests.csproj b/src/Library.Tests/Library.Tests.csproj index b5f05f5f..7323c8d9 100644 --- a/src/Library.Tests/Library.Tests.csproj +++ b/src/Library.Tests/Library.Tests.csproj @@ -1,7 +1,7 @@ - net472;netcoreapp2.0;netcoreapp2.1;netcoreapp2.2 + net472;netcoreapp2.1;netcoreapp2.2 false $(NoWarn);CS1591 true From 720653e55004b99971cf095cac2ade5748f41fed Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 7 Jul 2019 08:35:27 -0600 Subject: [PATCH 011/889] Merge test results even on build/test failure --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a41bc336..79cc4269 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -69,6 +69,7 @@ jobs: - macOS pool: vmImage: Ubuntu 16.04 + condition: succeededOrFailed() steps: - template: azure-pipelines/install-dependencies.yml - template: azure-pipelines/publish-codecoverage.yml From 5806251694796175fbfa806406d27e8018c64eed Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 7 Jul 2019 08:39:17 -0600 Subject: [PATCH 012/889] dotnet tool install resilience against authenticated feeds --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 79cc4269..5d87afbe 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,7 +24,7 @@ jobs: - template: azure-pipelines/install-dependencies.yml - powershell: | - dotnet tool install --tool-path .. nbgv + dotnet tool install --tool-path .. nbgv --ignore-failed-sources ../nbgv cloud displayName: Set build number workingDirectory: src From 3367e54100fa8ba0b58c7d394fa3b5c1dca03d3c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 7 Jul 2019 17:37:37 -0600 Subject: [PATCH 013/889] Switch artifact collection and some variables to ps1 scripts --- .gitignore | 7 +-- azure-pipelines.yml | 6 +-- azure-pipelines/artifacts/Variables.ps1 | 40 ++++++++++++++ azure-pipelines/artifacts/_all.ps1 | 45 ++++++++++++++++ azure-pipelines/artifacts/_pipelines.ps1 | 52 +++++++++++++++++++ azure-pipelines/artifacts/build_logs.ps1 | 10 ++++ azure-pipelines/artifacts/coverageResults.ps1 | 20 +++++++ azure-pipelines/artifacts/deployables.ps1 | 11 ++++ .../artifacts/projectAssetsJson.ps1 | 7 +++ azure-pipelines/collect-deployables.yml | 15 ------ azure-pipelines/collect-logs.yml | 9 ---- azure-pipelines/dotnet.yml | 44 +++------------- azure-pipelines/install-dependencies.yml | 10 +++- .../variables/DotNetSdkVersion.ps1 | 2 + azure-pipelines/variables/_all.ps1 | 10 ++++ azure-pipelines/variables/_pipelines.ps1 | 15 ++++++ 16 files changed, 230 insertions(+), 73 deletions(-) create mode 100644 azure-pipelines/artifacts/Variables.ps1 create mode 100644 azure-pipelines/artifacts/_all.ps1 create mode 100644 azure-pipelines/artifacts/_pipelines.ps1 create mode 100644 azure-pipelines/artifacts/build_logs.ps1 create mode 100644 azure-pipelines/artifacts/coverageResults.ps1 create mode 100644 azure-pipelines/artifacts/deployables.ps1 create mode 100644 azure-pipelines/artifacts/projectAssetsJson.ps1 delete mode 100644 azure-pipelines/collect-deployables.yml delete mode 100644 azure-pipelines/collect-logs.yml create mode 100644 azure-pipelines/variables/DotNetSdkVersion.ps1 create mode 100644 azure-pipelines/variables/_all.ps1 create mode 100644 azure-pipelines/variables/_pipelines.ps1 diff --git a/.gitignore b/.gitignore index 846c8c0a..fc1d26fa 100644 --- a/.gitignore +++ b/.gitignore @@ -55,11 +55,6 @@ dlldata.c # Benchmark Results BenchmarkDotNet.Artifacts/ -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - # StyleCop StyleCopReport.xml @@ -346,4 +341,4 @@ ASALocalRun/ healthchecksdb # Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ \ No newline at end of file +MigrationBackup/ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5d87afbe..52451bc1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -30,15 +30,13 @@ jobs: workingDirectory: src - template: azure-pipelines/dotnet.yml - - template: azure-pipelines/collect-deployables.yml - - template: azure-pipelines/collect-logs.yml - template: azure-pipelines/expand-template.yml - task: NuGetCommand@2 displayName: Push packages to CI feed inputs: command: push - packagesToPush: $(Build.ArtifactStagingDirectory)/deployables/*.nupkg;$(Build.ArtifactStagingDirectory)/deployables/*.snupkg + packagesToPush: $(Build.ArtifactStagingDirectory)/deployables-Windows/*.nupkg;$(Build.ArtifactStagingDirectory)/deployables-Windows/*.snupkg nuGetFeedType: internal publishVstsFeed: $(ci_feed) allowPackageConflicts: true @@ -50,7 +48,6 @@ jobs: steps: - template: azure-pipelines/install-dependencies.yml - template: azure-pipelines/dotnet.yml - - template: azure-pipelines/collect-logs.yml - template: azure-pipelines/expand-template.yml - job: macOS @@ -59,7 +56,6 @@ jobs: steps: - template: azure-pipelines/install-dependencies.yml - template: azure-pipelines/dotnet.yml - - template: azure-pipelines/collect-logs.yml - template: azure-pipelines/expand-template.yml - job: MergeCoverage diff --git a/azure-pipelines/artifacts/Variables.ps1 b/azure-pipelines/artifacts/Variables.ps1 new file mode 100644 index 00000000..cfcb7df5 --- /dev/null +++ b/azure-pipelines/artifacts/Variables.ps1 @@ -0,0 +1,40 @@ +# This artifact captures all variables defined in the ..\variables folder. +# It "snaps" the values of these variables where we can compute them during the build, +# and otherwise captures the scripts to run later during an Azure Pipelines environment release. + +$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") +$ArtifactBasePath = "$RepoRoot\obj\_artifacts" +$VariablesArtifactPath = "$ArtifactBasePath\variables" +if (-not (Test-Path $VariablesArtifactPath)) { New-Item -ItemType Directory -Path $VariablesArtifactPath | Out-Null } + +# Copy variables, either by value if the value is calculable now, or by script +Get-ChildItem -Path "$PSScriptRoot\..\variables" |% { + $value = $null + if (-not $_.BaseName.StartsWith('_')) { # Skip trying to interpret special scripts + # First check the environment variables in case the variable was set in a queued build + if (Test-Path env:$($_.BaseName)) { + $value = Get-Content "env:$($_.BaseName)" + } + + # If that didn't give us anything, try executing the script right now from its original position + if (-not $value) { + $value = & $_.FullName + } + + if ($value) { + # We got something, so wrap it with quotes so it's treated like a literal value. + $value = "'$value'" + } + } + + # If that didn't get us anything, just copy the script itself + if (-not $value) { + $value = Get-Content -Path $_.FullName + } + + Set-Content -Path "$VariablesArtifactPath\$($_.Name)" -Value $value +} + +@{ + "$VariablesArtifactPath" = (Get-ChildItem $VariablesArtifactPath -Recurse); +} diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1 new file mode 100644 index 00000000..bd5e9d34 --- /dev/null +++ b/azure-pipelines/artifacts/_all.ps1 @@ -0,0 +1,45 @@ +# This script returns all the artifacts that should be collected after a build. +# +# Each powershell artifact is expressed as an object with these properties: +# Source - the full path to the source file +# ArtifactName - the name of the artifact to upload to +# ContainerFolder - the relative path within the artifact in which the file should appear +# +# Each artifact aggregating .ps1 script should return a hashtable: +# Key = path to the directory from which relative paths within the artifact should be calculated +# Value = an array of paths (absolute or relative to the BaseDirectory) to files to include in the artifact. +# FileInfo objects are also allowed. + +$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") + +Function EnsureTrailingSlash($path) { + if ($path.length -gt 0 -and !$path.EndsWith('\') -and !$path.EndsWith('/')) { + $path = $path + [IO.Path]::DirectorySeparatorChar + } + + $path.Replace('\', [IO.Path]::DirectorySeparatorChar) +} + +Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% { + $ArtifactName = $_.BaseName + + (& $_).GetEnumerator() |% { + $BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key), [UriKind]::Absolute) + $_.Value |% { + if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) { + $_ = $_.FullName + } + + $artifact = New-Object -TypeName PSObject + Add-Member -InputObject $artifact -MemberType NoteProperty -Name ArtifactName -Value $ArtifactName + + $SourceFullPath = New-Object Uri ($BaseDirectory, $_) + Add-Member -InputObject $artifact -MemberType NoteProperty -Name Source -Value $SourceFullPath.LocalPath + + $RelativePath = [Uri]::UnescapeDataString($BaseDirectory.MakeRelative($SourceFullPath)) + Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath) + + Write-Output $artifact + } + } +} diff --git a/azure-pipelines/artifacts/_pipelines.ps1 b/azure-pipelines/artifacts/_pipelines.ps1 new file mode 100644 index 00000000..59dd2cf2 --- /dev/null +++ b/azure-pipelines/artifacts/_pipelines.ps1 @@ -0,0 +1,52 @@ +# This script translates all the artifacts described by _all.ps1 +# into commands that instruct VSTS to actually collect those artifacts. + +param ( + [string]$ArtifactNameSuffix +) + +$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") +if (!$env:BUILDCONFIGURATION) { throw "BUILDCONFIGURATION environment variable must be set." } +if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { + $ArtifactStagingFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY +} else { + $ArtifactStagingFolder = "$RepoRoot\obj\_artifacts" + if (Test-Path $ArtifactStagingFolder) { + Remove-Item $ArtifactStagingFolder -Recurse -Force + } +} + +function Create-SymbolicLink { + param ( + $Link, + $Target + ) + + if ($Link -eq $Target) { + return + } + + if (Test-Path $Link) { Remove-Item $Link } + $LinkContainer = Split-Path $Link -Parent + if (!(Test-Path $LinkContainer)) { mkdir $LinkContainer } + Write-Verbose "Linking $Link to $Target" + ln $Target $Link +} + +# Stage all artifacts +$Artifacts = & "$PSScriptRoot\_all.ps1" +$Artifacts |% { + $DestinationFolder = (Join-Path (Join-Path $ArtifactStagingFolder "$($_.ArtifactName)$ArtifactNameSuffix") $_.ContainerFolder).TrimEnd('\') + $Name = "$(Split-Path $_.Source -Leaf)" + + #Write-Host "$($_.Source) -> $($_.ArtifactName)\$($_.ContainerFolder)" -ForegroundColor Yellow + + if (-not (Test-Path $DestinationFolder)) { New-Item -ItemType Directory -Path $DestinationFolder | Out-Null } + if (Test-Path -PathType Leaf $_.Source) { # skip folders + Create-SymbolicLink -Link "$DestinationFolder\$Name" -Target $_.Source + } +} + +$Artifacts |% { $_.ArtifactName } | Get-Unique |% { + Write-Host "##vso[artifact.upload containerfolder=$_$ArtifactNameSuffix;artifactname=$_$ArtifactNameSuffix;]$ArtifactStagingFolder/$_$ArtifactNameSuffix" +} diff --git a/azure-pipelines/artifacts/build_logs.ps1 b/azure-pipelines/artifacts/build_logs.ps1 new file mode 100644 index 00000000..5ba801c5 --- /dev/null +++ b/azure-pipelines/artifacts/build_logs.ps1 @@ -0,0 +1,10 @@ +if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { + $artifactsRoot = $env:BUILD_ARTIFACTSTAGINGDIRECTORY +} else { + $RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") + $artifactsRoot = "$RepoRoot\bin" +} + +@{ + "$artifactsRoot/build_logs" = (Get-ChildItem -Recurse "$artifactsRoot/build_logs") +} diff --git a/azure-pipelines/artifacts/coverageResults.ps1 b/azure-pipelines/artifacts/coverageResults.ps1 new file mode 100644 index 00000000..36189f33 --- /dev/null +++ b/azure-pipelines/artifacts/coverageResults.ps1 @@ -0,0 +1,20 @@ +$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") + +# Prepare code coverage reports for merging on another machine +if ($env:SYSTEM_DEFAULTWORKINGDIRECTORY) { + Write-Host "Substituting $env:SYSTEM_DEFAULTWORKINGDIRECTORY with `"{reporoot}`"" + $reports = Get-ChildItem "$RepoRoot/bin/coverage.cobertura.xml" -Recurse + $reports |% { + $content = Get-Content -Path $_ |% { $_ -Replace [regex]::Escape($env:SYSTEM_DEFAULTWORKINGDIRECTORY), "{reporoot}" } + Set-Content -Path $_ -Value $content -Encoding UTF8 + } +} else { + Write-Warning "Azure Pipelines not detected. Machine-neutral token replacement skipped." +} + +@{ + $RepoRoot = ( + (Get-ChildItem "$RepoRoot\bin\coverage.cobertura.xml" -Recurse) + + (Get-ChildItem "$RepoRoot\obj\*.cs" -Recurse) + ); +} diff --git a/azure-pipelines/artifacts/deployables.ps1 b/azure-pipelines/artifacts/deployables.ps1 new file mode 100644 index 00000000..893df6dd --- /dev/null +++ b/azure-pipelines/artifacts/deployables.ps1 @@ -0,0 +1,11 @@ +$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") +$BuildConfiguration = $env:BUILDCONFIGURATION +if (!$BuildConfiguration) { + $BuildConfiguration = 'Debug' +} + +$PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration" + +@{ + "$PackagesRoot" = (Get-ChildItem $PackagesRoot -Recurse) +} diff --git a/azure-pipelines/artifacts/projectAssetsJson.ps1 b/azure-pipelines/artifacts/projectAssetsJson.ps1 new file mode 100644 index 00000000..5e9217bd --- /dev/null +++ b/azure-pipelines/artifacts/projectAssetsJson.ps1 @@ -0,0 +1,7 @@ +$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") + +@{ + "$RepoRoot\obj" = ( + (Get-ChildItem "$RepoRoot\obj\project.assets.json" -Recurse) + ); +} diff --git a/azure-pipelines/collect-deployables.yml b/azure-pipelines/collect-deployables.yml deleted file mode 100644 index 5d77acfc..00000000 --- a/azure-pipelines/collect-deployables.yml +++ /dev/null @@ -1,15 +0,0 @@ -steps: -- task: CopyFiles@1 - inputs: - Contents: | - bin/Packages/$(BuildConfiguration)/* - TargetFolder: $(Build.ArtifactStagingDirectory)/deployables - flattenFolders: true - displayName: Collecting deployable artifacts - -- task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/deployables - ArtifactName: deployables - ArtifactType: Container - displayName: Publish deployables artifacts diff --git a/azure-pipelines/collect-logs.yml b/azure-pipelines/collect-logs.yml deleted file mode 100644 index ab39d91f..00000000 --- a/azure-pipelines/collect-logs.yml +++ /dev/null @@ -1,9 +0,0 @@ -steps: - -- task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/build_logs - ArtifactName: build_logs-$(Agent.JobName) - ArtifactType: Container - displayName: Publish build_logs artifacts - condition: succeededOrFailed() diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index fe055ef7..668083e7 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -36,48 +36,20 @@ steps: testRunTitle: netcoreapp2.2-$(Agent.JobName) workingDirectory: src -- task: CopyFiles@1 +- task: PowerShell@2 inputs: - Contents: | - bin/**/coverage.cobertura.xml - obj/**/*.cs - TargetFolder: $(Build.ArtifactStagingDirectory)/coverageResults - displayName: Collecting coverage.cobertura.xml artifacts + filePath: azure-pipelines/variables/_pipelines.ps1 + failOnStderr: true + displayName: Update pipeline variables based on build outputs condition: succeededOrFailed() -- powershell: | - Write-Host "Substituting $(System.DefaultWorkingDirectory) with {reporoot}" - $reports = Get-ChildItem "$(Build.ArtifactStagingDirectory)/coverageResults/coverage.cobertura.xml" -Recurse - $reports |% { - $content = Get-Content -Path $_ |% { $_ -Replace [regex]::Escape("$(System.DefaultWorkingDirectory)"), "{reporoot}" } - Set-Content -Path $_ -Value $content -Encoding UTF8 - } - displayName: Preparing code coverage reports for merging on another machine - -- task: PublishBuildArtifacts@1 +- task: PowerShell@2 inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/coverageResults - ArtifactName: coverageResults-$(Agent.JobName) - ArtifactType: Container - displayName: Publish coverageResults artifacts + filePath: azure-pipelines/artifacts/_pipelines.ps1 + arguments: -ArtifactNameSuffix "-$(Agent.JobName)" + displayName: Publish artifacts condition: succeededOrFailed() - bash: bash <(curl -s https://codecov.io/bash) displayName: Publish code coverage results to codecov.io condition: ne(variables['codecov_token'], '') - -- task: CopyFiles@1 - inputs: - Contents: | - obj/**/project.assets.json - TargetFolder: $(Build.ArtifactStagingDirectory)/projectAssetsJson - displayName: Collecting project.assets.json artifacts - condition: succeededOrFailed() - -- task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/projectAssetsJson - ArtifactName: projectAssetsJson-$(Agent.JobName) - ArtifactType: Container - displayName: Publish projectAssetsJson artifacts - condition: succeededOrFailed() diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 80830cc7..5b0b8c3a 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -1,13 +1,19 @@ steps: +- task: PowerShell@2 + inputs: + filePath: azure-pipelines/variables/_pipelines.ps1 + failOnStderr: true + displayName: Set pipeline variables based on source + - script: dotnet --info displayName: .NET Core SDK/runtimes (on host) workingDirectory: $(Agent.HomeDirectory) - task: UseDotNet@2 - displayName: Install .NET Core SDK 2.2.300 + displayName: Install .NET Core SDK inputs: packageType: sdk - version: 2.2.300 + version: $(DotNetSdkVersion) - task: UseDotNet@2 displayName: Install .NET Core runtime 2.0.x diff --git a/azure-pipelines/variables/DotNetSdkVersion.ps1 b/azure-pipelines/variables/DotNetSdkVersion.ps1 new file mode 100644 index 00000000..b213fbc2 --- /dev/null +++ b/azure-pipelines/variables/DotNetSdkVersion.ps1 @@ -0,0 +1,2 @@ +$globalJson = Get-Content -Path "$PSScriptRoot\..\..\global.json" | ConvertFrom-Json +$globalJson.sdk.version diff --git a/azure-pipelines/variables/_all.ps1 b/azure-pipelines/variables/_all.ps1 new file mode 100644 index 00000000..680a3398 --- /dev/null +++ b/azure-pipelines/variables/_all.ps1 @@ -0,0 +1,10 @@ +# This script returns a hashtable of build variables that should be set +# at the start of a build or release definition's execution. + +$vars = @{} + +Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" |% { + $vars[$_.BaseName] = & $_ +} + +$vars diff --git a/azure-pipelines/variables/_pipelines.ps1 b/azure-pipelines/variables/_pipelines.ps1 new file mode 100644 index 00000000..b3fde25d --- /dev/null +++ b/azure-pipelines/variables/_pipelines.ps1 @@ -0,0 +1,15 @@ +# This script translates the variables returned by the _all.ps1 script +# into commands that instruct VSTS to actually set those variables for other VSTS tasks to consume. + +# The build or release definition may have set these variables to override +# what the build would do. So only set them if they have not already been set. + +(& "$PSScriptRoot\_all.ps1").GetEnumerator() |% { + if (Test-Path -Path "env:$($_.Key.ToUpper())") { + Write-Host "Skipping setting $($_.Key) because variable is already set." -ForegroundColor Cyan + } else { + Write-Host "$($_.Key)=$($_.Value)" -ForegroundColor Yellow + Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)" + Set-Item -Path "env:$($_.Key)" -Value $_.Value + } +} From baea971aa13cdb2d7e56ae7ab643b96613972894 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 7 Jul 2019 23:01:20 -0600 Subject: [PATCH 014/889] Publish merged code coverage even when some inputs fail --- azure-pipelines/publish-codecoverage.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index fc530781..b9b7b72a 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -4,16 +4,19 @@ steps: inputs: artifactName: coverageResults-Windows downloadPath: $(System.DefaultWorkingDirectory)/bin + continueOnError: true - task: DownloadBuildArtifacts@0 displayName: Download Linux code coverage results inputs: artifactName: coverageResults-Linux downloadPath: $(System.DefaultWorkingDirectory)/bin + continueOnError: true - task: DownloadBuildArtifacts@0 displayName: Download macOS code coverage results inputs: artifactName: coverageResults-macOS downloadPath: $(System.DefaultWorkingDirectory)/bin + continueOnError: true - powershell: | dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.2.2 Copy-Item -Recurse $(System.DefaultWorkingDirectory)/bin/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj From 70c8febd704082f5f235a36d112ca4b78f082804 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 7 Jul 2019 23:01:47 -0600 Subject: [PATCH 015/889] Push nuget package to CI only if all agents succeed --- azure-pipelines.yml | 13 ++----------- azure-pipelines/publish-deployables.yml | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 azure-pipelines/publish-deployables.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 52451bc1..8bff4e89 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -32,16 +32,6 @@ jobs: - template: azure-pipelines/dotnet.yml - template: azure-pipelines/expand-template.yml - - task: NuGetCommand@2 - displayName: Push packages to CI feed - inputs: - command: push - packagesToPush: $(Build.ArtifactStagingDirectory)/deployables-Windows/*.nupkg;$(Build.ArtifactStagingDirectory)/deployables-Windows/*.snupkg - nuGetFeedType: internal - publishVstsFeed: $(ci_feed) - allowPackageConflicts: true - condition: ne(variables['ci_feed'], '') - - job: Linux pool: vmImage: Ubuntu 16.04 @@ -58,7 +48,7 @@ jobs: - template: azure-pipelines/dotnet.yml - template: azure-pipelines/expand-template.yml -- job: MergeCoverage +- job: WrapUp dependsOn: - Windows - Linux @@ -69,3 +59,4 @@ jobs: steps: - template: azure-pipelines/install-dependencies.yml - template: azure-pipelines/publish-codecoverage.yml + - template: azure-pipelines/publish-deployables.yml diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml new file mode 100644 index 00000000..85c76e7b --- /dev/null +++ b/azure-pipelines/publish-deployables.yml @@ -0,0 +1,15 @@ +steps: +- task: DownloadBuildArtifacts@0 + displayName: Download deployables + inputs: + artifactName: deployables-Windows + downloadPath: $(System.DefaultWorkingDirectory)/bin +- task: DotNetCoreCLI@2 + displayName: Push packages to CI feed + inputs: + command: push + packagesToPush: $(System.DefaultWorkingDirectory)/bin/deployables-Windows/*.nupkg + nuGetFeedType: internal + publishVstsFeed: $(ci_feed) + allowPackageConflicts: true + condition: and(succeeded(), ne(variables['ci_feed'], '')) From e4cbe719a90f11a3b7545ffe90a56607322e8771 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 7 Jul 2019 21:42:35 -0600 Subject: [PATCH 016/889] Add init.ps1 and Install-DotNetSdk.ps1 scripts Closes #12 --- .gitattributes | 3 +++ CONTRIBUTING.md | 5 ++++ init.ps1 | 9 +++++++ tools/Install-DotNetSdk.ps1 | 54 +++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 init.ps1 create mode 100644 tools/Install-DotNetSdk.ps1 diff --git a/.gitattributes b/.gitattributes index 1ff0c423..9b6ea624 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,9 @@ ############################################################################### * text=auto +# Ensure bash shell scripts use LF line endings +*.sh eol=lf + ############################################################################### # Set default behavior for command prompt diff. # diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2f36ba66..4834cebf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,8 +17,13 @@ For example if 2.2.300 is specified, you may install 2.2.300, 2.2.301, or 2.2.31 while the 2.2.400 version would not be considered compatible by .NET SDK. See [.NET Core Versioning](https://docs.microsoft.com/en-us/dotnet/core/versions/) for more information. +All dependencies can be installed by running the `init.ps1` script at the root of the repository +using Windows PowerShell or [PowerShell Core][pwsh] (on any OS). + This repository can be built on Windows, Linux, and OSX. ## Building Building, testing, and packing this repository can be done by using the standard dotnet CLI commands (e.g. `dotnet build`, `dotnet test`, `dotnet pack`, etc.). + +[pwsh]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6 diff --git a/init.ps1 b/init.ps1 new file mode 100644 index 00000000..6f0a0776 --- /dev/null +++ b/init.ps1 @@ -0,0 +1,9 @@ +<# +.SYNOPSIS +Installs dependencies required to build and test the projects in this repository. +#> +[CmdletBinding(SupportsShouldProcess=$true)] +Param ( +) + +& "$PSScriptRoot\tools\Install-DotNetSdk.ps1" diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 new file mode 100644 index 00000000..ca73cb76 --- /dev/null +++ b/tools/Install-DotNetSdk.ps1 @@ -0,0 +1,54 @@ +<# +.SYNOPSIS +Installs the .NET SDK specified in the global.json file at the root of this repository, +along with supporting .NET Core runtimes used for testing. +#> +[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] +Param ( +) + +$DotNetInstallScriptRoot = Resolve-Path $PSScriptRoot\..\obj +$sdkVersion = & "$PSScriptRoot\..\azure-pipelines\variables\DotNetSdkVersion.ps1" + +if ($IsMacOS -or $IsLinux) { + $DownloadUri = "https://dot.net/v1/dotnet-install.sh" + $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" +} else { + $DownloadUri = "https://dot.net/v1/dotnet-install.ps1" + $DotNetInstallScriptPath = "$DotNetInstallScriptRoot\dotnet-install.ps1" +} + +if (-not (Test-Path $DotNetInstallScriptPath)) { + Invoke-WebRequest -Uri $DownloadUri -OutFile $DotNetInstallScriptPath + chmod +x $DotNetInstallScriptPath +} + +if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { + & $DotNetInstallScriptPath -Version $sdkVersion -Architecture x64 +} else { + & $DotNetInstallScriptPath -Version $sdkVersion -Architecture x64 -DryRun +} + +# Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them. +$runtimeVersions = @() +Get-ChildItem "$PSScriptRoot\..\src\*.*proj" -Recurse |% { + $projXml = [xml](Get-Content -Path $_) + $targetFrameworks = $projXml.Project.PropertyGroup.TargetFramework + if (!$targetFrameworks) { + $targetFrameworks = $projXml.Project.PropertyGroup.TargetFrameworks + if ($targetFrameworks) { + $targetFrameworks = $targetFrameworks.Split(';') + } + } + $targetFrameworks |? { $_ -match 'netcoreapp(\d+\.\d+)' } |% { + $runtimeVersions += $Matches[1] + } +} + +$runtimeVersions | Get-Unique |% { + if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { + & $DotNetInstallScriptPath -Channel $_ -Runtime dotnet -Architecture x64 + } else { + & $DotNetInstallScriptPath -Channel $_ -Runtime dotnet -Architecture x64 -DryRun + } +} From 45cb59eadbda46815ca7ee052c5d8a113d9560fc Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 8 Jul 2019 08:50:38 -0600 Subject: [PATCH 017/889] install-dependencies.yml now shares init.ps1 script --- CONTRIBUTING.md | 5 ++ azure-pipelines/expand-template.yml | 4 +- azure-pipelines/install-dependencies.yml | 26 +------- init.ps1 | 12 +++- tools/Install-DotNetSdk.ps1 | 82 +++++++++++++++++++++--- 5 files changed, 95 insertions(+), 34 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4834cebf..f2f4a8ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,6 +7,11 @@ FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. +## Best practices + +* Use Windows PowerShell or [PowerShell Core][pwsh] (including on Linux/OSX) to run .ps1 scripts. + Some scripts set environment variables to help you, but they are only retained if you use PowerShell as your shell. + ## Prerequisites The only prerequisite for building, testing, and deploying from this repository diff --git a/azure-pipelines/expand-template.yml b/azure-pipelines/expand-template.yml index 74960e56..708534d5 100644 --- a/azure-pipelines/expand-template.yml +++ b/azure-pipelines/expand-template.yml @@ -1,5 +1,7 @@ steps: -- script: git clean -fdx +- script: | + dotnet build-server shutdown + git clean -fdx displayName: Cleaning repo for template expansion - powershell: ./Expand-Template.ps1 -LibraryName Calc -Author "Andrew Arnott" displayName: Expanding template diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 5b0b8c3a..38fa5c08 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -5,27 +5,5 @@ steps: failOnStderr: true displayName: Set pipeline variables based on source -- script: dotnet --info - displayName: .NET Core SDK/runtimes (on host) - workingDirectory: $(Agent.HomeDirectory) - -- task: UseDotNet@2 - displayName: Install .NET Core SDK - inputs: - packageType: sdk - version: $(DotNetSdkVersion) - -- task: UseDotNet@2 - displayName: Install .NET Core runtime 2.0.x - inputs: - packageType: runtime - version: 2.0.x - -- task: UseDotNet@2 - displayName: Install .NET Core runtime 2.1.x - inputs: - packageType: runtime - version: 2.1.x - -- script: dotnet --info - displayName: .NET Core SDK/runtimes (explicitly installed) +- powershell: .\init.ps1 + displayName: Install prerequisites diff --git a/init.ps1 b/init.ps1 index 6f0a0776..41e5556b 100644 --- a/init.ps1 +++ b/init.ps1 @@ -1,9 +1,19 @@ <# .SYNOPSIS Installs dependencies required to build and test the projects in this repository. +.DESCRIPTION +This does not require elevation, as the dependencies are installed in per-user locations. +.PARAMETER InstallLocality +A value indicating whether dependencies should be installed locally to the repo or at a per-user location. +Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. +Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. +When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. +Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. #> [CmdletBinding(SupportsShouldProcess=$true)] Param ( + [ValidateSet('repo','user')] + [string]$InstallLocality='user' ) -& "$PSScriptRoot\tools\Install-DotNetSdk.ps1" +& "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index ca73cb76..9db8558f 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -2,20 +2,56 @@ .SYNOPSIS Installs the .NET SDK specified in the global.json file at the root of this repository, along with supporting .NET Core runtimes used for testing. +.DESCRIPTION +This does not require elevation, as the SDK and runtimes are installed locally to this repo location. +.PARAMETER InstallLocality +A value indicating whether dependencies should be installed locally to the repo or at a per-user location. +Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. +Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. +When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. +Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. #> [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] Param ( + [ValidateSet('repo','user')] + [string]$InstallLocality='user' ) -$DotNetInstallScriptRoot = Resolve-Path $PSScriptRoot\..\obj -$sdkVersion = & "$PSScriptRoot\..\azure-pipelines\variables\DotNetSdkVersion.ps1" +$DotNetInstallScriptRoot = "$PSScriptRoot/../obj" +if (!(Test-Path $DotNetInstallScriptRoot)) { mkdir $DotNetInstallScriptRoot | Out-Null } + +$switches = @( + '-Architecture','x64' +) +$envVars = @{ + # For locally installed dotnet, skip first time experience which takes a long time + 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' = 'true'; +} + +$DotNetInstallScriptRoot = Resolve-Path $DotNetInstallScriptRoot +if ($InstallLocality -eq 'repo') { + $DotNetInstallDir = "$DotNetInstallScriptRoot/.dotnet" +} elseif ($env:AGENT_TOOLSDIRECTORY) { + $DotNetInstallDir = "$env:AGENT_TOOLSDIRECTORY/dotnet" +} else { + $DotNetInstallDir = Join-Path $HOME .dotnet +} + +Write-Host "Installing .NET Core SDK and runtimes to $DotNetInstallDir" -ForegroundColor Blue + +if ($DotNetInstallDir) { + $switches += '-InstallDir',$DotNetInstallDir + $envVars['DOTNET_MULTILEVEL_LOOKUP'] = '0' + $envVars['DOTNET_ROOT'] = $DotNetInstallDir +} +$sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1" if ($IsMacOS -or $IsLinux) { $DownloadUri = "https://dot.net/v1/dotnet-install.sh" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" } else { $DownloadUri = "https://dot.net/v1/dotnet-install.ps1" - $DotNetInstallScriptPath = "$DotNetInstallScriptRoot\dotnet-install.ps1" + $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1" } if (-not (Test-Path $DotNetInstallScriptPath)) { @@ -24,9 +60,9 @@ if (-not (Test-Path $DotNetInstallScriptPath)) { } if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { - & $DotNetInstallScriptPath -Version $sdkVersion -Architecture x64 + Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches" } else { - & $DotNetInstallScriptPath -Version $sdkVersion -Architecture x64 -DryRun + Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches -DryRun" } # Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them. @@ -37,7 +73,7 @@ Get-ChildItem "$PSScriptRoot\..\src\*.*proj" -Recurse |% { if (!$targetFrameworks) { $targetFrameworks = $projXml.Project.PropertyGroup.TargetFrameworks if ($targetFrameworks) { - $targetFrameworks = $targetFrameworks.Split(';') + $targetFrameworks = $targetFrameworks -Split ';' } } $targetFrameworks |? { $_ -match 'netcoreapp(\d+\.\d+)' } |% { @@ -45,10 +81,40 @@ Get-ChildItem "$PSScriptRoot\..\src\*.*proj" -Recurse |% { } } +$switches += '-Runtime','dotnet' + $runtimeVersions | Get-Unique |% { if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { - & $DotNetInstallScriptPath -Channel $_ -Runtime dotnet -Architecture x64 + Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches" } else { - & $DotNetInstallScriptPath -Channel $_ -Runtime dotnet -Architecture x64 -DryRun + Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches -DryRun" + } +} + +Write-Host "Environment variables to be set:" -ForegroundColor Blue +$envVars + +if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these installed runtimes?")) { + if ($env:TF_BUILD) { + Write-Host "Azure Pipelines detected. Logging commands will be used to propagate environment variables and prepend path." + } + + $envVars.GetEnumerator() |% { + Set-Item -Path env:$($_.Key) -Value $_.Value + + # If we're running in Azure Pipelines, set these environment variables + if ($env:TF_BUILD) { + Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)" + } + } + + if ($IsMacOS -or $IsLinux) { + $env:PATH = "${DotNetInstallDir}:$env:PATH" + } else { + $env:PATH = "$DotNetInstallDir;$env:PATH" + } + + if ($env:TF_BUILD) { + Write-Host "##vso[task.prependpath]$DotNetInstallDir" } } From e4753b7b235a6969dc2be8d6b1d8bda7fafb8adc Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 9 Jul 2019 21:45:34 -0600 Subject: [PATCH 018/889] Add -Squash switch to Expand-Template.ps1 --- Expand-Template.ps1 | 14 +++++++++++++- azure-pipelines/expand-template.yml | 5 ++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index c1447d4c..7558ca51 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -10,6 +10,8 @@ A token obtained from codecov.io for your repo. If not specified, code coverage but can be added later by editing the Azure Pipelines YAML file. .PARAMETER CIFeed The `/{guid}` path to the Azure Pipelines artifact feed to push your nuget package to as part of your CI. +.PARAMETER Squash +A switch that causes all of git history to be squashed to just one initial commit for the template, and one for its expansion. #> [CmdletBinding()] Param( @@ -20,7 +22,9 @@ Param( [Parameter()] [string]$CodeCovToken, [Parameter()] - [string]$CIFeed + [string]$CIFeed, + [Parameter()] + [switch]$Squash ) function Replace-Placeholders { @@ -69,6 +73,11 @@ if (-not $sn) { Push-Location $PSScriptRoot try { + if ($Squash) { + git reset --soft $(git rev-list --max-parents=0 HEAD) + git commit --amend -qm "Initial template from https://github.com/AArnott/Library.Template" + } + # Rename project directories and solution Set-Location src git mv Library.sln "$LibraryName.sln" @@ -147,6 +156,9 @@ try { Write-Error "PLACEHOLDER discovered in $($_.FullName)" } } + + # Commit the changes + git commit -qm "Expanded template for $LibraryName" -m "This expansion done by the (now removed) Expand-Template.ps1 script." } finally { Pop-Location } diff --git a/azure-pipelines/expand-template.yml b/azure-pipelines/expand-template.yml index 708534d5..2d9ea7b3 100644 --- a/azure-pipelines/expand-template.yml +++ b/azure-pipelines/expand-template.yml @@ -3,7 +3,10 @@ steps: dotnet build-server shutdown git clean -fdx displayName: Cleaning repo for template expansion -- powershell: ./Expand-Template.ps1 -LibraryName Calc -Author "Andrew Arnott" +- powershell: | + git config user.name "test user" + git config user.email "andrewarnott@gmail.com" + ./Expand-Template.ps1 -LibraryName Calc -Author "Andrew Arnott" displayName: Expanding template failOnStderr: true # TODO: Verify that all changes are staged to the git index From 18164cfa4ecefc40d937a652c98dda68ff22ddc8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 10 Jul 2019 15:25:10 -0600 Subject: [PATCH 019/889] Add timeout to codecov publish step I saw this hang for a long time once, presumably when codecov.io was down. --- azure-pipelines/dotnet.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 668083e7..1ca019a0 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -53,3 +53,4 @@ steps: - bash: bash <(curl -s https://codecov.io/bash) displayName: Publish code coverage results to codecov.io condition: ne(variables['codecov_token'], '') + timeoutInMinutes: 3 From f4b75c2ffb7394ee4661f333c565d7446b70ffb5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 12 Jul 2019 09:39:31 -0600 Subject: [PATCH 020/889] Tests ruleset inherits from shipping one --- src/tests.ruleset | 72 ++--------------------------------------------- 1 file changed, 2 insertions(+), 70 deletions(-) diff --git a/src/tests.ruleset b/src/tests.ruleset index c74c6ed3..4b4708a1 100644 --- a/src/tests.ruleset +++ b/src/tests.ruleset @@ -1,75 +1,7 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - @@ -80,4 +12,4 @@ - \ No newline at end of file + From 26871ccaeafb1ce4d0c26ee08137bf39883c47ff Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 12 Jul 2019 13:17:52 -0600 Subject: [PATCH 021/889] Move jobs into build.yml --- Expand-Template.ps1 | 6 +++-- azure-pipelines.yml | 43 +----------------------------------- azure-pipelines/build.yml | 46 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 44 deletions(-) create mode 100644 azure-pipelines/build.yml diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 7558ca51..c050aba3 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -128,10 +128,12 @@ try { "(?m)^.*\[codecov\].*`r?`n"="" } - # Specially handle azure-pipelines.yml edits - $YmlReplacements = @{ + # Specially handle azure-pipelines .yml edits + Replace-Placeholders -Path "azure-pipelines/build.yml" -Replacements @{ "(?m).*expand-template\.yml(?:\r)?\n" = "" } + + $YmlReplacements = @{} if ($CodeCovToken) { $YmlReplacements['(codecov_token: ).*(#.*)'] = "`$1$CodeCovToken" } else { diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8bff4e89..f158ff52 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -18,45 +18,4 @@ variables: ci_feed: /a5a3bad0-e566-4c53-be83-6458be8d1653 # find guid used by Azure DevOps Artifacts for the feed jobs: -- job: Windows - pool: Hosted Windows 2019 with VS2019 - steps: - - template: azure-pipelines/install-dependencies.yml - - - powershell: | - dotnet tool install --tool-path .. nbgv --ignore-failed-sources - ../nbgv cloud - displayName: Set build number - workingDirectory: src - - - template: azure-pipelines/dotnet.yml - - template: azure-pipelines/expand-template.yml - -- job: Linux - pool: - vmImage: Ubuntu 16.04 - steps: - - template: azure-pipelines/install-dependencies.yml - - template: azure-pipelines/dotnet.yml - - template: azure-pipelines/expand-template.yml - -- job: macOS - pool: - vmImage: macOS 10.13 - steps: - - template: azure-pipelines/install-dependencies.yml - - template: azure-pipelines/dotnet.yml - - template: azure-pipelines/expand-template.yml - -- job: WrapUp - dependsOn: - - Windows - - Linux - - macOS - pool: - vmImage: Ubuntu 16.04 - condition: succeededOrFailed() - steps: - - template: azure-pipelines/install-dependencies.yml - - template: azure-pipelines/publish-codecoverage.yml - - template: azure-pipelines/publish-deployables.yml +- template: azure-pipelines/build.yml diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml new file mode 100644 index 00000000..75b7e0c3 --- /dev/null +++ b/azure-pipelines/build.yml @@ -0,0 +1,46 @@ +parameters: + windowsPool: Hosted Windows 2019 with VS2019 + +jobs: +- job: Windows + pool: ${{ parameters.windowsPool }} + steps: + - template: install-dependencies.yml + + - powershell: | + dotnet tool install --tool-path .. nbgv --ignore-failed-sources + ../nbgv cloud + displayName: Set build number + workingDirectory: src + + - template: dotnet.yml + - template: expand-template.yml + +- job: Linux + pool: + vmImage: Ubuntu 16.04 + steps: + - template: install-dependencies.yml + - template: dotnet.yml + - template: expand-template.yml + +- job: macOS + pool: + vmImage: macOS 10.13 + steps: + - template: install-dependencies.yml + - template: dotnet.yml + - template: expand-template.yml + +- job: WrapUp + dependsOn: + - Windows + - Linux + - macOS + pool: + vmImage: Ubuntu 16.04 + condition: succeededOrFailed() + steps: + - template: install-dependencies.yml + - template: publish-codecoverage.yml + - template: publish-deployables.yml From 1263ef34db6d2d749f4cdd33696f1bae4ec27fb6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 12 Jul 2019 13:32:27 -0600 Subject: [PATCH 022/889] Move nbgv installation in azp outside the src dir The Agent.ToolsDirectory is a popular place to put versioned tools like this. --- .gitignore | 3 +++ azure-pipelines/build.yml | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index fc1d26fa..e353101d 100644 --- a/.gitignore +++ b/.gitignore @@ -342,3 +342,6 @@ healthchecksdb # Backup folder for Package Reference Convert tool in Visual Studio 2017 MigrationBackup/ + +# dotnet tool local install directory +.store/ diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 75b7e0c3..3ee5b0b9 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -8,10 +8,9 @@ jobs: - template: install-dependencies.yml - powershell: | - dotnet tool install --tool-path .. nbgv --ignore-failed-sources - ../nbgv cloud + dotnet tool install --tool-path $(Agent.ToolsDirectory) nbgv --ignore-failed-sources + $(Agent.ToolsDirectory)/nbgv cloud displayName: Set build number - workingDirectory: src - template: dotnet.yml - template: expand-template.yml From ecb32a2ad6a0625bcaebec9bfcf44945cc63258d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 12 Jul 2019 13:33:09 -0600 Subject: [PATCH 023/889] Don't deploy packages to CI feed on PR builds --- azure-pipelines/publish-deployables.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml index 85c76e7b..cdd85292 100644 --- a/azure-pipelines/publish-deployables.yml +++ b/azure-pipelines/publish-deployables.yml @@ -4,6 +4,7 @@ steps: inputs: artifactName: deployables-Windows downloadPath: $(System.DefaultWorkingDirectory)/bin + - task: DotNetCoreCLI@2 displayName: Push packages to CI feed inputs: @@ -12,4 +13,4 @@ steps: nuGetFeedType: internal publishVstsFeed: $(ci_feed) allowPackageConflicts: true - condition: and(succeeded(), ne(variables['ci_feed'], '')) + condition: and(succeeded(), ne(variables['ci_feed'], ''), ne(variables['Build.Reason'], 'PullRequest')) From 13ab120e7f6f448092bffbff7d5ffc39b475ef70 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 12 Jul 2019 13:33:44 -0600 Subject: [PATCH 024/889] Make azp/artifacts only warn when they can't find files --- azure-pipelines/artifacts/_all.ps1 | 37 +++++++++++-------- azure-pipelines/artifacts/build_logs.ps1 | 2 + azure-pipelines/artifacts/coverageResults.ps1 | 4 +- azure-pipelines/artifacts/deployables.ps1 | 2 + .../artifacts/projectAssetsJson.ps1 | 8 ++-- 5 files changed, 33 insertions(+), 20 deletions(-) diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1 index bd5e9d34..6f62be5c 100644 --- a/azure-pipelines/artifacts/_all.ps1 +++ b/azure-pipelines/artifacts/_all.ps1 @@ -23,23 +23,28 @@ Function EnsureTrailingSlash($path) { Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% { $ArtifactName = $_.BaseName - (& $_).GetEnumerator() |% { - $BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key), [UriKind]::Absolute) - $_.Value |% { - if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) { - $_ = $_.FullName + $fileGroups = & $_ + if (!$fileGroups -or $fileGroups.Count -eq 0) { + Write-Warning "No files found for the `"$ArtifactName`" artifact." + } else { + $fileGroups.GetEnumerator() | % { + $BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key), [UriKind]::Absolute) + $_.Value | % { + if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) { + $_ = $_.FullName + } + + $artifact = New-Object -TypeName PSObject + Add-Member -InputObject $artifact -MemberType NoteProperty -Name ArtifactName -Value $ArtifactName + + $SourceFullPath = New-Object Uri ($BaseDirectory, $_) + Add-Member -InputObject $artifact -MemberType NoteProperty -Name Source -Value $SourceFullPath.LocalPath + + $RelativePath = [Uri]::UnescapeDataString($BaseDirectory.MakeRelative($SourceFullPath)) + Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath) + + Write-Output $artifact } - - $artifact = New-Object -TypeName PSObject - Add-Member -InputObject $artifact -MemberType NoteProperty -Name ArtifactName -Value $ArtifactName - - $SourceFullPath = New-Object Uri ($BaseDirectory, $_) - Add-Member -InputObject $artifact -MemberType NoteProperty -Name Source -Value $SourceFullPath.LocalPath - - $RelativePath = [Uri]::UnescapeDataString($BaseDirectory.MakeRelative($SourceFullPath)) - Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath) - - Write-Output $artifact } } } diff --git a/azure-pipelines/artifacts/build_logs.ps1 b/azure-pipelines/artifacts/build_logs.ps1 index 5ba801c5..b55ba48f 100644 --- a/azure-pipelines/artifacts/build_logs.ps1 +++ b/azure-pipelines/artifacts/build_logs.ps1 @@ -5,6 +5,8 @@ if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { $artifactsRoot = "$RepoRoot\bin" } +if (!(Test-Path $artifactsRoot/build_logs)) { return } + @{ "$artifactsRoot/build_logs" = (Get-ChildItem -Recurse "$artifactsRoot/build_logs") } diff --git a/azure-pipelines/artifacts/coverageResults.ps1 b/azure-pipelines/artifacts/coverageResults.ps1 index 36189f33..619ac0f3 100644 --- a/azure-pipelines/artifacts/coverageResults.ps1 +++ b/azure-pipelines/artifacts/coverageResults.ps1 @@ -9,9 +9,11 @@ if ($env:SYSTEM_DEFAULTWORKINGDIRECTORY) { Set-Content -Path $_ -Value $content -Encoding UTF8 } } else { - Write-Warning "Azure Pipelines not detected. Machine-neutral token replacement skipped." + Write-Warning "coverageResults: Azure Pipelines not detected. Machine-neutral token replacement skipped." } +if (!((Test-Path $RepoRoot\bin) -and (Test-Path $RepoRoot\obj))) { return } + @{ $RepoRoot = ( (Get-ChildItem "$RepoRoot\bin\coverage.cobertura.xml" -Recurse) + diff --git a/azure-pipelines/artifacts/deployables.ps1 b/azure-pipelines/artifacts/deployables.ps1 index 893df6dd..94c48cdd 100644 --- a/azure-pipelines/artifacts/deployables.ps1 +++ b/azure-pipelines/artifacts/deployables.ps1 @@ -6,6 +6,8 @@ if (!$BuildConfiguration) { $PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration" +if (!(Test-Path $PackagesRoot)) { return } + @{ "$PackagesRoot" = (Get-ChildItem $PackagesRoot -Recurse) } diff --git a/azure-pipelines/artifacts/projectAssetsJson.ps1 b/azure-pipelines/artifacts/projectAssetsJson.ps1 index 5e9217bd..d2e85ffb 100644 --- a/azure-pipelines/artifacts/projectAssetsJson.ps1 +++ b/azure-pipelines/artifacts/projectAssetsJson.ps1 @@ -1,7 +1,9 @@ -$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") +$ObjRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\obj") + +if (!(Test-Path $ObjRoot)) { return } @{ - "$RepoRoot\obj" = ( - (Get-ChildItem "$RepoRoot\obj\project.assets.json" -Recurse) + "$ObjRoot" = ( + (Get-ChildItem "$ObjRoot\project.assets.json" -Recurse) ); } From 3731857e1e4baa0782fedcd803fc7b5424598f9b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 12 Jul 2019 13:58:00 -0600 Subject: [PATCH 025/889] Collect symbols artifact and publish to ADO --- azure-pipelines/Convert-PDB.ps1 | 37 ++++++++++++++++ azure-pipelines/Get-NuGetTool.ps1 | 21 +++++++++ azure-pipelines/artifacts/symbols.ps1 | 64 +++++++++++++++++++++++++++ azure-pipelines/dotnet.yml | 9 ++++ 4 files changed, 131 insertions(+) create mode 100644 azure-pipelines/Convert-PDB.ps1 create mode 100644 azure-pipelines/Get-NuGetTool.ps1 create mode 100644 azure-pipelines/artifacts/symbols.ps1 diff --git a/azure-pipelines/Convert-PDB.ps1 b/azure-pipelines/Convert-PDB.ps1 new file mode 100644 index 00000000..00549f71 --- /dev/null +++ b/azure-pipelines/Convert-PDB.ps1 @@ -0,0 +1,37 @@ +<# +.SYNOPSIS + Builds all projects in this repo. +.PARAMETER DllPath + The path to the DLL whose PDB is to be converted. +.PARAMETER PdbPath + The path to the PDB to convert. May be omitted if the DLL was compiled on this machine and the PDB is still at its original path. +.PARAMETER OutputPath + The path of the output PDB to write. +#> +#Function Convert-PortableToWindowsPDB() { + Param( + [Parameter(Mandatory=$true,Position=0)] + [string]$DllPath, + [Parameter()] + [string]$PdbPath, + [Parameter(Mandatory=$true,Position=1)] + [string]$OutputPath + ) + + $version = '1.1.0-beta1-64128-01' + $baseDir = "$PSScriptRoot\..\obj\tools" + $pdb2pdbpath = "$baseDir\pdb2pdb.$version\tools\Pdb2Pdb.exe" + if (-not (Test-Path $pdb2pdbpath)) { + if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null } + $baseDir = (Resolve-Path $baseDir).Path # Normalize it + & (& $PSScriptRoot\Get-NuGetTool.ps1) install pdb2pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://dotnet.myget.org/F/symreader-converter/api/v3/index.json | Out-Null + } + + $args = $DllPath,'/out',$OutputPath,'/nowarn','0021' + if ($PdbPath) { + $args += '/pdb',$PdbPath + } + + Write-Verbose "$pdb2pdbpath $args" + & $pdb2pdbpath $args +#} diff --git a/azure-pipelines/Get-NuGetTool.ps1 b/azure-pipelines/Get-NuGetTool.ps1 new file mode 100644 index 00000000..59d6187a --- /dev/null +++ b/azure-pipelines/Get-NuGetTool.ps1 @@ -0,0 +1,21 @@ +<# +.SYNOPSIS + Downloads the NuGet.exe tool and returns the path to it. +.PARAMETER NuGetVersion + The version of the NuGet tool to acquire. +#> +Param( + [Parameter()] + [string]$NuGetVersion='5.0.2' +) + +$binaryToolsPath = "$PSScriptRoot\..\obj\tools\nuget.$NuGetVersion" +if (!(Test-Path $binaryToolsPath)) { $null = New-Item -Type Directory -Path $binaryToolsPath } +$nugetPath = "$binaryToolsPath\nuget.exe" + +if (!(Test-Path $nugetPath)) { + Write-Host "Downloading nuget.exe $NuGetVersion..." -ForegroundColor Yellow + Invoke-WebRequest -Uri "https://dist.nuget.org/win-x86-commandline/v$NuGetVersion/NuGet.exe" -OutFile $nugetPath | Out-Null +} + +Write-Output (Resolve-Path $nugetPath).Path diff --git a/azure-pipelines/artifacts/symbols.ps1 b/azure-pipelines/artifacts/symbols.ps1 new file mode 100644 index 00000000..50491368 --- /dev/null +++ b/azure-pipelines/artifacts/symbols.ps1 @@ -0,0 +1,64 @@ +Function Get-SymbolFiles { + [CmdletBinding()] + param ( + [parameter(Mandatory=$true)] + [string]$Path + ) + + $WindowsPdbSubDirName = "symstore" + + $ActivityName = "Collecting symbols from $Path" + Write-Progress -Activity $ActivityName -CurrentOperation "Discovery PDB files" + $PDBs = Get-ChildItem -rec "$Path\*.pdb" |? { $_.FullName -notmatch "unittest|tests|\W$WindowsPdbSubDirName\W" } + Write-Progress -Activity $ActivityName -CurrentOperation "De-duplicating symbols" + $PDBsByHash = @{} + $i = 0 + $PDBs |% { + Write-Progress -Activity $ActivityName -CurrentOperation "De-duplicating symbols" -PercentComplete (100 * $i / $PDBs.Length) + $hash = Get-FileHash $_ + $i++ + Add-Member -InputObject $_ -MemberType NoteProperty -Name Hash -Value $hash.Hash + Write-Output $_ + } | Sort-Object CreationTime |% { + # De-dupe based on hash. Prefer the first match so we take the first built copy. + if (-not $PDBsByHash.ContainsKey($_.Hash)) { + $PDBsByHash.Add($_.Hash, $_.FullName) + Write-Output $_ + } + } |% { + # Collect the DLLs/EXEs as well. + $dllPath = "$($_.Directory)\$($_.BaseName).dll" + $exePath = "$($_.Directory)\$($_.BaseName).exe" + if (Test-Path $dllPath) { + $BinaryImagePath = $dllPath + } elseif (Test-Path $exePath) { + $BinaryImagePath = $exePath + } + + Write-Output $BinaryImagePath + + # Convert the PDB to legacy Windows PDBs + Write-Host "Converting PDB for $_" -ForegroundColor DarkGray + $WindowsPdbDir = "$($_.Directory.FullName)\$WindowsPdbSubDirName" + if (!(Test-Path $WindowsPdbDir)) { mkdir $WindowsPdbDir | Out-Null } + & "$PSScriptRoot\..\Convert-PDB.ps1" -DllPath $BinaryImagePath -PdbPath $_ -OutputPath "$WindowsPdbDir\$($_.BaseName).pdb" + if ($LASTEXITCODE -ne 0) { + Write-Warning "PDB conversion of `"$_`" failed." + } + + Write-Output "$WindowsPdbDir\$($_.BaseName).pdb" + } +} + +# This doesn't work off Windows, nor do we need to convert symbols on multiple OS agents +if ($IsMacOS -or $IsLinux) { + return; +} + +$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin") +if (!(Test-Path $BinPath)) { return } +$symbolfiles = Get-SymbolFiles -Path $BinPath | Get-Unique + +@{ + "$BinPath" = $SymbolFiles; +} diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 1ca019a0..e14c1bbb 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -50,6 +50,15 @@ steps: displayName: Publish artifacts condition: succeededOrFailed() +- task: PublishSymbols@2 + inputs: + SymbolsFolder: $(Build.ArtifactStagingDirectory)/symbols-Windows + SearchPattern: '**/*.pdb' + IndexSources: false + SymbolServerType: TeamServices + displayName: Publish symbols to symbol server + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Agent.OS'], 'Windows_NT')) + - bash: bash <(curl -s https://codecov.io/bash) displayName: Publish code coverage results to codecov.io condition: ne(variables['codecov_token'], '') From 46d8abc111c18c3ffba75a3ab8e4f379eda2cef2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 12 Jul 2019 22:03:09 -0600 Subject: [PATCH 026/889] Don't fail build when codecov.io is down --- azure-pipelines/dotnet.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index e14c1bbb..6641ebb9 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -63,3 +63,4 @@ steps: displayName: Publish code coverage results to codecov.io condition: ne(variables['codecov_token'], '') timeoutInMinutes: 3 + continueOnError: true From 1ae312b50b3247ef07ae48a9b98f0c897b40ef2b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 13 Jul 2019 01:25:59 -0600 Subject: [PATCH 027/889] Stop calling chmod on Windows Not all custom Windows agents have this available. --- tools/Install-DotNetSdk.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 9db8558f..3061edf8 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -56,7 +56,9 @@ if ($IsMacOS -or $IsLinux) { if (-not (Test-Path $DotNetInstallScriptPath)) { Invoke-WebRequest -Uri $DownloadUri -OutFile $DotNetInstallScriptPath - chmod +x $DotNetInstallScriptPath + if ($IsMacOS -or $IsLinux) { + chmod +x $DotNetInstallScriptPath + } } if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { From 8bd008e9cef9a7499a767bb30c9fd14f78f97f73 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 13 Jul 2019 01:42:22 -0600 Subject: [PATCH 028/889] Avoid ln on Windows Some custom Windows agents don't have this --- azure-pipelines/artifacts/_pipelines.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/artifacts/_pipelines.ps1 b/azure-pipelines/artifacts/_pipelines.ps1 index 59dd2cf2..dce2d5a8 100644 --- a/azure-pipelines/artifacts/_pipelines.ps1 +++ b/azure-pipelines/artifacts/_pipelines.ps1 @@ -30,7 +30,11 @@ function Create-SymbolicLink { $LinkContainer = Split-Path $Link -Parent if (!(Test-Path $LinkContainer)) { mkdir $LinkContainer } Write-Verbose "Linking $Link to $Target" - ln $Target $Link + if ($IsMacOS -or $IsLinux) { + ln $Target $Link + } else { + cmd /c mklink $Link $Target + } } # Stage all artifacts From 354c7db5d602f3e7e6436b3b8cd28e00193e1685 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 13 Jul 2019 01:46:28 -0600 Subject: [PATCH 029/889] Install nbgv to Agent.TempDirectory Avoids errors when nbgv is already installed on a custom agent --- azure-pipelines/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 3ee5b0b9..7e18277e 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -8,8 +8,8 @@ jobs: - template: install-dependencies.yml - powershell: | - dotnet tool install --tool-path $(Agent.ToolsDirectory) nbgv --ignore-failed-sources - $(Agent.ToolsDirectory)/nbgv cloud + dotnet tool install --tool-path $(Agent.TempDirectory) nbgv --ignore-failed-sources + $(Agent.TempDirectory)/nbgv cloud displayName: Set build number - template: dotnet.yml From 2da189df18af52ab540789cd9f1a0430feb87d4a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 13 Jul 2019 01:49:37 -0600 Subject: [PATCH 030/889] Display dotnet --info after prereq installation --- azure-pipelines/install-dependencies.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 38fa5c08..2e6a3234 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -5,5 +5,7 @@ steps: failOnStderr: true displayName: Set pipeline variables based on source -- powershell: .\init.ps1 +- powershell: | + .\init.ps1 + dotnet --info displayName: Install prerequisites From fd0a7b25ccf030bbd16880cca6efe009d5b1fffc Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 12 Jul 2019 22:29:54 -0600 Subject: [PATCH 031/889] Add MicroBuild specific files and traits --- Expand-Template.ps1 | 10 ++++----- azure-pipelines.yml | 3 +-- azure-pipelines/build.yml | 8 +++++++ azure-pipelines/clear-packagecaches.yml | 7 +++++++ azure-pipelines/microbuild.after.yml | 8 +++++++ azure-pipelines/microbuild.before.yml | 6 ++++++ azure-pipelines/microbuild.yml | 21 +++++++++++++++++++ azure-pipelines/publish-deployables.yml | 2 +- .../variables/InsertConfigValues.ps1 | 14 +++++++++++++ .../variables/InsertTargetBranch.ps1 | 2 ++ .../variables/InsertVersionsValues.ps1 | 9 ++++++++ azure-pipelines/variables/SignType.ps1 | 3 +++ azure-pipelines/variables/TeamName.ps1 | 1 + azure-pipelines/variables/ci_feed.ps1 | 5 +++++ src/Directory.Build.props | 5 +++-- 15 files changed, 94 insertions(+), 10 deletions(-) create mode 100644 azure-pipelines/clear-packagecaches.yml create mode 100644 azure-pipelines/microbuild.after.yml create mode 100644 azure-pipelines/microbuild.before.yml create mode 100644 azure-pipelines/microbuild.yml create mode 100644 azure-pipelines/variables/InsertConfigValues.ps1 create mode 100644 azure-pipelines/variables/InsertTargetBranch.ps1 create mode 100644 azure-pipelines/variables/InsertVersionsValues.ps1 create mode 100644 azure-pipelines/variables/SignType.ps1 create mode 100644 azure-pipelines/variables/TeamName.ps1 create mode 100644 azure-pipelines/variables/ci_feed.ps1 diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index c050aba3..31597948 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -139,13 +139,13 @@ try { } else { $YmlReplacements['(codecov_token: ).*(#.*)'] = "#`$1`$2" } - if ($CIFeed) { - $YmlReplacements['(ci_feed: ).*(#.*)'] = "`$1$CIFeed" - } else { - $YmlReplacements['(ci_feed: ).*(#.*)'] = "#`$1`$2" - } Replace-Placeholders -Path "azure-pipelines.yml" -Replacements $YmlReplacements + Replace-Placeholders -Path "azure-pipelines/variables/InsertVersionsValues.ps1" -Replacements @{ + 'LibraryName' = $LibraryName; + 'LibraryNoDots' = $LibraryName.Replace('.',''); + } + # Self destruct $Invocation = (Get-Variable MyInvocation -Scope 1).Value git rm Expand-Template.ps1 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f158ff52..39db1880 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -14,8 +14,7 @@ variables: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release BuildPlatform: Any CPU - codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ - ci_feed: /a5a3bad0-e566-4c53-be83-6458be8d1653 # find guid used by Azure DevOps Artifacts for the feed + # codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ jobs: - template: azure-pipelines/build.yml diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 7e18277e..a291a46a 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -5,6 +5,7 @@ jobs: - job: Windows pool: ${{ parameters.windowsPool }} steps: + - template: clear-packagecaches.yml - template: install-dependencies.yml - powershell: | @@ -12,7 +13,14 @@ jobs: $(Agent.TempDirectory)/nbgv cloud displayName: Set build number + - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + - template: microbuild.before.yml + - template: dotnet.yml + + - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + - template: microbuild.after.yml + - template: expand-template.yml - job: Linux diff --git a/azure-pipelines/clear-packagecaches.yml b/azure-pipelines/clear-packagecaches.yml new file mode 100644 index 00000000..86c327ec --- /dev/null +++ b/azure-pipelines/clear-packagecaches.yml @@ -0,0 +1,7 @@ +steps: +- powershell: | + "$env:userprofile\.nuget\packages", "$env:LocalAppData\NuGet\Cache", "$env:AppData\tsd-cache" |% { + if (Test-Path $_) { Remove-Item $_ -Recurse -Force } + } + displayName: Purge package caches + condition: eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml new file mode 100644 index 00000000..8601dfaa --- /dev/null +++ b/azure-pipelines/microbuild.after.yml @@ -0,0 +1,8 @@ +steps: +- task: MicroBuildCleanup@1 + condition: succeededOrFailed() + displayName: MicroBuild Cleanup + +- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 + displayName: Component Detection + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml new file mode 100644 index 00000000..310b559e --- /dev/null +++ b/azure-pipelines/microbuild.before.yml @@ -0,0 +1,6 @@ +steps: +- task: MicroBuildSigningPlugin@1 + inputs: + signType: $(SignType) + zipSources: false + displayName: Install MicroBuild Signing Plugin diff --git a/azure-pipelines/microbuild.yml b/azure-pipelines/microbuild.yml new file mode 100644 index 00000000..6e259858 --- /dev/null +++ b/azure-pipelines/microbuild.yml @@ -0,0 +1,21 @@ +trigger: + branches: + include: + - master + - validate/* + paths: + exclude: + - doc/ + - '*.md' + - .vscode/ + +variables: + TreatWarningsAsErrors: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + BuildConfiguration: Release + BuildPlatform: Any CPU + +jobs: +- template: build.yml + parameters: + windowsPool: VSEng-MicroBuildVS2019 diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml index cdd85292..facc50af 100644 --- a/azure-pipelines/publish-deployables.yml +++ b/azure-pipelines/publish-deployables.yml @@ -9,7 +9,7 @@ steps: displayName: Push packages to CI feed inputs: command: push - packagesToPush: $(System.DefaultWorkingDirectory)/bin/deployables-Windows/*.nupkg + packagesToPush: $(System.DefaultWorkingDirectory)/bin/deployables-Windows/NuGet/*.nupkg nuGetFeedType: internal publishVstsFeed: $(ci_feed) allowPackageConflicts: true diff --git a/azure-pipelines/variables/InsertConfigValues.ps1 b/azure-pipelines/variables/InsertConfigValues.ps1 new file mode 100644 index 00000000..bd53ae8d --- /dev/null +++ b/azure-pipelines/variables/InsertConfigValues.ps1 @@ -0,0 +1,14 @@ +$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin\Packages\$env:BuildConfiguration") + +$icv=@() +if (Test-Path "$BinPath") { + Get-ChildItem -Path "$BinPath\*.nupkg" -rec |% { + if ($_.Name -match "^(.*)\.(\d+\.\d+\.\d+(?:-.*?)?)(?:\.symbols)?\.nupkg$") { + $id = $Matches[1] + $version = $Matches[2] + $icv += "$id=$version" + } + } +} + +Write-Output ([string]::join(',',$icv)) diff --git a/azure-pipelines/variables/InsertTargetBranch.ps1 b/azure-pipelines/variables/InsertTargetBranch.ps1 new file mode 100644 index 00000000..67462ece --- /dev/null +++ b/azure-pipelines/variables/InsertTargetBranch.ps1 @@ -0,0 +1,2 @@ +# This is the default branch of the VS repo that we will use to insert into VS. +'master' diff --git a/azure-pipelines/variables/InsertVersionsValues.ps1 b/azure-pipelines/variables/InsertVersionsValues.ps1 new file mode 100644 index 00000000..73e54f26 --- /dev/null +++ b/azure-pipelines/variables/InsertVersionsValues.ps1 @@ -0,0 +1,9 @@ +# When you need binding redirects in the VS repo updated to match +# assemblies that you build here, remove the "return" statement +# and update the hashtable below with the T4 macro you'll use for +# your libraries as defined in the src\ProductData\AssemblyVersions.tt file. +return + +[string]::join(',',(@{ + ('LibraryNoDotsVersion') = & { (nbgv get-version --project "$PSScriptRoot\..\..\src\LibraryName" --format json | ConvertFrom-Json).AssemblyVersion }; +}.GetEnumerator() |% { "$($_.key)=$($_.value)" })) diff --git a/azure-pipelines/variables/SignType.ps1 b/azure-pipelines/variables/SignType.ps1 new file mode 100644 index 00000000..7d3a4729 --- /dev/null +++ b/azure-pipelines/variables/SignType.ps1 @@ -0,0 +1,3 @@ +if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9') { + 'test' +} diff --git a/azure-pipelines/variables/TeamName.ps1 b/azure-pipelines/variables/TeamName.ps1 new file mode 100644 index 00000000..871749a5 --- /dev/null +++ b/azure-pipelines/variables/TeamName.ps1 @@ -0,0 +1 @@ +'VS IDE' diff --git a/azure-pipelines/variables/ci_feed.ps1 b/azure-pipelines/variables/ci_feed.ps1 new file mode 100644 index 00000000..2d6ef8e6 --- /dev/null +++ b/azure-pipelines/variables/ci_feed.ps1 @@ -0,0 +1,5 @@ +if ($env:SignType -eq 'Real') { + '09d8d03c-1ac8-456e-9274-4d2364527d99' # VSIDE-RealSigned-Release +} else { + 'da484c78-f942-44ef-b197-99e2a1bef53c' # VSIDE-TestSigned-Release +} diff --git a/src/Directory.Build.props b/src/Directory.Build.props index f4ef3297..77f29029 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -5,7 +5,7 @@ $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\')) $(RepoRootPath)obj\$(MSBuildProjectName)\ $(RepoRootPath)bin\$(MSBuildProjectName)\ - $(RepoRootPath)bin\Packages\$(Configuration)\ + $(RepoRootPath)bin\Packages\$(Configuration)\NuGet\ 7.3 true @@ -25,7 +25,8 @@ - + + From 00bcb28bfc4095207bab694ca2ae8a71810733be Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 15 Jul 2019 10:35:04 -0600 Subject: [PATCH 032/889] Add init.cmd, nbgv tool improvements, etc. --- azure-pipelines/Get-nbgv.ps1 | 29 +++++++++++++++++++++++ azure-pipelines/artifacts/_pipelines.ps1 | 1 - azure-pipelines/build.yml | 10 +++++--- azure-pipelines/install-dependencies.yml | 11 +++++---- azure-pipelines/nbgv.nuget.config | 7 ++++++ azure-pipelines/variables/_all.ps1 | 1 + init.cmd | 3 +++ tools/Install-DotNetSdk.ps1 | 30 +++++++++++++++++------- 8 files changed, 74 insertions(+), 18 deletions(-) create mode 100644 azure-pipelines/Get-nbgv.ps1 create mode 100644 azure-pipelines/nbgv.nuget.config create mode 100644 init.cmd diff --git a/azure-pipelines/Get-nbgv.ps1 b/azure-pipelines/Get-nbgv.ps1 new file mode 100644 index 00000000..bc9c11c8 --- /dev/null +++ b/azure-pipelines/Get-nbgv.ps1 @@ -0,0 +1,29 @@ +<# +.SYNOPSIS + Gets the path to the nbgv CLI tool, installing it if necessary. +#> +Param( +) + +$existingTool = Get-Command "nbgv" -ErrorAction SilentlyContinue +if ($existingTool) { + return $existingTool.Path +} + +if ($env:AGENT_TEMPDIRECTORY) { + $toolInstallDir = "$env:AGENT_TEMPDIRECTORY/$env:BUILD_BUILDID" +} else { + $toolInstallDir = "$PSScriptRoot/obj/tools" +} + +$toolPath = "$toolInstallDir/nbgv" +if (!(Test-Path $toolPath)) { New-Item -Path $toolPath -ItemType Directory | Out-Null } +$toolPath = (Resolve-Path $toolPath).Path + +if (!(Get-Command $toolPath -ErrorAction SilentlyContinue)) { + Write-Host "Installing nbgv to $toolInstallDir" + dotnet tool install --tool-path "$toolInstallDir" nbgv --configfile "$PSScriptRoot\nbgv.nuget.config" | Out-Null +} + +# Normalize the path on the way out. +return (Get-Command $toolPath).Path diff --git a/azure-pipelines/artifacts/_pipelines.ps1 b/azure-pipelines/artifacts/_pipelines.ps1 index dce2d5a8..270a9604 100644 --- a/azure-pipelines/artifacts/_pipelines.ps1 +++ b/azure-pipelines/artifacts/_pipelines.ps1 @@ -6,7 +6,6 @@ param ( ) $RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") -if (!$env:BUILDCONFIGURATION) { throw "BUILDCONFIGURATION environment variable must be set." } if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { $ArtifactStagingFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY } else { diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 7e18277e..6eeca905 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -5,11 +5,11 @@ jobs: - job: Windows pool: ${{ parameters.windowsPool }} steps: + - checkout: self + clean: true # "all" doesn't work, but "true" does, despite YAML docs - template: install-dependencies.yml - - powershell: | - dotnet tool install --tool-path $(Agent.TempDirectory) nbgv --ignore-failed-sources - $(Agent.TempDirectory)/nbgv cloud + - powershell: '& (azure-pipelines\Get-nbgv.ps1) cloud' displayName: Set build number - template: dotnet.yml @@ -19,6 +19,8 @@ jobs: pool: vmImage: Ubuntu 16.04 steps: + - checkout: self + clean: true # "all" doesn't work, but "true" does, despite YAML docs - template: install-dependencies.yml - template: dotnet.yml - template: expand-template.yml @@ -40,6 +42,8 @@ jobs: vmImage: Ubuntu 16.04 condition: succeededOrFailed() steps: + - checkout: self + clean: true # "all" doesn't work, but "true" does, despite YAML docs - template: install-dependencies.yml - template: publish-codecoverage.yml - template: publish-deployables.yml diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 2e6a3234..beacc44d 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -1,11 +1,12 @@ steps: -- task: PowerShell@2 - inputs: - filePath: azure-pipelines/variables/_pipelines.ps1 - failOnStderr: true - displayName: Set pipeline variables based on source - powershell: | .\init.ps1 dotnet --info displayName: Install prerequisites + +- task: PowerShell@2 + inputs: + filePath: azure-pipelines/variables/_pipelines.ps1 + failOnStderr: true + displayName: Set pipeline variables based on source diff --git a/azure-pipelines/nbgv.nuget.config b/azure-pipelines/nbgv.nuget.config new file mode 100644 index 00000000..765346e5 --- /dev/null +++ b/azure-pipelines/nbgv.nuget.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/azure-pipelines/variables/_all.ps1 b/azure-pipelines/variables/_all.ps1 index 680a3398..ed099792 100644 --- a/azure-pipelines/variables/_all.ps1 +++ b/azure-pipelines/variables/_all.ps1 @@ -4,6 +4,7 @@ $vars = @{} Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" |% { + Write-Host "Computing $($_.BaseName) variable" $vars[$_.BaseName] = & $_ } diff --git a/init.cmd b/init.cmd new file mode 100644 index 00000000..5bef08da --- /dev/null +++ b/init.cmd @@ -0,0 +1,3 @@ +@set PS1UnderCmd=1 +powershell.exe -ExecutionPolicy bypass -Command "& '%~dpn0.ps1'" %* +@set PS1UnderCmd= diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 3061edf8..2eccce41 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -93,14 +93,17 @@ $runtimeVersions | Get-Unique |% { } } -Write-Host "Environment variables to be set:" -ForegroundColor Blue -$envVars - if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these installed runtimes?")) { if ($env:TF_BUILD) { Write-Host "Azure Pipelines detected. Logging commands will be used to propagate environment variables and prepend path." } + if ($IsMacOS -or $IsLinux) { + $envVars['PATH'] = "${DotNetInstallDir}:$env:PATH" + } else { + $envVars['PATH'] = "$DotNetInstallDir;$env:PATH" + } + $envVars.GetEnumerator() |% { Set-Item -Path env:$($_.Key) -Value $_.Value @@ -110,13 +113,22 @@ if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these } } - if ($IsMacOS -or $IsLinux) { - $env:PATH = "${DotNetInstallDir}:$env:PATH" - } else { - $env:PATH = "$DotNetInstallDir;$env:PATH" - } - if ($env:TF_BUILD) { Write-Host "##vso[task.prependpath]$DotNetInstallDir" } } + +if ($env:PS1UnderCmd -eq '1') { + Write-Warning "Environment variable changes will be lost because you're running under cmd.exe. Run these commands manually:" + $envVars.GetEnumerator() |% { + if ($_.Key -eq 'PATH') { + # Special case this one for readability + Write-Host "SET PATH=$DotNetInstallDir;%PATH%" + } else { + Write-Host "SET $($_.Key)=$($_.Value)" + } + } +} else { + Write-Host "Environment variables set:" -ForegroundColor Blue + $envVars +} From 186195f0397bbcf9d93584dd70689b5c88d76946 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 15 Jul 2019 10:35:14 -0600 Subject: [PATCH 033/889] Get nbgv from install location --- azure-pipelines/variables/InsertVersionsValues.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/variables/InsertVersionsValues.ps1 b/azure-pipelines/variables/InsertVersionsValues.ps1 index 73e54f26..515e0571 100644 --- a/azure-pipelines/variables/InsertVersionsValues.ps1 +++ b/azure-pipelines/variables/InsertVersionsValues.ps1 @@ -4,6 +4,7 @@ # your libraries as defined in the src\ProductData\AssemblyVersions.tt file. return +$nbgv = & "$PSScriptRoot\..\Get-nbgv.ps1" [string]::join(',',(@{ - ('LibraryNoDotsVersion') = & { (nbgv get-version --project "$PSScriptRoot\..\..\src\LibraryName" --format json | ConvertFrom-Json).AssemblyVersion }; + ('LibraryNoDotsVersion') = & { (& $nbgv get-version --project "$PSScriptRoot\..\..\src\LibraryName" --format json | ConvertFrom-Json).AssemblyVersion }; }.GetEnumerator() |% { "$($_.key)=$($_.value)" })) From 1d1e056056c52e52b219643b7051463190c7d752 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 15 Jul 2019 10:59:01 -0600 Subject: [PATCH 034/889] Avoid double push of package to CI When both microbuild.yml and azure-pipelines.yml are building, we don't want to push packages from both to the CI package feed. --- azure-pipelines/microbuild.yml | 1 + azure-pipelines/publish-deployables.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/microbuild.yml b/azure-pipelines/microbuild.yml index 6e259858..0254a9e2 100644 --- a/azure-pipelines/microbuild.yml +++ b/azure-pipelines/microbuild.yml @@ -14,6 +14,7 @@ variables: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release BuildPlatform: Any CPU + push_to_ci: true jobs: - template: build.yml diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml index facc50af..fee648e1 100644 --- a/azure-pipelines/publish-deployables.yml +++ b/azure-pipelines/publish-deployables.yml @@ -13,4 +13,4 @@ steps: nuGetFeedType: internal publishVstsFeed: $(ci_feed) allowPackageConflicts: true - condition: and(succeeded(), ne(variables['ci_feed'], ''), ne(variables['Build.Reason'], 'PullRequest')) + condition: and(succeeded(), eq(variables['push_to_ci'], 'true'), ne(variables['ci_feed'], ''), ne(variables['Build.Reason'], 'PullRequest')) From 0691c8d0a1fda51e45e6d21bb9e73eefe74b3e0c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 16 Jul 2019 12:32:54 -0600 Subject: [PATCH 035/889] Avoid error when exactly one coverage.cobertura.xml file is found --- azure-pipelines/artifacts/coverageResults.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/artifacts/coverageResults.ps1 b/azure-pipelines/artifacts/coverageResults.ps1 index 619ac0f3..7d1e9a35 100644 --- a/azure-pipelines/artifacts/coverageResults.ps1 +++ b/azure-pipelines/artifacts/coverageResults.ps1 @@ -16,7 +16,7 @@ if (!((Test-Path $RepoRoot\bin) -and (Test-Path $RepoRoot\obj))) { return } @{ $RepoRoot = ( - (Get-ChildItem "$RepoRoot\bin\coverage.cobertura.xml" -Recurse) + + @(Get-ChildItem "$RepoRoot\bin\coverage.cobertura.xml" -Recurse) + (Get-ChildItem "$RepoRoot\obj\*.cs" -Recurse) ); } From 5e96a0b15c66226b05727ae79b1595936ff30f04 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 16 Jul 2019 14:51:24 -0600 Subject: [PATCH 036/889] Fix feed auth failure when merging reports It's important to always explicitly specify a nuget.config file when using dotnet tool install so that if a nuget.config file is present with feeds that require authentication, they are not tried. --- azure-pipelines/Get-nbgv.ps1 | 2 +- .../{nbgv.nuget.config => justnugetorg.nuget.config} | 0 azure-pipelines/publish-codecoverage.yml | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename azure-pipelines/{nbgv.nuget.config => justnugetorg.nuget.config} (100%) diff --git a/azure-pipelines/Get-nbgv.ps1 b/azure-pipelines/Get-nbgv.ps1 index bc9c11c8..8459995f 100644 --- a/azure-pipelines/Get-nbgv.ps1 +++ b/azure-pipelines/Get-nbgv.ps1 @@ -22,7 +22,7 @@ $toolPath = (Resolve-Path $toolPath).Path if (!(Get-Command $toolPath -ErrorAction SilentlyContinue)) { Write-Host "Installing nbgv to $toolInstallDir" - dotnet tool install --tool-path "$toolInstallDir" nbgv --configfile "$PSScriptRoot\nbgv.nuget.config" | Out-Null + dotnet tool install --tool-path "$toolInstallDir" nbgv --configfile "$PSScriptRoot\justnugetorg.nuget.config" | Out-Null } # Normalize the path on the way out. diff --git a/azure-pipelines/nbgv.nuget.config b/azure-pipelines/justnugetorg.nuget.config similarity index 100% rename from azure-pipelines/nbgv.nuget.config rename to azure-pipelines/justnugetorg.nuget.config diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index b9b7b72a..5d987c83 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -18,7 +18,7 @@ steps: downloadPath: $(System.DefaultWorkingDirectory)/bin continueOnError: true - powershell: | - dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.2.2 + dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.2.2 --configfile azure-pipelines/justnugetorg.nuget.config Copy-Item -Recurse $(System.DefaultWorkingDirectory)/bin/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj Write-Host "Substituting {reporoot} with $(System.DefaultWorkingDirectory)" $reports = Get-ChildItem -Recurse "$(System.DefaultWorkingDirectory)/bin/coverage.cobertura.xml" From 14f9967ebff169310e80eefcc3d96d809807b217 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 22 Jul 2019 09:22:25 -0600 Subject: [PATCH 037/889] Stop generating a proprietary strong name key --- Expand-Template.ps1 | 4 ---- src/Directory.Build.props | 1 - src/strongname.snk | Bin 596 -> 0 bytes 3 files changed, 5 deletions(-) delete mode 100644 src/strongname.snk diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 31597948..b32c3503 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -98,10 +98,6 @@ try { dotnet remove "$LibraryName.Tests" reference Library/Library.csproj git add "$LibraryName.Tests/$LibraryName.Tests.csproj" - # Establish a new strong-name key - & $sn.Path -k 2048 strongname.snk - git add strongname.snk - Set-Location .. # Replace placeholders in source files diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 77f29029..ca8edba3 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -10,7 +10,6 @@ true true - $(MSBuildThisFileDirectory)\strongname.snk COMPANY-PLACEHOLDER COMPANY-PLACEHOLDER diff --git a/src/strongname.snk b/src/strongname.snk deleted file mode 100644 index a4d0a2ce39df5f7c284340b4a2c4690385c44208..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50097Td7B6KsP|cl#<{bONo_!&t)QUG9wW^j zM1zvNAOI=XF}potSO>54lS%MGl8tv)xYTSw?~K<1McvNlJ;DITeY__C?><|;F`bgX zj;&2ME}KBWPb0zVSK+iW?{2`tzZR-#x0K_|t&0FhD+3urA!lNmCH;&b|?g|_AC39ox-0 zcV%KJis3}%`RVWSXN58fc}#LF$A#kcB2VWh=MH0zs+k7{ zQT<5V>NGhWzC7Jnt4A?n%Kk`fPt&FR4k~q{TSW%@D{plIpotzop}i+x`~C))*Vr-i zrW2)aE17f*=wCRa_#bHkYlQko_Jh)wN@;?yML9mYk)XZ`l6IQ*D7xZmmL=m(T|zMG i={(T>StYQl!YSPV From 5ee62bfe3556f392e9e1bfddcf2b25fd640e2b9e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 22 Jul 2019 09:48:42 -0600 Subject: [PATCH 038/889] Add support for Azure Artifact authenticated feeds --- CONTRIBUTING.md | 6 +++ azure-pipelines/Get-NuGetTool.ps1 | 9 ++-- azure-pipelines/Get-TempToolsPath.ps1 | 13 +++++ azure-pipelines/Set-EnvVars.ps1 | 39 +++++++++++++++ azure-pipelines/build.yml | 2 + azure-pipelines/dotnet.yml | 3 -- azure-pipelines/install-dependencies.yml | 5 +- init.ps1 | 39 ++++++++++++++- nuget.config | 2 +- tools/Install-NuGetCredProvider.ps1 | 62 ++++++++++++++++++++++++ 10 files changed, 169 insertions(+), 11 deletions(-) create mode 100644 azure-pipelines/Get-TempToolsPath.ps1 create mode 100644 azure-pipelines/Set-EnvVars.ps1 create mode 100644 tools/Install-NuGetCredProvider.ps1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f2f4a8ca..0893b308 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,6 +27,12 @@ using Windows PowerShell or [PowerShell Core][pwsh] (on any OS). This repository can be built on Windows, Linux, and OSX. +## Package restore + +The easiest way to restore packages may be to run `init.ps1` which automatically authenticates +to the feeds that packages for this repo come from, if any. +`dotnet restore` or `nuget restore` also work but may require extra steps to authenticate to any applicable feeds. + ## Building Building, testing, and packing this repository can be done by using the standard dotnet CLI commands (e.g. `dotnet build`, `dotnet test`, `dotnet pack`, etc.). diff --git a/azure-pipelines/Get-NuGetTool.ps1 b/azure-pipelines/Get-NuGetTool.ps1 index 59d6187a..fdf3ed55 100644 --- a/azure-pipelines/Get-NuGetTool.ps1 +++ b/azure-pipelines/Get-NuGetTool.ps1 @@ -9,13 +9,14 @@ Param( [string]$NuGetVersion='5.0.2' ) -$binaryToolsPath = "$PSScriptRoot\..\obj\tools\nuget.$NuGetVersion" -if (!(Test-Path $binaryToolsPath)) { $null = New-Item -Type Directory -Path $binaryToolsPath } -$nugetPath = "$binaryToolsPath\nuget.exe" +$toolsPath = & "$PSScriptRoot\Get-TempToolsPath.ps1" +$binaryToolsPath = Join-Path $toolsPath $NuGetVersion +if (!(Test-Path $binaryToolsPath)) { $null = mkdir $binaryToolsPath } +$nugetPath = Join-Path $binaryToolsPath nuget.exe if (!(Test-Path $nugetPath)) { Write-Host "Downloading nuget.exe $NuGetVersion..." -ForegroundColor Yellow Invoke-WebRequest -Uri "https://dist.nuget.org/win-x86-commandline/v$NuGetVersion/NuGet.exe" -OutFile $nugetPath | Out-Null } -Write-Output (Resolve-Path $nugetPath).Path +return (Resolve-Path $nugetPath).Path diff --git a/azure-pipelines/Get-TempToolsPath.ps1 b/azure-pipelines/Get-TempToolsPath.ps1 new file mode 100644 index 00000000..97c552c0 --- /dev/null +++ b/azure-pipelines/Get-TempToolsPath.ps1 @@ -0,0 +1,13 @@ +if ($env:AGENT_TOOLSDIRECTORY) { + $path = "$env:AGENT_TOOLSDIRECTORY\vs-platform\tools" +} elseif ($env:localappdata) { + $path = "$env:localappdata\vs-platform\tools" +} else { + $path = "$PSScriptRoot\..\obj\tools" +} + +if (!(Test-Path $path)) { + New-Item -ItemType Directory -Path $Path | Out-Null +} + +(Resolve-Path $path).Path diff --git a/azure-pipelines/Set-EnvVars.ps1 b/azure-pipelines/Set-EnvVars.ps1 new file mode 100644 index 00000000..313cecff --- /dev/null +++ b/azure-pipelines/Set-EnvVars.ps1 @@ -0,0 +1,39 @@ +<# +.SYNOPSIS + Set environment variables in the environment. + Azure Pipeline and CMD environments are considered. +.PARAMETER Variables + A hashtable of variables to be set. +.OUTPUTS + A boolean indicating whether the environment variables can be expected to propagate to the caller's environment. +#> +[CmdletBinding(SupportsShouldProcess=$true)] +Param( + [Parameter(Mandatory=$true, Position=1)] + $Variables +) + +if ($Variables.Count -eq 0) { + return $true +} + +$cmdInstructions = !$env:TF_BUILD -and $env:PS1UnderCmd -eq '1' +if ($cmdInstructions) { + Write-Warning "Environment variables have been set that will be lost because you're running under cmd.exe" + Write-Host "Environment variables that must be set manually:" -ForegroundColor Blue +} + +$Variables.GetEnumerator() |% { + Set-Item -Path env:$($_.Key) -Value $_.Value + + # If we're running in Azure Pipelines, set these environment variables + if ($env:TF_BUILD) { + Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)" + } + + if ($cmdInstructions) { + Write-Host "SET $($_.Key)=$($_.Value)" + } +} + +return !$cmdInstructions diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 6eeca905..f81d7f14 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -45,5 +45,7 @@ jobs: - checkout: self clean: true # "all" doesn't work, but "true" does, despite YAML docs - template: install-dependencies.yml + parameters: + initArgs: -NoRestore - template: publish-codecoverage.yml - template: publish-deployables.yml diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 6641ebb9..96569224 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -1,7 +1,4 @@ steps: -- script: dotnet restore /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/restore.binlog" - displayName: dotnet restore - workingDirectory: src - script: dotnet build --no-restore -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" displayName: dotnet build diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index beacc44d..8da07957 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -1,7 +1,10 @@ +parameters: + initArgs: + steps: - powershell: | - .\init.ps1 + .\init.ps1 -AccessToken '$(System.AccessToken)' ${{ parameters['initArgs'] }} dotnet --info displayName: Install prerequisites diff --git a/init.ps1 b/init.ps1 index 41e5556b..17389cbc 100644 --- a/init.ps1 +++ b/init.ps1 @@ -9,11 +9,46 @@ Per-user allows sharing the installed dependencies across repositories and allow Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. +.PARAMETER NoPrerequisites +Skips the installation of prerequisite software (e.g. SDKs, tools). +.PARAMETER NoRestore +Skips the package restore step. +.PARAMETER AccessToken +An optional access token for authenticating to Azure Artifacts authenticated feeds. #> [CmdletBinding(SupportsShouldProcess=$true)] Param ( [ValidateSet('repo','user')] - [string]$InstallLocality='user' + [string]$InstallLocality='user', + [Parameter()] + [switch]$NoPrerequisites, + [Parameter()] + [switch]$NoRestore, + [Parameter()] + [string]$AccessToken ) -& "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality +if (!$NoPrerequisites) { + & "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken + & "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality +} + +Push-Location $PSScriptRoot +try { + $HeaderColor = 'Green' + + if (!$NoRestore) { + Write-Host "Restoring NuGet packages" -ForegroundColor $HeaderColor + dotnet restore src + if ($lastexitcode -ne 0) { + throw "Failure while restoring packages." + } + } +} +catch { + Write-Error $error[0] + exit $lastexitcode +} +finally { + Pop-Location +} diff --git a/nuget.config b/nuget.config index 4941d22b..d068efcf 100644 --- a/nuget.config +++ b/nuget.config @@ -3,6 +3,6 @@ - + diff --git a/tools/Install-NuGetCredProvider.ps1 b/tools/Install-NuGetCredProvider.ps1 new file mode 100644 index 00000000..df450dc7 --- /dev/null +++ b/tools/Install-NuGetCredProvider.ps1 @@ -0,0 +1,62 @@ +<# +.SYNOPSIS + Downloads and installs the Microsoft Artifacts Credential Provider + from https://github.com/microsoft/artifacts-credprovider + to assist in authenticating to Azure Artifact feeds in interactive development + or unattended build agents. +.PARAMETER AccessToken + An optional access token for authenticating to Azure Artifacts authenticated feeds. +#> +[CmdletBinding()] +Param ( + [Parameter()] + [string]$AccessToken +) + +$toolsPath = & "$PSScriptRoot\..\azure-pipelines\Get-TempToolsPath.ps1" + +if ($IsMacOS -or $IsLinux) { + $installerScript = "installcredprovider.sh" + $sourceUrl = "https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh" +} else { + $installerScript = "installcredprovider.ps1" + $sourceUrl = "https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.ps1" +} + +$installerScript = Join-Path $toolsPath $installerScript + +if (!(Test-Path $installerScript)) { + Invoke-WebRequest $sourceUrl -OutFile $installerScript +} + +$installerScript = (Resolve-Path $installerScript).Path + +if ($IsMacOS -or $IsLinux) { + chmod u+x $installerScript +} + +& $installerScript + +if ($AccessToken) { + $endpoints = @() + + $nugetConfig = [xml](Get-Content -Path "$PSScriptRoot\..\nuget.config") + + $nugetConfig.configuration.packageSources.add |? { $_.value -match '^https://pkgs\.dev\.azure\.com/' } |% { + $endpoint = New-Object -TypeName PSObject + Add-Member -InputObject $endpoint -MemberType NoteProperty -Name endpoint -Value $_.value + Add-Member -InputObject $endpoint -MemberType NoteProperty -Name username -Value ado + Add-Member -InputObject $endpoint -MemberType NoteProperty -Name password -Value $AccessToken + $endpoints += $endpoint + } + + $auth = New-Object -TypeName PSObject + Add-Member -InputObject $auth -MemberType NoteProperty -Name endpointCredentials -Value $endpoints + + $authJson = ConvertTo-Json -InputObject $auth + $envVars = @{ + 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS'=$authJson; + } + + & "$PSScriptRoot\..\azure-pipelines\Set-EnvVars.ps1" -Variables $envVars | Out-Null +} From 4ec792f492d29bcf0bb76021178028e140fc6ed5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 22 Jul 2019 09:49:54 -0600 Subject: [PATCH 039/889] Add MicroBuild packages to enable signing and more --- README.md | 2 + azure-pipelines/Install-NuGetPackage.ps1 | 50 +++++++++++++++++++++ azure-pipelines/dotnet.yml | 10 +++++ azure-pipelines/expand-template.yml | 15 ++++++- init.ps1 | 56 ++++++++++++++++++++++++ nuget.config | 5 +++ src/Directory.Build.props | 1 + src/Library.Tests/Library.Tests.csproj | 1 + 8 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 azure-pipelines/Install-NuGetPackage.ps1 diff --git a/README.md b/README.md index d05ac0d7..92cd829b 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ ## Features * Follow the best and simplest patterns of build, pack and test with dotnet CLI. +* MicroBuild signing built-in, with several more MicroBuild plugins' use streamlined for local installation. +* Insertions to VS streamlined and automated with all inputs computed during the build and saved for the release pipeline. * Static analyzers: [FxCop](https://docs.microsoft.com/en-us/visualstudio/code-quality/fxcop-analyzers?view=vs-2019) and [StyleCop](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) * Read-only source tree (builds to top-level bin/obj folders) * Auto-versioning (via [Nerdbank.GitVersioning](https://github.com/aarnott/nerdbank.gitversioning)) diff --git a/azure-pipelines/Install-NuGetPackage.ps1 b/azure-pipelines/Install-NuGetPackage.ps1 new file mode 100644 index 00000000..0bf05710 --- /dev/null +++ b/azure-pipelines/Install-NuGetPackage.ps1 @@ -0,0 +1,50 @@ +<# +.SYNOPSIS + Installs a NuGet package. +.PARAMETER PackageID + The Package ID to install. +.PARAMETER Version + The version of the package to install. If unspecified, the latest stable release is installed. +.PARAMETER Source + The package source feed to find the package to install from. +.PARAMETER PackagesDir + The directory to install the package to. By default, it uses the Packages folder at the root of the repo. +.PARAMETER ConfigFile + The nuget.config file to use. By default, it uses :/nuget.config. +#> +[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Low')] +Param( + [Parameter(Position=1,Mandatory=$true)] + [string]$PackageId, + [Parameter()] + [string]$Version, + [Parameter()] + [string]$Source, + [Parameter()] + [switch]$Prerelease, + [Parameter()] + [string]$PackagesDir="$PSScriptRoot\..\packages", + [Parameter()] + [string]$ConfigFile="$PSScriptRoot\..\nuget.config", + [Parameter()] + [ValidateSet('Quiet','Normal','Detailed')] + [string]$Verbosity='normal' +) + +$nugetPath = & "$PSScriptRoot\Get-NuGetTool.ps1" + +try { + Write-Verbose "Installing $PackageId..." + $nugetArgs = "Install",$PackageId,"-OutputDirectory",$PackagesDir,'-ConfigFile',$ConfigFile + if ($Version) { $nugetArgs += "-Version",$Version } + if ($Source) { $nugetArgs += "-FallbackSource",$Source } + if ($Prerelease) { $nugetArgs += "-Prerelease" } + $nugetArgs += '-Verbosity',$Verbosity + + if ($PSCmdlet.ShouldProcess($PackageId, 'nuget install')) { + $p = Start-Process $nugetPath $nugetArgs -NoNewWindow -Wait -PassThru + if ($p.ExitCode -ne 0) { throw } + } +} finally { + Pop-Location +} diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 96569224..c2c16db2 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -1,12 +1,22 @@ steps: +# We use VSBuild instead of "dotnet build" on Windows where MicroBuild tasks have to run (since they don't support MSBuild Core yet). +- task: VSBuild@1 + displayName: Build Visual Studio solution + inputs: + msbuildArgs: /t:build,pack /m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/msbuild.binlog" + platform: Any CPU + configuration: $(BuildConfiguration) + condition: eq(variables['Agent.OS'], 'Windows_NT') - script: dotnet build --no-restore -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" displayName: dotnet build workingDirectory: src + condition: ne(variables['Agent.OS'], 'Windows_NT') - script: dotnet pack --no-build -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/pack.binlog" displayName: dotnet pack workingDirectory: src + condition: ne(variables['Agent.OS'], 'Windows_NT') - task: DotNetCoreCLI@2 displayName: dotnet test -f net472 diff --git a/azure-pipelines/expand-template.yml b/azure-pipelines/expand-template.yml index 2d9ea7b3..a8591c64 100644 --- a/azure-pipelines/expand-template.yml +++ b/azure-pipelines/expand-template.yml @@ -10,6 +10,19 @@ steps: displayName: Expanding template failOnStderr: true # TODO: Verify that all changes are staged to the git index + +- powershell: .\init.ps1 + displayName: Install prereqs and restore packages + +- task: VSBuild@1 + displayName: Build Visual Studio solution (expanded template) + inputs: + msbuildArgs: /t:build,pack /m + platform: Any CPU + configuration: $(BuildConfiguration) + condition: eq(variables['Agent.OS'], 'Windows_NT') + - script: dotnet build - workingDirectory: src displayName: dotnet build (expanded template) + workingDirectory: src + condition: ne(variables['Agent.OS'], 'Windows_NT') diff --git a/init.ps1 b/init.ps1 index 17389cbc..a9279938 100644 --- a/init.ps1 +++ b/init.ps1 @@ -13,6 +13,17 @@ Per-repo can lead to file locking issues when dotnet.exe is left running as a bu Skips the installation of prerequisite software (e.g. SDKs, tools). .PARAMETER NoRestore Skips the package restore step. +.PARAMETER Signing +Install the MicroBuild signing plugin for building test-signed builds on desktop machines. +.PARAMETER Localization +Install the MicroBuild localization plugin for building loc builds on desktop machines. +The environment is configured to build pseudo-loc for JPN only, but may be used to build +all languages with shipping-style loc by using the `/p:loctype=full,loclanguages=vs` +when building. +.PARAMETER Setup +Install the MicroBuild setup plugin for building VSIXv3 packages. +.PARAMETER OptProf +Install the MicroBuild OptProf plugin for building optimized assemblies on desktop machines. .PARAMETER AccessToken An optional access token for authenticating to Azure Artifacts authenticated feeds. #> @@ -25,6 +36,14 @@ Param ( [Parameter()] [switch]$NoRestore, [Parameter()] + [switch]$Signing, + [Parameter()] + [switch]$Localization, + [Parameter()] + [switch]$Setup, + [Parameter()] + [switch]$OptProf, + [Parameter()] [string]$AccessToken ) @@ -44,6 +63,43 @@ try { throw "Failure while restoring packages." } } + + $EnvVars = @{} + $InstallNuGetPkgScriptPath = ".\azure-pipelines\Install-NuGetPackage.ps1" + $nugetVerbosity = 'quiet' + if ($Verbose) { $nugetVerbosity = 'normal' } + $MicroBuildPackageSource = 'https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json' + if ($Signing) { + Write-Host "Installing MicroBuild signing plugin" -ForegroundColor $HeaderColor + & $InstallNuGetPkgScriptPath MicroBuild.Plugins.Signing -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + $EnvVars['SignType'] = "Test" + } + + if ($Setup) { + Write-Host "Installing MicroBuild SwixBuild plugin..." -ForegroundColor $HeaderColor + & $InstallNuGetPkgScriptPath MicroBuild.Plugins.SwixBuild -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + } + + if ($OptProf) { + Write-Host "Installing MicroBuild OptProf plugin" -ForegroundColor $HeaderColor + & $InstallNuGetPkgScriptPath MicroBuild.Plugins.OptProf -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + $EnvVars['OptProfEnabled'] = '1' + } + + if ($Localization) { + Write-Host "Installing MicroBuild localization plugin" -ForegroundColor $HeaderColor + & $InstallNuGetPkgScriptPath MicroBuild.Plugins.Localization -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + $EnvVars['LocType'] = "Pseudo" + $EnvVars['LocLanguages'] = "JPN" + } + + if ($FxCop) { + Write-Host "Installing MicroBuild FxCop plugin" -ForegroundColor $HeaderColor + & $InstallNuGetPkgScriptPath MicroBuild.Plugins.FxCop -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + $EnvVars['MicroBuild_FXCop'] = "true" + } + + & ".\azure-pipelines\Set-EnvVars.ps1" -Variables $EnvVars } catch { Write-Error $error[0] diff --git a/nuget.config b/nuget.config index d068efcf..4ab034af 100644 --- a/nuget.config +++ b/nuget.config @@ -4,5 +4,10 @@ + + + + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index ca8edba3..2d75e3de 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -22,6 +22,7 @@ + diff --git a/src/Library.Tests/Library.Tests.csproj b/src/Library.Tests/Library.Tests.csproj index 7323c8d9..1f6a764c 100644 --- a/src/Library.Tests/Library.Tests.csproj +++ b/src/Library.Tests/Library.Tests.csproj @@ -14,6 +14,7 @@ + From 6e8af3aeaf5e31a0288dd08edc7b8cbc8e406e9a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 22 Jul 2019 10:57:28 -0600 Subject: [PATCH 040/889] Build microbuild branch in CI --- Expand-Template.ps1 | 5 ++++- azure-pipelines.yml | 1 + azure-pipelines/microbuild.yml | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index b32c3503..f325d898 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -129,7 +129,10 @@ try { "(?m).*expand-template\.yml(?:\r)?\n" = "" } - $YmlReplacements = @{} + $YmlReplacements = @{ + "(?m)^\s+- microbuild`r?`n"="" + } + Replace-Placeholders -Path "azure-pipelines\microbuild.yml" -Replacements $YmlReplacements if ($CodeCovToken) { $YmlReplacements['(codecov_token: ).*(#.*)'] = "`$1$CodeCovToken" } else { diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 39db1880..ab38b43b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,6 +2,7 @@ trigger: branches: include: - master + - microbuild - validate/* paths: exclude: diff --git a/azure-pipelines/microbuild.yml b/azure-pipelines/microbuild.yml index 0254a9e2..28240eed 100644 --- a/azure-pipelines/microbuild.yml +++ b/azure-pipelines/microbuild.yml @@ -2,6 +2,7 @@ trigger: branches: include: - master + - microbuild - validate/* paths: exclude: From a92a9fe10107c5a8b8c8e81551a723613f47ba85 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 22 Jul 2019 11:10:42 -0600 Subject: [PATCH 041/889] Fix SourceLink pkg ref to work on GitHub repos --- src/Directory.Build.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 2d75e3de..bdf4b5a5 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -25,8 +25,8 @@ - - + + From 0056b1255414f598b539ced20c95fad630a120e2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 22 Jul 2019 11:19:52 -0600 Subject: [PATCH 042/889] Remove private vs-impl feed --- nuget.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuget.config b/nuget.config index 4ab034af..cd0eec1d 100644 --- a/nuget.config +++ b/nuget.config @@ -4,7 +4,7 @@ - + From a7959d73f580b59b62b49b5fb526e1d4d0bc0115 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 28 Jul 2019 17:07:53 -0600 Subject: [PATCH 043/889] Add option to install SDKs machine-wide --- init.ps1 | 7 ++- tools/Install-DotNetSdk.ps1 | 106 ++++++++++++++++++++++++++++-------- 2 files changed, 89 insertions(+), 24 deletions(-) diff --git a/init.ps1 b/init.ps1 index 17389cbc..599cfb47 100644 --- a/init.ps1 +++ b/init.ps1 @@ -2,13 +2,16 @@ .SYNOPSIS Installs dependencies required to build and test the projects in this repository. .DESCRIPTION -This does not require elevation, as the dependencies are installed in per-user locations. +This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location, +unless `-InstallLocality machine` is specified. .PARAMETER InstallLocality A value indicating whether dependencies should be installed locally to the repo or at a per-user location. Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. +Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. +Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. .PARAMETER NoPrerequisites Skips the installation of prerequisite software (e.g. SDKs, tools). .PARAMETER NoRestore @@ -18,7 +21,7 @@ An optional access token for authenticating to Azure Artifacts authenticated fee #> [CmdletBinding(SupportsShouldProcess=$true)] Param ( - [ValidateSet('repo','user')] + [ValidateSet('repo','user','machine')] [string]$InstallLocality='user', [Parameter()] [switch]$NoPrerequisites, diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 2eccce41..a5d52eed 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -3,22 +3,102 @@ Installs the .NET SDK specified in the global.json file at the root of this repository, along with supporting .NET Core runtimes used for testing. .DESCRIPTION -This does not require elevation, as the SDK and runtimes are installed locally to this repo location. +This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location, +unless `-InstallLocality machine` is specified. .PARAMETER InstallLocality A value indicating whether dependencies should be installed locally to the repo or at a per-user location. Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. +Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. +Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. #> [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] Param ( - [ValidateSet('repo','user')] + [ValidateSet('repo','user','machine')] [string]$InstallLocality='user' ) -$DotNetInstallScriptRoot = "$PSScriptRoot/../obj" -if (!(Test-Path $DotNetInstallScriptRoot)) { mkdir $DotNetInstallScriptRoot | Out-Null } +$DotNetInstallScriptRoot = "$PSScriptRoot/../obj/tools" +if (!(Test-Path $DotNetInstallScriptRoot)) { New-Item -ItemType Directory -Path $DotNetInstallScriptRoot | Out-Null } +$DotNetInstallScriptRoot = Resolve-Path $DotNetInstallScriptRoot + +# Look up actual required .NET Core SDK version from global.json +$sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1" + +# Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them. +$runtimeVersions = @() +Get-ChildItem "$PSScriptRoot\..\src\*.*proj" -Recurse |% { + $projXml = [xml](Get-Content -Path $_) + $targetFrameworks = $projXml.Project.PropertyGroup.TargetFramework + if (!$targetFrameworks) { + $targetFrameworks = $projXml.Project.PropertyGroup.TargetFrameworks + if ($targetFrameworks) { + $targetFrameworks = $targetFrameworks -Split ';' + } + } + $targetFrameworks |? { $_ -match 'netcoreapp(\d+\.\d+)' } |% { + $runtimeVersions += $Matches[1] + } +} + +Function Get-FileFromWeb([Uri]$Uri, $OutDir) { + $OutFile = Join-Path $OutDir $Uri.Segments[-1] + if (!(Test-Path $OutFile)) { + Write-Verbose "Downloading $Uri..." + try { + (New-Object System.Net.WebClient).DownloadFile($Uri, $OutFile) + } finally { + # This try/finally causes the script to abort + } + } + + $OutFile +} + +Function Get-InstallerExe($Version, [switch]$Runtime) { + $sdkOrRuntime = 'Sdk' + if ($Runtime) { $sdkOrRuntime = 'Runtime' } + + # Get the latest/actual version for the specified one + if (([Version]$Version).Build -eq -1) { + $versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/latest.version") + $Version = $versionInfo[-1] + } + + Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/dotnet-$($sdkOrRuntime.ToLowerInvariant())-$Version-win-x64.exe" -OutDir "$DotNetInstallScriptRoot" +} + +Function Install-DotNet($Version, [switch]$Runtime) { + if ($Runtime) { $sdkSubstring = '' } else { $sdkSubstring = 'SDK ' } + Write-Host "Downloading .NET Core $sdkSubstring$Version..." + $Installer = Get-InstallerExe -Version $Version -Runtime:$Runtime + Write-Host "Installing .NET Core $sdkSubstring$Version..." + cmd /c start /wait $Installer /install /quiet + if ($LASTEXITCODE -ne 0) { + throw "Failure to install .NET Core SDK" + } +} + +if ($InstallLocality -eq 'machine') { + if ($IsMacOS -or $IsLinux) { + Write-Error "Installing the .NET Core SDK or runtime at a machine-wide location is only supported by this script on Windows." + exit 1 + } + + if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { + Install-DotNet -Version $sdkVersion + } + + $runtimeVersions |% { + if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { + Install-DotNet -Version $_ -Runtime + } + } + + return +} $switches = @( '-Architecture','x64' @@ -28,7 +108,6 @@ $envVars = @{ 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' = 'true'; } -$DotNetInstallScriptRoot = Resolve-Path $DotNetInstallScriptRoot if ($InstallLocality -eq 'repo') { $DotNetInstallDir = "$DotNetInstallScriptRoot/.dotnet" } elseif ($env:AGENT_TOOLSDIRECTORY) { @@ -44,7 +123,6 @@ if ($DotNetInstallDir) { $envVars['DOTNET_MULTILEVEL_LOOKUP'] = '0' $envVars['DOTNET_ROOT'] = $DotNetInstallDir } -$sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1" if ($IsMacOS -or $IsLinux) { $DownloadUri = "https://dot.net/v1/dotnet-install.sh" @@ -67,22 +145,6 @@ if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches -DryRun" } -# Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them. -$runtimeVersions = @() -Get-ChildItem "$PSScriptRoot\..\src\*.*proj" -Recurse |% { - $projXml = [xml](Get-Content -Path $_) - $targetFrameworks = $projXml.Project.PropertyGroup.TargetFramework - if (!$targetFrameworks) { - $targetFrameworks = $projXml.Project.PropertyGroup.TargetFrameworks - if ($targetFrameworks) { - $targetFrameworks = $targetFrameworks -Split ';' - } - } - $targetFrameworks |? { $_ -match 'netcoreapp(\d+\.\d+)' } |% { - $runtimeVersions += $Matches[1] - } -} - $switches += '-Runtime','dotnet' $runtimeVersions | Get-Unique |% { From 3ce68babff89107f16755b99e6ef05f96685af15 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 28 Jul 2019 21:07:54 -0600 Subject: [PATCH 044/889] Fix Get-nbgv.ps1 on Mac/Linux --- azure-pipelines/Get-nbgv.ps1 | 7 +++---- azure-pipelines/build.yml | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/azure-pipelines/Get-nbgv.ps1 b/azure-pipelines/Get-nbgv.ps1 index 8459995f..925eecdd 100644 --- a/azure-pipelines/Get-nbgv.ps1 +++ b/azure-pipelines/Get-nbgv.ps1 @@ -13,16 +13,15 @@ if ($existingTool) { if ($env:AGENT_TEMPDIRECTORY) { $toolInstallDir = "$env:AGENT_TEMPDIRECTORY/$env:BUILD_BUILDID" } else { - $toolInstallDir = "$PSScriptRoot/obj/tools" + $toolInstallDir = "$PSScriptRoot/../obj/tools" } $toolPath = "$toolInstallDir/nbgv" -if (!(Test-Path $toolPath)) { New-Item -Path $toolPath -ItemType Directory | Out-Null } -$toolPath = (Resolve-Path $toolPath).Path +if (!(Test-Path $toolInstallDir)) { New-Item -Path $toolInstallDir -ItemType Directory | Out-Null } if (!(Get-Command $toolPath -ErrorAction SilentlyContinue)) { Write-Host "Installing nbgv to $toolInstallDir" - dotnet tool install --tool-path "$toolInstallDir" nbgv --configfile "$PSScriptRoot\justnugetorg.nuget.config" | Out-Null + dotnet tool install --tool-path "$toolInstallDir" nbgv --configfile "$PSScriptRoot/justnugetorg.nuget.config" | Out-Null } # Normalize the path on the way out. diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index f81d7f14..bc7facfa 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -9,7 +9,7 @@ jobs: clean: true # "all" doesn't work, but "true" does, despite YAML docs - template: install-dependencies.yml - - powershell: '& (azure-pipelines\Get-nbgv.ps1) cloud' + - powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud' displayName: Set build number - template: dotnet.yml From 109cb712d6d68aad3bcaf26209c7ed26b8abc50c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 29 Jul 2019 07:01:49 -0600 Subject: [PATCH 045/889] Clean on mac agent too --- azure-pipelines/build.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index bc7facfa..05e32a18 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -6,7 +6,7 @@ jobs: pool: ${{ parameters.windowsPool }} steps: - checkout: self - clean: true # "all" doesn't work, but "true" does, despite YAML docs + clean: true - template: install-dependencies.yml - powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud' @@ -20,7 +20,7 @@ jobs: vmImage: Ubuntu 16.04 steps: - checkout: self - clean: true # "all" doesn't work, but "true" does, despite YAML docs + clean: true - template: install-dependencies.yml - template: dotnet.yml - template: expand-template.yml @@ -29,6 +29,8 @@ jobs: pool: vmImage: macOS 10.13 steps: + - checkout: self + clean: true - template: install-dependencies.yml - template: dotnet.yml - template: expand-template.yml @@ -43,7 +45,7 @@ jobs: condition: succeededOrFailed() steps: - checkout: self - clean: true # "all" doesn't work, but "true" does, despite YAML docs + clean: true - template: install-dependencies.yml parameters: initArgs: -NoRestore From bea56a3333705f9c8cd8dd5d0f6e439ea398662d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 29 Jul 2019 08:46:14 -0600 Subject: [PATCH 046/889] Add nuget package copyright metadata --- src/Directory.Build.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index f4ef3297..475d57b8 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,5 +1,4 @@ - - + Debug $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\')) @@ -14,6 +13,7 @@ COMPANY-PLACEHOLDER COMPANY-PLACEHOLDER + © COMPANY-PLACEHOLDER. All rights reserved. MIT true true From 0ce29683fc09edd1644d62ce523ebd6ab424cbaf Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 29 Jul 2019 08:09:20 -0600 Subject: [PATCH 047/889] Rename MicroBuild.yml to official.yml This may be a step backwards, but as all existing repos use the official.yml naming, it will make migration to the latest of this pattern easier. --- Expand-Template.ps1 | 2 +- azure-pipelines/{microbuild.yml => official.yml} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename azure-pipelines/{microbuild.yml => official.yml} (100%) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index f325d898..4f0097d3 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -132,7 +132,7 @@ try { $YmlReplacements = @{ "(?m)^\s+- microbuild`r?`n"="" } - Replace-Placeholders -Path "azure-pipelines\microbuild.yml" -Replacements $YmlReplacements + Replace-Placeholders -Path "azure-pipelines\official.yml" -Replacements $YmlReplacements if ($CodeCovToken) { $YmlReplacements['(codecov_token: ).*(#.*)'] = "`$1$CodeCovToken" } else { diff --git a/azure-pipelines/microbuild.yml b/azure-pipelines/official.yml similarity index 100% rename from azure-pipelines/microbuild.yml rename to azure-pipelines/official.yml From 2bbbf08ee728b4e72a4224ff94f9854a2150d315 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 29 Jul 2019 08:54:24 -0600 Subject: [PATCH 048/889] Switch to 'download' syntax --- azure-pipelines/publish-codecoverage.yml | 22 ++++++++-------------- azure-pipelines/publish-deployables.yml | 8 +++----- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index 5d987c83..6d367de9 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -1,27 +1,21 @@ steps: -- task: DownloadBuildArtifacts@0 +- download: current + artifact: coverageResults-Windows displayName: Download Windows code coverage results - inputs: - artifactName: coverageResults-Windows - downloadPath: $(System.DefaultWorkingDirectory)/bin continueOnError: true -- task: DownloadBuildArtifacts@0 +- download: current + artifact: coverageResults-Linux displayName: Download Linux code coverage results - inputs: - artifactName: coverageResults-Linux - downloadPath: $(System.DefaultWorkingDirectory)/bin continueOnError: true -- task: DownloadBuildArtifacts@0 +- download: current + artifact: coverageResults-macOS displayName: Download macOS code coverage results - inputs: - artifactName: coverageResults-macOS - downloadPath: $(System.DefaultWorkingDirectory)/bin continueOnError: true - powershell: | dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.2.2 --configfile azure-pipelines/justnugetorg.nuget.config - Copy-Item -Recurse $(System.DefaultWorkingDirectory)/bin/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj + Copy-Item -Recurse $(Pipeline.Workspace)/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj Write-Host "Substituting {reporoot} with $(System.DefaultWorkingDirectory)" - $reports = Get-ChildItem -Recurse "$(System.DefaultWorkingDirectory)/bin/coverage.cobertura.xml" + $reports = Get-ChildItem -Recurse "$(Pipeline.Workspace)/coverage.cobertura.xml" $reports |% { $content = Get-Content -Path $_ |% { $_.Replace("{reporoot}", "$(System.DefaultWorkingDirectory)") } Set-Content -Path $_ -Value $content -Encoding UTF8 diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml index cdd85292..3f6bb9da 100644 --- a/azure-pipelines/publish-deployables.yml +++ b/azure-pipelines/publish-deployables.yml @@ -1,15 +1,13 @@ steps: -- task: DownloadBuildArtifacts@0 +- download: current displayName: Download deployables - inputs: - artifactName: deployables-Windows - downloadPath: $(System.DefaultWorkingDirectory)/bin + artifact: deployables-Windows - task: DotNetCoreCLI@2 displayName: Push packages to CI feed inputs: command: push - packagesToPush: $(System.DefaultWorkingDirectory)/bin/deployables-Windows/*.nupkg + packagesToPush: $(Pipeline.Workspace)/deployables-Windows/*.nupkg nuGetFeedType: internal publishVstsFeed: $(ci_feed) allowPackageConflicts: true From 74edab08d3ad400e7f0c3c7bcf1b8278544f24dc Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 1 Aug 2019 12:53:47 -0600 Subject: [PATCH 049/889] Update package refs, fix env vars on *nix agents More detail: 1. Use capitalized env names so they work on *nix agents 2. Remove unused fxcop plugin installer 3. Update and sort package refs --- azure-pipelines/variables/InsertConfigValues.ps1 | 2 +- azure-pipelines/variables/ci_feed.ps1 | 2 +- init.ps1 | 6 ------ src/Directory.Build.props | 6 ++---- src/Library.Tests/Library.Tests.csproj | 4 ++-- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/azure-pipelines/variables/InsertConfigValues.ps1 b/azure-pipelines/variables/InsertConfigValues.ps1 index bd53ae8d..1455a5b7 100644 --- a/azure-pipelines/variables/InsertConfigValues.ps1 +++ b/azure-pipelines/variables/InsertConfigValues.ps1 @@ -1,4 +1,4 @@ -$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin\Packages\$env:BuildConfiguration") +$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin\Packages\$env:BUILDCONFIGURATION") $icv=@() if (Test-Path "$BinPath") { diff --git a/azure-pipelines/variables/ci_feed.ps1 b/azure-pipelines/variables/ci_feed.ps1 index 2d6ef8e6..b5530b3f 100644 --- a/azure-pipelines/variables/ci_feed.ps1 +++ b/azure-pipelines/variables/ci_feed.ps1 @@ -1,4 +1,4 @@ -if ($env:SignType -eq 'Real') { +if ($env:SIGNTYPE -eq 'Real') { '09d8d03c-1ac8-456e-9274-4d2364527d99' # VSIDE-RealSigned-Release } else { 'da484c78-f942-44ef-b197-99e2a1bef53c' # VSIDE-TestSigned-Release diff --git a/init.ps1 b/init.ps1 index 51363419..83a9e17e 100644 --- a/init.ps1 +++ b/init.ps1 @@ -96,12 +96,6 @@ try { $EnvVars['LocLanguages'] = "JPN" } - if ($FxCop) { - Write-Host "Installing MicroBuild FxCop plugin" -ForegroundColor $HeaderColor - & $InstallNuGetPkgScriptPath MicroBuild.Plugins.FxCop -source $MicroBuildPackageSource -Verbosity $nugetVerbosity - $EnvVars['MicroBuild_FXCop'] = "true" - } - & ".\azure-pipelines\Set-EnvVars.ps1" -Variables $EnvVars } catch { diff --git a/src/Directory.Build.props b/src/Directory.Build.props index fd3bbb51..d1db1b3f 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -8,8 +8,6 @@ 7.3 true - true - COMPANY-PLACEHOLDER COMPANY-PLACEHOLDER © COMPANY-PLACEHOLDER. All rights reserved. @@ -23,9 +21,9 @@ - + - + diff --git a/src/Library.Tests/Library.Tests.csproj b/src/Library.Tests/Library.Tests.csproj index 1f6a764c..af9c6e3c 100644 --- a/src/Library.Tests/Library.Tests.csproj +++ b/src/Library.Tests/Library.Tests.csproj @@ -14,11 +14,11 @@ - + - + From c52d5ff380c256be1362a3e7d6da209cf1d80f57 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 1 Aug 2019 12:55:23 -0600 Subject: [PATCH 050/889] Update package references --- src/Directory.Build.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 475d57b8..8f62479f 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -23,9 +23,9 @@ - + - + From 461021a273a9b62bdace711a1ea99a3db6dd32dd Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 1 Aug 2019 15:58:19 -0600 Subject: [PATCH 051/889] Suppress "True" in build log --- init.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.ps1 b/init.ps1 index 83a9e17e..76d29782 100644 --- a/init.ps1 +++ b/init.ps1 @@ -96,7 +96,7 @@ try { $EnvVars['LocLanguages'] = "JPN" } - & ".\azure-pipelines\Set-EnvVars.ps1" -Variables $EnvVars + & ".\azure-pipelines\Set-EnvVars.ps1" -Variables $EnvVars | Out-Null } catch { Write-Error $error[0] From a66b8ad7f5034766b8d876348d550680e9fda596 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 1 Aug 2019 16:06:04 -0600 Subject: [PATCH 052/889] Don't break build when package conflicts happen in CI DotNetCliTool doesn't support the allowPackageConflicts parameter. --- azure-pipelines/publish-deployables.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml index 3f6bb9da..a89f389f 100644 --- a/azure-pipelines/publish-deployables.yml +++ b/azure-pipelines/publish-deployables.yml @@ -3,7 +3,7 @@ steps: displayName: Download deployables artifact: deployables-Windows -- task: DotNetCoreCLI@2 +- task: NuGetCommand@2 displayName: Push packages to CI feed inputs: command: push From 747490e372cd36a440bcf0c83a0a8bf75d493e1e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 1 Aug 2019 17:18:50 -0600 Subject: [PATCH 053/889] Fix up VSTS references to Azure Pipelines --- azure-pipelines/artifacts/_pipelines.ps1 | 2 +- azure-pipelines/variables/_pipelines.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/artifacts/_pipelines.ps1 b/azure-pipelines/artifacts/_pipelines.ps1 index 270a9604..7451ab11 100644 --- a/azure-pipelines/artifacts/_pipelines.ps1 +++ b/azure-pipelines/artifacts/_pipelines.ps1 @@ -1,5 +1,5 @@ # This script translates all the artifacts described by _all.ps1 -# into commands that instruct VSTS to actually collect those artifacts. +# into commands that instruct Azure Pipelines to actually collect those artifacts. param ( [string]$ArtifactNameSuffix diff --git a/azure-pipelines/variables/_pipelines.ps1 b/azure-pipelines/variables/_pipelines.ps1 index b3fde25d..9fa0c16b 100644 --- a/azure-pipelines/variables/_pipelines.ps1 +++ b/azure-pipelines/variables/_pipelines.ps1 @@ -1,5 +1,5 @@ # This script translates the variables returned by the _all.ps1 script -# into commands that instruct VSTS to actually set those variables for other VSTS tasks to consume. +# into commands that instruct Azure Pipelines to actually set those variables for other pipeline tasks to consume. # The build or release definition may have set these variables to override # what the build would do. So only set them if they have not already been set. From 4ed1fa825f5f77ee04a11fab2bef44607b8205ce Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 4 Aug 2019 06:30:58 -0600 Subject: [PATCH 054/889] Add support for nuget feeds using old style URLs --- tools/Install-NuGetCredProvider.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Install-NuGetCredProvider.ps1 b/tools/Install-NuGetCredProvider.ps1 index df450dc7..ba70f2bd 100644 --- a/tools/Install-NuGetCredProvider.ps1 +++ b/tools/Install-NuGetCredProvider.ps1 @@ -42,7 +42,7 @@ if ($AccessToken) { $nugetConfig = [xml](Get-Content -Path "$PSScriptRoot\..\nuget.config") - $nugetConfig.configuration.packageSources.add |? { $_.value -match '^https://pkgs\.dev\.azure\.com/' } |% { + $nugetConfig.configuration.packageSources.add |? { ($_.value -match '^https://pkgs\.dev\.azure\.com/') -or ($_.value -match '^https://[\w\-]+\.pkgs\.visualstudio\.com/') } |% { $endpoint = New-Object -TypeName PSObject Add-Member -InputObject $endpoint -MemberType NoteProperty -Name endpoint -Value $_.value Add-Member -InputObject $endpoint -MemberType NoteProperty -Name username -Value ado From 02c4f0bb21a0fa9b57e8321f86118a5f234f35c8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 5 Aug 2019 09:26:04 -0600 Subject: [PATCH 055/889] Skip net472 tests after a build failure --- azure-pipelines/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 96569224..21b189f2 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -15,7 +15,7 @@ steps: arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true testRunTitle: net472-$(Agent.JobName) workingDirectory: src - condition: eq(variables['Agent.OS'], 'Windows_NT') + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - task: DotNetCoreCLI@2 displayName: dotnet test -f netcoreapp2.1 From 4dc1a87609a869e2f0fb01939f3334b251c3f6a2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 5 Aug 2019 09:26:57 -0600 Subject: [PATCH 056/889] Skip steps when build failure is certain --- azure-pipelines/clear-packagecaches.yml | 2 +- azure-pipelines/dotnet.yml | 6 +++--- azure-pipelines/expand-template.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/azure-pipelines/clear-packagecaches.yml b/azure-pipelines/clear-packagecaches.yml index 86c327ec..2492623a 100644 --- a/azure-pipelines/clear-packagecaches.yml +++ b/azure-pipelines/clear-packagecaches.yml @@ -4,4 +4,4 @@ steps: if (Test-Path $_) { Remove-Item $_ -Recurse -Force } } displayName: Purge package caches - condition: eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') + condition: and(succeeded(), eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9')) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 35863626..c33e9210 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -6,17 +6,17 @@ steps: msbuildArgs: /t:build,pack /m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/msbuild.binlog" platform: Any CPU configuration: $(BuildConfiguration) - condition: eq(variables['Agent.OS'], 'Windows_NT') + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - script: dotnet build --no-restore -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" displayName: dotnet build workingDirectory: src - condition: ne(variables['Agent.OS'], 'Windows_NT') + condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) - script: dotnet pack --no-build -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/pack.binlog" displayName: dotnet pack workingDirectory: src - condition: ne(variables['Agent.OS'], 'Windows_NT') + condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) - task: DotNetCoreCLI@2 displayName: dotnet test -f net472 diff --git a/azure-pipelines/expand-template.yml b/azure-pipelines/expand-template.yml index a8591c64..e8ece721 100644 --- a/azure-pipelines/expand-template.yml +++ b/azure-pipelines/expand-template.yml @@ -20,9 +20,9 @@ steps: msbuildArgs: /t:build,pack /m platform: Any CPU configuration: $(BuildConfiguration) - condition: eq(variables['Agent.OS'], 'Windows_NT') + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - script: dotnet build displayName: dotnet build (expanded template) workingDirectory: src - condition: ne(variables['Agent.OS'], 'Windows_NT') + condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) From 6957e47ebdb45d635db0721353870d49032ef992 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 5 Aug 2019 12:42:53 -0600 Subject: [PATCH 057/889] Update .NET Core SDK to 2.2.401 --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 93238784..3d26ee65 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "2.2.300" + "version": "2.2.401" } -} \ No newline at end of file +} From fe7fee63e1c044ea141b04418dae57ae7cc847b6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 7 Aug 2019 09:13:36 -0600 Subject: [PATCH 058/889] Fix formatting of xml and json files --- src/.editorconfig => .editorconfig | 0 .vscode/extensions.json | 32 ++++++++++++++---------------- nuget.config | 4 ++-- 3 files changed, 17 insertions(+), 19 deletions(-) rename src/.editorconfig => .editorconfig (100%) diff --git a/src/.editorconfig b/.editorconfig similarity index 100% rename from src/.editorconfig rename to .editorconfig diff --git a/.vscode/extensions.json b/.vscode/extensions.json index f910c687..8b1c54d6 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,18 +1,16 @@ { - // See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. - // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp - - // List of extensions which should be recommended for users of this workspace. - "recommendations": [ - "ms-azure-devops.azure-pipelines", - "ms-vscode.csharp", - "k--kato.docomment", - "editorconfig.editorconfig", - "pflannery.vscode-versionlens", - "davidanson.vscode-markdownlint" - ], - // List of extensions recommended by VS Code that should not be recommended for users of this workspace. - "unwantedRecommendations": [ - - ] -} \ No newline at end of file + // See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "ms-azure-devops.azure-pipelines", + "ms-vscode.csharp", + "k--kato.docomment", + "editorconfig.editorconfig", + "pflannery.vscode-versionlens", + "davidanson.vscode-markdownlint", + "dotjoshjohnson.xml" + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] +} diff --git a/nuget.config b/nuget.config index d068efcf..1ee7a2bc 100644 --- a/nuget.config +++ b/nuget.config @@ -1,8 +1,8 @@ - + - + From 297a72516e3f287018f6de0ec883e64e87a82bf0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 7 Aug 2019 09:13:47 -0600 Subject: [PATCH 059/889] Centralize MicroBuild package version --- src/Directory.Build.props | 4 +++- src/Library.Tests/Library.Tests.csproj | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index d1db1b3f..6db75f28 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -17,10 +17,12 @@ true snupkg $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + + 2.0.55 - + diff --git a/src/Library.Tests/Library.Tests.csproj b/src/Library.Tests/Library.Tests.csproj index af9c6e3c..14b57900 100644 --- a/src/Library.Tests/Library.Tests.csproj +++ b/src/Library.Tests/Library.Tests.csproj @@ -15,7 +15,7 @@ - + From 8f108fe64a258c923ab3322fe802c3c50651390b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 9 Aug 2019 10:15:03 -0600 Subject: [PATCH 060/889] Update NB.GV to 3.0.25 --- src/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 8f62479f..8c337275 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -26,7 +26,7 @@ - + From 5847f0ae57e1277afff053774a11f7b64bb2b678 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 9 Aug 2019 13:51:24 -0600 Subject: [PATCH 061/889] Use a local package cache This ensures that restore always uses the sources in nuget.config rather than a cache that happens to be on the local box. It helps avoid bugs that are not caught till a build suddenly fails on some machine somewhere because it didn't happen to have a package cached locally from some other source. It also mitigates the risk on private build agents that a package cache is "poisoned" by some build already done on that agent with other package sources where the id/version of a package collides but the contents are not actually identical. --- nuget.config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nuget.config b/nuget.config index 1ee7a2bc..4949867c 100644 --- a/nuget.config +++ b/nuget.config @@ -1,5 +1,8 @@ + + + From 68b3a76367dc334c375b4079bed109d3c920af1c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 11 Aug 2019 22:29:34 -0600 Subject: [PATCH 062/889] Add Codex indexing of source --- azure-pipelines/microbuild.after.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 8601dfaa..14340d5e 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -6,3 +6,16 @@ steps: - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: Component Detection condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + +- task: Ref12.ref12-analyze-task.ref12-analyze-task.Ref12Analyze@0 + displayName: Ref12 (Codex) Analyze + inputs: + codexoutputroot: $(Build.ArtifactStagingDirectory)\Codex + workflowArguments: | + /sourcesDirectory:$(Build.SourcesDirectory) + /codexRepoUrl:$(Build.Repository.Uri) + /repoName:$(Build.Repository.Name) + /additionalCodexArguments:-bld + /additionalCodexArguments:$(Build.ArtifactStagingDirectory)/build_logs + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + continueOnError: true From 7f19eaa4f759424f7ae8e05931f10d11dfcd5bfd Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 11 Aug 2019 22:34:26 -0600 Subject: [PATCH 063/889] Stop clearing package cache on private agent Instead, we just divert the package cache to another location that is always cleared anyway. --- azure-pipelines/build.yml | 3 ++- azure-pipelines/clear-packagecaches.yml | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 azure-pipelines/clear-packagecaches.yml diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index eb70c94f..64584f99 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -4,10 +4,11 @@ parameters: jobs: - job: Windows pool: ${{ parameters.windowsPool }} + variables: + NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages steps: - checkout: self clean: true - - template: clear-packagecaches.yml - template: install-dependencies.yml - powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud' diff --git a/azure-pipelines/clear-packagecaches.yml b/azure-pipelines/clear-packagecaches.yml deleted file mode 100644 index 2492623a..00000000 --- a/azure-pipelines/clear-packagecaches.yml +++ /dev/null @@ -1,7 +0,0 @@ -steps: -- powershell: | - "$env:userprofile\.nuget\packages", "$env:LocalAppData\NuGet\Cache", "$env:AppData\tsd-cache" |% { - if (Test-Path $_) { Remove-Item $_ -Recurse -Force } - } - displayName: Purge package caches - condition: and(succeeded(), eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9')) From 364dfe9f316b1ed9fb950bdb8dc51c361bb83a99 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 11 Aug 2019 23:15:23 -0600 Subject: [PATCH 064/889] When squashing, record the original commit ID --- Expand-Template.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index c050aba3..89614a2d 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -74,8 +74,9 @@ if (-not $sn) { Push-Location $PSScriptRoot try { if ($Squash) { + $originalCommitId = git rev-parse HEAD git reset --soft $(git rev-list --max-parents=0 HEAD) - git commit --amend -qm "Initial template from https://github.com/AArnott/Library.Template" + git commit --amend -qm "Initial template from https://github.com/AArnott/Library.Template" -m "Original commit from template $originalCommitId" } # Rename project directories and solution From 87b92ebed468b033b081beca8110365daf7fb77e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 12 Aug 2019 11:56:02 -0600 Subject: [PATCH 065/889] Add verify signed files step --- azure-pipelines/microbuild.after.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 8601dfaa..a37c60cb 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -1,4 +1,10 @@ steps: +- task: ms-vseng.MicroBuildShipTasks.7c429315-71ba-4cb3-94bb-f829c95f7915.MicroBuildCodesignVerify@2 + displayName: Verify Signed Files + inputs: + TargetFolders: | + $(Build.SourcesDirectory)/bin/Packages/$(BuildConfiguration)/NuGet + - task: MicroBuildCleanup@1 condition: succeededOrFailed() displayName: MicroBuild Cleanup From b17ceb8734b05238ee8020734441d1ae2b656953 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 12 Aug 2019 12:25:05 -0600 Subject: [PATCH 066/889] Sign xml doc comment files --- src/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 1d2d3c0d..60a88b1b 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -18,7 +18,7 @@ snupkg $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - 2.0.55 + 2.0.57 From 4705734f048b74f2dedb26799b157dcb7d74571e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 16 Aug 2019 16:48:54 -0600 Subject: [PATCH 067/889] Fix nuget install Get packages into a subdirectory and use nuget.exe 5.2.0 so it works with the credential provider. --- azure-pipelines/Get-NuGetTool.ps1 | 2 +- nuget.config | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/Get-NuGetTool.ps1 b/azure-pipelines/Get-NuGetTool.ps1 index fdf3ed55..623bb6f0 100644 --- a/azure-pipelines/Get-NuGetTool.ps1 +++ b/azure-pipelines/Get-NuGetTool.ps1 @@ -6,7 +6,7 @@ #> Param( [Parameter()] - [string]$NuGetVersion='5.0.2' + [string]$NuGetVersion='5.2.0' ) $toolsPath = & "$PSScriptRoot\Get-TempToolsPath.ps1" diff --git a/nuget.config b/nuget.config index 4949867c..38588711 100644 --- a/nuget.config +++ b/nuget.config @@ -2,6 +2,7 @@ + From 4ecab1957dd720fb5110f882475090d8a540aad3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 16 Aug 2019 16:54:28 -0600 Subject: [PATCH 068/889] Redirect Only divert global package cache in Azure Pipelines On local machines, file locks on the global package cache can cause `git clean -fdx` to fail. It also causes package restore times to be longer on local boxes after cleaning. The extra protection afforded by a diverted package cache is good, but is probably sufficient to provide only in Azure Pipelines, or explicitly by the user when they want it. --- azure-pipelines.yml | 1 + nuget.config | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f158ff52..539df93a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,6 +16,7 @@ variables: BuildPlatform: Any CPU codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ ci_feed: /a5a3bad0-e566-4c53-be83-6458be8d1653 # find guid used by Azure DevOps Artifacts for the feed + NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages jobs: - template: azure-pipelines/build.yml diff --git a/nuget.config b/nuget.config index 38588711..c0173d1b 100644 --- a/nuget.config +++ b/nuget.config @@ -1,7 +1,6 @@ - From 8931dfb7818bb7e5173cbdd991d8af2c2a6699ca Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 16 Aug 2019 17:03:52 -0600 Subject: [PATCH 069/889] Download nuget.exe much more quickly Invoke-WebRequest is a terribly slow way to download files. --- azure-pipelines/Get-NuGetTool.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/Get-NuGetTool.ps1 b/azure-pipelines/Get-NuGetTool.ps1 index 623bb6f0..4431adb9 100644 --- a/azure-pipelines/Get-NuGetTool.ps1 +++ b/azure-pipelines/Get-NuGetTool.ps1 @@ -16,7 +16,7 @@ $nugetPath = Join-Path $binaryToolsPath nuget.exe if (!(Test-Path $nugetPath)) { Write-Host "Downloading nuget.exe $NuGetVersion..." -ForegroundColor Yellow - Invoke-WebRequest -Uri "https://dist.nuget.org/win-x86-commandline/v$NuGetVersion/NuGet.exe" -OutFile $nugetPath | Out-Null + (New-Object System.Net.WebClient).DownloadFile("https://dist.nuget.org/win-x86-commandline/v$NuGetVersion/NuGet.exe", $nugetPath) } return (Resolve-Path $nugetPath).Path From cc78e3cce898d44dbbd6b139f23ad46c50944f7b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 16 Aug 2019 17:40:21 -0600 Subject: [PATCH 070/889] Update to MicroBuild 2.0.58 to sign published files --- src/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 60a88b1b..60be6d8a 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -18,7 +18,7 @@ snupkg $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - 2.0.57 + 2.0.58 From 10adace490b792a7053a97bbed92716475cc99ba Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 21 Aug 2019 11:43:01 -0600 Subject: [PATCH 071/889] Add SymbolsFeatureName variable --- Expand-Template.ps1 | 4 ++++ azure-pipelines/variables/SymbolsFeatureName.ps1 | 1 + 2 files changed, 5 insertions(+) create mode 100644 azure-pipelines/variables/SymbolsFeatureName.ps1 diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 6c18d2e6..d6b82cb5 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -146,6 +146,10 @@ try { 'LibraryNoDots' = $LibraryName.Replace('.',''); } + Replace-Placeholders -Path "azure-pipelines/variables/SymbolsFeatureName.ps1" -Replacements @{ + 'LibraryName' = $LibraryName; + } + # Self destruct $Invocation = (Get-Variable MyInvocation -Scope 1).Value git rm Expand-Template.ps1 diff --git a/azure-pipelines/variables/SymbolsFeatureName.ps1 b/azure-pipelines/variables/SymbolsFeatureName.ps1 new file mode 100644 index 00000000..d6c133eb --- /dev/null +++ b/azure-pipelines/variables/SymbolsFeatureName.ps1 @@ -0,0 +1 @@ +'LibraryName' From b340b5f5147f07f8553f21c35615c536db49de4d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 21 Aug 2019 11:44:14 -0600 Subject: [PATCH 072/889] Specify default for Author in Expand-Template --- Expand-Template.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index d6b82cb5..3ac78c89 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -18,7 +18,7 @@ Param( [Parameter(Mandatory=$true)] [string]$LibraryName, [Parameter(Mandatory=$true)] - [string]$Author, + [string]$Author = "Microsoft Corporation", [Parameter()] [string]$CodeCovToken, [Parameter()] From fa7265ccbac9ca8c3dc4c3c9c1f512482b6304ec Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 21 Aug 2019 12:32:02 -0600 Subject: [PATCH 073/889] Remove unused CIFeed parameter --- Expand-Template.ps1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 3ac78c89..64ca150f 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -8,8 +8,6 @@ The name to use in copyright and owner notices. .PARAMETER CodeCovToken A token obtained from codecov.io for your repo. If not specified, code coverage results will not be published to codecov.io, but can be added later by editing the Azure Pipelines YAML file. -.PARAMETER CIFeed -The `/{guid}` path to the Azure Pipelines artifact feed to push your nuget package to as part of your CI. .PARAMETER Squash A switch that causes all of git history to be squashed to just one initial commit for the template, and one for its expansion. #> @@ -22,8 +20,6 @@ Param( [Parameter()] [string]$CodeCovToken, [Parameter()] - [string]$CIFeed, - [Parameter()] [switch]$Squash ) From 5a8b75a11464440dac5a22a056e209213b4aa37d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 27 Aug 2019 09:21:04 -0600 Subject: [PATCH 074/889] Remove working direction assumption from init.ps1 --- init.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.ps1 b/init.ps1 index 76d29782..9e34fed6 100644 --- a/init.ps1 +++ b/init.ps1 @@ -96,7 +96,7 @@ try { $EnvVars['LocLanguages'] = "JPN" } - & ".\azure-pipelines\Set-EnvVars.ps1" -Variables $EnvVars | Out-Null + & "$PSScriptRoot\azure-pipelines\Set-EnvVars.ps1" -Variables $EnvVars | Out-Null } catch { Write-Error $error[0] From 5cc44c4f2bbfd483104621a636e924a2e0544dc4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 10 Sep 2019 17:19:48 -0600 Subject: [PATCH 075/889] Improve Azure Pipelines build reliability This works around a bug that causes our Windows agent to very frequently fail in the nuget credential provider. --- init.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init.ps1 b/init.ps1 index 599cfb47..e01f3aed 100644 --- a/init.ps1 +++ b/init.ps1 @@ -36,6 +36,10 @@ if (!$NoPrerequisites) { & "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality } +# Workaround nuget credential provider bug that causes very unreliable package restores on Azure Pipelines +$env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20 +$env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 + Push-Location $PSScriptRoot try { $HeaderColor = 'Green' From 70dcacac07c281ebe1e60ce5acbb5a22e1449df7 Mon Sep 17 00:00:00 2001 From: Eilon Lipton Date: Tue, 17 Sep 2019 15:22:46 -0700 Subject: [PATCH 076/889] Use HTTPS URLs wherever possible --- .vscode/extensions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 8b1c54d6..c5b615df 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,5 +1,5 @@ { - // See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp // List of extensions which should be recommended for users of this workspace. "recommendations": [ From 4641b826b0717b388f241a7eeda281f344d7042a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 21 Sep 2019 21:53:35 -0600 Subject: [PATCH 077/889] Fix auto-build of validate/* branches --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 539df93a..c4c3f607 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,7 +2,7 @@ trigger: branches: include: - master - - validate/* + - 'validate/*' paths: exclude: - doc/ From a77d264bbc72eb0f201c2fc14db40525746417d9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 25 Sep 2019 06:26:38 -0600 Subject: [PATCH 078/889] Suppress an unreasonable static analysis rule for tests --- src/tests.ruleset | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tests.ruleset b/src/tests.ruleset index 4b4708a1..a1365976 100644 --- a/src/tests.ruleset +++ b/src/tests.ruleset @@ -12,4 +12,7 @@ + + + From dfc7dea7c1e5b534a59206b8e9ab5996313c7cd3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 25 Sep 2019 06:26:43 -0600 Subject: [PATCH 079/889] Add a bunch of useful solution items --- src/Library.sln | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/Library.sln b/src/Library.sln index 17645391..09dfb1fe 100644 --- a/src/Library.sln +++ b/src/Library.sln @@ -1,20 +1,30 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29322.22 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library", "Library\Library.csproj", "{C06D702E-6FC7-453B-BDDF-608F825EC003}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library", "Library\Library.csproj", "{C06D702E-6FC7-453B-BDDF-608F825EC003}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library.Tests", "Library.Tests\Library.Tests.csproj", "{DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library.Tests", "Library.Tests\Library.Tests.csproj", "{DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1CE9670B-D5FF-46A7-9D00-24E70E6ED48B}" + ProjectSection(SolutionItems) = preProject + ..\.editorconfig = ..\.editorconfig + Directory.Build.props = Directory.Build.props + Directory.Build.targets = Directory.Build.targets + ..\global.json = ..\global.json + ..\nuget.config = ..\nuget.config + shipping.ruleset = shipping.ruleset + stylecop.json = stylecop.json + tests.ruleset = tests.ruleset + ..\version.json = ..\version.json + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C06D702E-6FC7-453B-BDDF-608F825EC003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C06D702E-6FC7-453B-BDDF-608F825EC003}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -25,4 +35,10 @@ Global {DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}.Release|Any CPU.ActiveCfg = Release|Any CPU {DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E3944F6A-384B-4B0F-B93F-3BD513DC57BD} + EndGlobalSection EndGlobal From 3c52f6060a928ea6a5297bcabdaf927bdc921cf3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 25 Sep 2019 06:26:06 -0600 Subject: [PATCH 080/889] Enable C# 8 nullable features Also update to 3.0 .NET Core SDK as required for the nullable feature. --- global.json | 2 +- src/Directory.Build.props | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 3d26ee65..79422f0c 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "2.2.401" + "version": "3.0.100" } } diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 8c337275..9c875502 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -5,7 +5,8 @@ $(RepoRootPath)obj\$(MSBuildProjectName)\ $(RepoRootPath)bin\$(MSBuildProjectName)\ $(RepoRootPath)bin\Packages\$(Configuration)\ - 7.3 + 8.0 + enable true true From fb5b061b2979cbb6116628ce342902e05061ca52 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 25 Sep 2019 06:31:53 -0600 Subject: [PATCH 081/889] Fix CI trigger for validate/* branches --- azure-pipelines/official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index dab6c2e3..d002dbb3 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -3,7 +3,7 @@ trigger: include: - master - microbuild - - validate/* + - 'validate/*' paths: exclude: - doc/ From a2556bf66ce72ef84c33077b94a9c83100d88e37 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Oct 2019 08:35:23 -0600 Subject: [PATCH 082/889] Fix Install-DotNetSdk on machines without IE configured --- tools/Install-DotNetSdk.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index a5d52eed..50687706 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -63,7 +63,7 @@ Function Get-InstallerExe($Version, [switch]$Runtime) { # Get the latest/actual version for the specified one if (([Version]$Version).Build -eq -1) { - $versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/latest.version") + $versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/latest.version" -UseBasicParsing) $Version = $versionInfo[-1] } @@ -133,7 +133,7 @@ if ($IsMacOS -or $IsLinux) { } if (-not (Test-Path $DotNetInstallScriptPath)) { - Invoke-WebRequest -Uri $DownloadUri -OutFile $DotNetInstallScriptPath + Invoke-WebRequest -Uri $DownloadUri -OutFile $DotNetInstallScriptPath -UseBasicParsing if ($IsMacOS -or $IsLinux) { chmod +x $DotNetInstallScriptPath } From f78ee0462a078f4190fa7e811e3a86105f545d61 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 14 Nov 2019 21:43:54 -0700 Subject: [PATCH 083/889] Capture exit codes within init.cmd from ps1 script --- init.cmd | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/init.cmd b/init.cmd index 5bef08da..970285c2 100644 --- a/init.cmd +++ b/init.cmd @@ -1,3 +1,4 @@ -@set PS1UnderCmd=1 -powershell.exe -ExecutionPolicy bypass -Command "& '%~dpn0.ps1'" %* -@set PS1UnderCmd= +@echo off +SETLOCAL +set PS1UnderCmd=1 +powershell.exe -NoProfile -NoLogo -ExecutionPolicy bypass -Command "try { & '%~dpn0.ps1' %*; exit $LASTEXITCODE } catch { write-host $_; exit 1 }" From 7248b76f71de8ba2afa097d129367d784c371159 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 14 Nov 2019 21:44:06 -0700 Subject: [PATCH 084/889] Add Expand-Template.cmd stub --- Expand-Template.cmd | 4 ++++ Expand-Template.ps1 | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 Expand-Template.cmd diff --git a/Expand-Template.cmd b/Expand-Template.cmd new file mode 100644 index 00000000..970285c2 --- /dev/null +++ b/Expand-Template.cmd @@ -0,0 +1,4 @@ +@echo off +SETLOCAL +set PS1UnderCmd=1 +powershell.exe -NoProfile -NoLogo -ExecutionPolicy bypass -Command "try { & '%~dpn0.ps1' %*; exit $LASTEXITCODE } catch { write-host $_; exit 1 }" diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 89614a2d..5225f878 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -149,11 +149,11 @@ try { # Self destruct $Invocation = (Get-Variable MyInvocation -Scope 1).Value - git rm Expand-Template.ps1 + git rm Expand-Template.* git rm :/azure-pipelines/expand-template.yml # Self-integrity check - Get-ChildItem -Recurse -File -Exclude bin,obj,README.md,Expand-Template.ps1 |? { -not $_.FullName.Contains("obj") } |% { + Get-ChildItem -Recurse -File -Exclude bin,obj,README.md,Expand-Template.* |? { -not $_.FullName.Contains("obj") } |% { $PLACEHOLDERS = Get-Content -Path $_.FullName |? { $_.Contains('PLACEHOLDER') } if ($PLACEHOLDERS) { Write-Error "PLACEHOLDER discovered in $($_.FullName)" @@ -162,6 +162,15 @@ try { # Commit the changes git commit -qm "Expanded template for $LibraryName" -m "This expansion done by the (now removed) Expand-Template.ps1 script." + + Write-Host -ForegroundColor Green "Template successfully expanded." + + if ($env:PS1UnderCmd) { + # We're running under the Expand-Template.cmd script. + # Since we just deleted it from disk cmd.exe will complain. Just advise the user it's OK. + Write-Host -ForegroundColor Green 'Disregard an error you may see: "The batch file cannot be found." We just cleaned up after ourselves.' + } + } finally { Pop-Location } From 65c7a0b46f10e72cf2f73e169956da9b15170e4c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 14 Nov 2019 22:01:51 -0700 Subject: [PATCH 085/889] Fix synopsis of Convert-PDB.ps1 script Fixes #24 --- azure-pipelines/Convert-PDB.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/Convert-PDB.ps1 b/azure-pipelines/Convert-PDB.ps1 index 00549f71..a3212213 100644 --- a/azure-pipelines/Convert-PDB.ps1 +++ b/azure-pipelines/Convert-PDB.ps1 @@ -1,6 +1,6 @@ <# .SYNOPSIS - Builds all projects in this repo. + Converts between Windows PDB and Portable PDB formats. .PARAMETER DllPath The path to the DLL whose PDB is to be converted. .PARAMETER PdbPath From d6fe2405533b5f5da639dfb65e1ef5e8dfabf4ee Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 14 Nov 2019 22:03:46 -0700 Subject: [PATCH 086/889] Add comment explaining where to get the guid from Fixes #28 --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c4c3f607..2dbb2cbb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,7 +15,7 @@ variables: BuildConfiguration: Release BuildPlatform: Any CPU codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ - ci_feed: /a5a3bad0-e566-4c53-be83-6458be8d1653 # find guid used by Azure DevOps Artifacts for the feed + ci_feed: /a5a3bad0-e566-4c53-be83-6458be8d1653 # find guid used by Azure DevOps Artifacts for the feed. Learn more at https://github.com/AArnott/Library.Template/issues/28 NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages jobs: From 51d643cbab57eb43bc15d294e153c7ce40b76e9f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 22 Nov 2019 09:02:44 -0700 Subject: [PATCH 087/889] Avoid restoring packages under -whatif --- init.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.ps1 b/init.ps1 index e01f3aed..f8ca00a5 100644 --- a/init.ps1 +++ b/init.ps1 @@ -44,7 +44,7 @@ Push-Location $PSScriptRoot try { $HeaderColor = 'Green' - if (!$NoRestore) { + if (!$NoRestore -and $PSCmdlet.ShouldProcess("NuGet packages", "Restore")) { Write-Host "Restoring NuGet packages" -ForegroundColor $HeaderColor dotnet restore src if ($lastexitcode -ne 0) { From 5a6c63701f386823b6e12d4a0052d3ced73ae332 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 4 Dec 2019 13:03:21 -0700 Subject: [PATCH 088/889] Fix and add to the init.ps1 description docs --- init.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/init.ps1 b/init.ps1 index f8ca00a5..9dfb6afb 100644 --- a/init.ps1 +++ b/init.ps1 @@ -2,8 +2,9 @@ .SYNOPSIS Installs dependencies required to build and test the projects in this repository. .DESCRIPTION -This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location, -unless `-InstallLocality machine` is specified. +This MAY not require elevation, as the SDK and runtimes are installed to a per-user location, +unless the `-InstallLocality` switch is specified directing to a per-repo or per-machine location. +See detailed help on that switch for more information. .PARAMETER InstallLocality A value indicating whether dependencies should be installed locally to the repo or at a per-user location. Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. From b79e0301b39153cbd09dca06767c7264178e274e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 11 Dec 2019 17:13:57 -0700 Subject: [PATCH 089/889] Use AGENT_TEMPDIRECTORY for tools AGENT_TOOLSDIRECTORY may not be cleaned between each build, so AGENT_TEMPDIRECTORY which certainly is cleaned is a better place to put files that might need newer versions downloaded and/or installed each time. --- azure-pipelines/Get-TempToolsPath.ps1 | 6 +++--- azure-pipelines/Get-nbgv.ps1 | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/azure-pipelines/Get-TempToolsPath.ps1 b/azure-pipelines/Get-TempToolsPath.ps1 index 97c552c0..bb3da8e3 100644 --- a/azure-pipelines/Get-TempToolsPath.ps1 +++ b/azure-pipelines/Get-TempToolsPath.ps1 @@ -1,7 +1,7 @@ -if ($env:AGENT_TOOLSDIRECTORY) { - $path = "$env:AGENT_TOOLSDIRECTORY\vs-platform\tools" +if ($env:AGENT_TEMPDIRECTORY) { + $path = "$env:AGENT_TEMPDIRECTORY\$env:BUILD_BUILDID" } elseif ($env:localappdata) { - $path = "$env:localappdata\vs-platform\tools" + $path = "$env:localappdata\gitrepos\tools" } else { $path = "$PSScriptRoot\..\obj\tools" } diff --git a/azure-pipelines/Get-nbgv.ps1 b/azure-pipelines/Get-nbgv.ps1 index 925eecdd..a5be2cf7 100644 --- a/azure-pipelines/Get-nbgv.ps1 +++ b/azure-pipelines/Get-nbgv.ps1 @@ -10,11 +10,7 @@ if ($existingTool) { return $existingTool.Path } -if ($env:AGENT_TEMPDIRECTORY) { - $toolInstallDir = "$env:AGENT_TEMPDIRECTORY/$env:BUILD_BUILDID" -} else { - $toolInstallDir = "$PSScriptRoot/../obj/tools" -} +$toolInstallDir = & "$PSScriptRoot/Get-TempToolsPath.ps1" $toolPath = "$toolInstallDir/nbgv" if (!(Test-Path $toolInstallDir)) { New-Item -Path $toolInstallDir -ItemType Directory | Out-Null } From 153cd7d1aaa4738c163e1ad2ee813075183890b0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 11 Dec 2019 17:31:06 -0700 Subject: [PATCH 090/889] Upgrade NuGet credprovider in Azure Pipelines On private agents where it may exist from a prior build, it's important that we update it to whatever the latest version is. --- azure-pipelines/install-dependencies.yml | 2 +- init.ps1 | 7 ++++++- tools/Install-NuGetCredProvider.ps1 | 6 +++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 8da07957..9257db85 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -4,7 +4,7 @@ parameters: steps: - powershell: | - .\init.ps1 -AccessToken '$(System.AccessToken)' ${{ parameters['initArgs'] }} + .\init.ps1 -AccessToken '$(System.AccessToken)' ${{ parameters['initArgs'] }} -UpgradePrerequisites dotnet --info displayName: Install prerequisites diff --git a/init.ps1 b/init.ps1 index 9dfb6afb..ae4ce9a6 100644 --- a/init.ps1 +++ b/init.ps1 @@ -15,6 +15,9 @@ Per-repo can lead to file locking issues when dotnet.exe is left running as a bu Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. .PARAMETER NoPrerequisites Skips the installation of prerequisite software (e.g. SDKs, tools). +.PARAMETER UpgradePrerequisites +Takes time to install prerequisites even if they are already present in case they need to be upgraded. +No effect if -NoPrerequisites is specified. .PARAMETER NoRestore Skips the package restore step. .PARAMETER AccessToken @@ -27,13 +30,15 @@ Param ( [Parameter()] [switch]$NoPrerequisites, [Parameter()] + [switch]$UpgradePrerequisites, + [Parameter()] [switch]$NoRestore, [Parameter()] [string]$AccessToken ) if (!$NoPrerequisites) { - & "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken + & "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken -Force:$UpgradePrerequisites & "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality } diff --git a/tools/Install-NuGetCredProvider.ps1 b/tools/Install-NuGetCredProvider.ps1 index ba70f2bd..0a8d77f6 100644 --- a/tools/Install-NuGetCredProvider.ps1 +++ b/tools/Install-NuGetCredProvider.ps1 @@ -4,11 +4,15 @@ from https://github.com/microsoft/artifacts-credprovider to assist in authenticating to Azure Artifact feeds in interactive development or unattended build agents. +.PARAMETER Force + Forces install of the CredProvider plugin even if one already exists. This is useful to upgrade an older version. .PARAMETER AccessToken An optional access token for authenticating to Azure Artifacts authenticated feeds. #> [CmdletBinding()] Param ( + [Parameter()] + [switch]$Force, [Parameter()] [string]$AccessToken ) @@ -35,7 +39,7 @@ if ($IsMacOS -or $IsLinux) { chmod u+x $installerScript } -& $installerScript +& $installerScript -Force:$Force if ($AccessToken) { $endpoints = @() From be9bbd097fb0410325e1d896f9d3a55f2280e64b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 18 Dec 2019 13:50:18 -0700 Subject: [PATCH 091/889] Update package refs Also stop packing pdb in main nupkg --- src/Directory.Build.props | 9 ++++----- src/Library.Tests/Library.Tests.csproj | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 9c875502..f6d3c9ce 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -20,14 +20,13 @@ true true snupkg - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - - - - + + + + diff --git a/src/Library.Tests/Library.Tests.csproj b/src/Library.Tests/Library.Tests.csproj index 7323c8d9..08f74be7 100644 --- a/src/Library.Tests/Library.Tests.csproj +++ b/src/Library.Tests/Library.Tests.csproj @@ -14,8 +14,8 @@ - - + + From e888eb54024e259c801b9b37d363d08ef3eb3f1c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 24 Dec 2019 13:23:35 -0700 Subject: [PATCH 092/889] Bump SDK version to 3.1 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 79422f0c..e9aac8c2 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "3.0.100" + "version": "3.1.100" } } From 35bf0941b3900c248c745588f62d711a3bf6860c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 24 Dec 2019 13:36:35 -0700 Subject: [PATCH 093/889] Test on .NET Core 3.1 .NET Core 2.2 is no longer supported. Testing on 2.1 and 3.1 focus testing on LTS releases of .NET Core. --- azure-pipelines/dotnet.yml | 6 +++--- src/Library.Tests/Library.Tests.csproj | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 21b189f2..9d910d2d 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -26,11 +26,11 @@ steps: workingDirectory: src - task: DotNetCoreCLI@2 - displayName: dotnet test -f netcoreapp2.2 + displayName: dotnet test -f netcoreapp3.1 inputs: command: test - arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.2 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true - testRunTitle: netcoreapp2.2-$(Agent.JobName) + arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true + testRunTitle: netcoreapp3.1-$(Agent.JobName) workingDirectory: src - task: PowerShell@2 diff --git a/src/Library.Tests/Library.Tests.csproj b/src/Library.Tests/Library.Tests.csproj index 08f74be7..78ebcfd4 100644 --- a/src/Library.Tests/Library.Tests.csproj +++ b/src/Library.Tests/Library.Tests.csproj @@ -1,7 +1,7 @@ - net472;netcoreapp2.1;netcoreapp2.2 + net472;netcoreapp2.1;netcoreapp3.1 false $(NoWarn);CS1591 true From 56ab8cb586bb555875acdfe597465ef75aec5dcb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 24 Dec 2019 14:35:30 -0700 Subject: [PATCH 094/889] Use latest StyleCop As necessary for nullable ref type syntax to not flag as warnings in StyleCop --- src/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index f6d3c9ce..ddd8ae60 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -27,7 +27,7 @@ - + From f863ad7bbd658e596534b9e60628cafa4538dca3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 3 Jan 2020 12:22:23 -0700 Subject: [PATCH 095/889] Upgrade signing plugin --- azure-pipelines/microbuild.before.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index 310b559e..b1efae6e 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -1,5 +1,5 @@ steps: -- task: MicroBuildSigningPlugin@1 +- task: MicroBuildSigningPlugin@2 inputs: signType: $(SignType) zipSources: false From 366d5df26c31eb212dc49c970ec77597874b5fc3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 14 Jan 2020 14:59:28 -0700 Subject: [PATCH 096/889] Start with GitHub Actions (#34) --- .github/workflows/build.yml | 99 ++++++++++++++++++++++++ Expand-Template.ps1 | 3 +- README.md | 4 +- azure-pipelines.yml | 1 - azure-pipelines/Set-EnvVars.ps1 | 46 ++++++++++- azure-pipelines/artifacts/Variables.ps1 | 10 +-- azure-pipelines/artifacts/_pipelines.ps1 | 49 +----------- azure-pipelines/artifacts/_stage_all.ps1 | 59 ++++++++++++++ azure-pipelines/build.yml | 4 +- azure-pipelines/variables/_pipelines.ps1 | 8 +- tools/Install-DotNetSdk.ps1 | 38 +-------- 11 files changed, 222 insertions(+), 99 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 azure-pipelines/artifacts/_stage_all.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..4e991873 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,99 @@ +name: CI + +on: + push: + branches: + - master + - microbuild + - validate/* + pull_request: + +env: + TreatWarningsAsErrors: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + BUILDCONFIGURATION: Release + codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ + ci_feed: /a5a3bad0-e566-4c53-be83-6458be8d1653 # find guid used by Azure DevOps Artifacts for the feed. Learn more at https://github.com/AArnott/Library.Template/issues/28 +# NUGET_PACKAGES: ${{ env.GITHUB_WORKSPACE }}/.nuget/packages + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-18.04 + - macos-latest + - windows-latest + + steps: + - uses: actions/checkout@v2 + - name: Deep clone + run: git fetch --prune --unshallow origin HEAD + - name: Install prerequisites + run: | + ./init.ps1 -UpgradePrerequisites + dotnet --info + shell: pwsh + - name: Set pipeline variables based on source + run: azure-pipelines/variables/_pipelines.ps1 + shell: pwsh + - name: build + run: dotnet build src --no-restore -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/build.binlog" + - name: pack + run: dotnet pack src --no-build -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/pack.binlog" + - name: test + run: dotnet test src --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true + - name: Update pipeline variables based on build outputs + run: azure-pipelines/variables/_pipelines.ps1 + shell: pwsh + - name: Collect artifacts + run: azure-pipelines/artifacts/_stage_all.ps1 + shell: pwsh + - name: Upload project.assets.json files + if: always() + uses: actions/upload-artifact@v1 + with: + name: projectAssetsJson-${{ runner.os }} + path: obj/_artifacts/projectAssetsJson + continue-on-error: true + - name: Upload variables + uses: actions/upload-artifact@v1 + with: + name: variables + path: obj/_artifacts/variables + if: runner.os == 'Windows' + continue-on-error: true + - name: Upload build_logs + if: always() + uses: actions/upload-artifact@v1 + with: + name: build_logs-${{ runner.os }} + path: obj/_artifacts/build_logs + continue-on-error: true + - name: Upload coverageResults + if: always() + uses: actions/upload-artifact@v1 + with: + name: coverageResults-${{ runner.os }} + path: obj/_artifacts/coverageResults + continue-on-error: true + - name: Upload symbols + uses: actions/upload-artifact@v1 + with: + name: symbols + path: obj/_artifacts/symbols + if: runner.os == 'Windows' + continue-on-error: true + - name: Upload deployables + uses: actions/upload-artifact@v1 + with: + name: deployables + path: obj/_artifacts/deployables + if: runner.os == 'Windows' + - name: Publish code coverage results to codecov.io + run: bash <(curl -s https://codecov.io/bash) + shell: bash + timeout-minutes: 3 + continue-on-error: true diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 5225f878..aa4f5ec2 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -125,7 +125,8 @@ try { } Replace-Placeholders -Path "README.md" -Replacements @{ "(?m)^.*\[NuGet package\][^`r`n]*"="[![NuGet package](https://img.shields.io/nuget/v/$LibraryName.svg)](https://nuget.org/packages/$LibraryName)" - "(?m)^.*\[Build Status\].*`r?`n"="" + "(?m)^.*\[Azure Pipelines status\].*`r?`n"="" + "(?m)^.*\[GitHub Actions status\].*`r?`n"="" "(?m)^.*\[codecov\].*`r?`n"="" } diff --git a/README.md b/README.md index d05ac0d7..0c3bcf59 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,9 @@ ***An awesome template for your awesome library*** ![NuGet package](https://img.shields.io/badge/nuget-your--package--here-yellow.svg) -[![Build Status](https://dev.azure.com/andrewarnott/OSS/_apis/build/status/AArnott.Library.Template?branchName=master)](https://dev.azure.com/andrewarnott/OSS/_build/latest?definitionId=29&branchName=master) + +[![Azure Pipelines status](https://dev.azure.com/andrewarnott/OSS/_apis/build/status/AArnott.Library.Template?branchName=master)](https://dev.azure.com/andrewarnott/OSS/_build/latest?definitionId=29&branchName=master) +![GitHub Actions status](https://github.com/aarnott/Library.Template/workflows/CI/badge.svg) [![codecov](https://codecov.io/gh/aarnott/library.template/branch/master/graph/badge.svg)](https://codecov.io/gh/aarnott/library.template) ## Features diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2dbb2cbb..c6eeb7b6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,7 +13,6 @@ variables: TreatWarningsAsErrors: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release - BuildPlatform: Any CPU codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ ci_feed: /a5a3bad0-e566-4c53-be83-6458be8d1653 # find guid used by Azure DevOps Artifacts for the feed. Learn more at https://github.com/AArnott/Library.Template/issues/28 NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages diff --git a/azure-pipelines/Set-EnvVars.ps1 b/azure-pipelines/Set-EnvVars.ps1 index 313cecff..907659a7 100644 --- a/azure-pipelines/Set-EnvVars.ps1 +++ b/azure-pipelines/Set-EnvVars.ps1 @@ -10,30 +10,70 @@ [CmdletBinding(SupportsShouldProcess=$true)] Param( [Parameter(Mandatory=$true, Position=1)] - $Variables + $Variables, + [string[]]$PrependPath ) if ($Variables.Count -eq 0) { return $true } -$cmdInstructions = !$env:TF_BUILD -and $env:PS1UnderCmd -eq '1' +$cmdInstructions = !$env:TF_BUILD -and !$env:GITHUB_ACTIONS -and $env:PS1UnderCmd -eq '1' if ($cmdInstructions) { Write-Warning "Environment variables have been set that will be lost because you're running under cmd.exe" Write-Host "Environment variables that must be set manually:" -ForegroundColor Blue +} else { + Write-Host "Environment variables set:" -ForegroundColor Blue + $envVars + if ($PrependPath) { + Write-Host "Paths prepended to PATH: $PrependPath" + } +} + +if ($env:TF_BUILD) { + Write-Host "Azure Pipelines detected. Logging commands will be used to propagate environment variables and prepend path." +} + +if ($env:GITHUB_ACTIONS) { + Write-Host "GitHub Actions detected. Logging commands will be used to propagate environment variables and prepend path." } $Variables.GetEnumerator() |% { Set-Item -Path env:$($_.Key) -Value $_.Value - # If we're running in Azure Pipelines, set these environment variables + # If we're running in a cloud CI, set these environment variables so they propagate. if ($env:TF_BUILD) { Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)" } + if ($env:GITHUB_ACTIONS) { + Write-Host "::set-env name=$($_.Key)::$($_.Value)" + } if ($cmdInstructions) { Write-Host "SET $($_.Key)=$($_.Value)" } } +$pathDelimiter = ';' +if ($IsMacOS -or $IsLinux) { + $pathDelimiter = ':' +} + +if ($PrependPath) { + $PrependPath |% { + $newPathValue = "$_$pathDelimiter$env:PATH" + Set-Item -Path env:PATH -Value $newPathValue + if ($cmdInstructions) { + Write-Host "SET PATH=$newPathValue" + } + + if ($env:TF_BUILD) { + Write-Host "##vso[task.prependpath]$_" + } + if ($env:GITHUB_ACTIONS) { + Write-Host "::add-path::$_" + } + } +} + return !$cmdInstructions diff --git a/azure-pipelines/artifacts/Variables.ps1 b/azure-pipelines/artifacts/Variables.ps1 index cfcb7df5..2ee09d42 100644 --- a/azure-pipelines/artifacts/Variables.ps1 +++ b/azure-pipelines/artifacts/Variables.ps1 @@ -2,13 +2,13 @@ # It "snaps" the values of these variables where we can compute them during the build, # and otherwise captures the scripts to run later during an Azure Pipelines environment release. -$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") -$ArtifactBasePath = "$RepoRoot\obj\_artifacts" -$VariablesArtifactPath = "$ArtifactBasePath\variables" +$RepoRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot (Join-Path .. ..))) +$ArtifactBasePath = Join-Path $RepoRoot (Join-Path obj _artifacts) +$VariablesArtifactPath = Join-Path $ArtifactBasePath variables if (-not (Test-Path $VariablesArtifactPath)) { New-Item -ItemType Directory -Path $VariablesArtifactPath | Out-Null } # Copy variables, either by value if the value is calculable now, or by script -Get-ChildItem -Path "$PSScriptRoot\..\variables" |% { +Get-ChildItem -Path (Join-Path $PSScriptRoot (Join-Path .. variables)) |% { $value = $null if (-not $_.BaseName.StartsWith('_')) { # Skip trying to interpret special scripts # First check the environment variables in case the variable was set in a queued build @@ -32,7 +32,7 @@ Get-ChildItem -Path "$PSScriptRoot\..\variables" |% { $value = Get-Content -Path $_.FullName } - Set-Content -Path "$VariablesArtifactPath\$($_.Name)" -Value $value + Set-Content -Path (Join-Path $VariablesArtifactPath $_.Name) -Value $value } @{ diff --git a/azure-pipelines/artifacts/_pipelines.ps1 b/azure-pipelines/artifacts/_pipelines.ps1 index 7451ab11..5bca7c6c 100644 --- a/azure-pipelines/artifacts/_pipelines.ps1 +++ b/azure-pipelines/artifacts/_pipelines.ps1 @@ -5,51 +5,6 @@ param ( [string]$ArtifactNameSuffix ) -$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") -if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { - $ArtifactStagingFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY -} else { - $ArtifactStagingFolder = "$RepoRoot\obj\_artifacts" - if (Test-Path $ArtifactStagingFolder) { - Remove-Item $ArtifactStagingFolder -Recurse -Force - } -} - -function Create-SymbolicLink { - param ( - $Link, - $Target - ) - - if ($Link -eq $Target) { - return - } - - if (Test-Path $Link) { Remove-Item $Link } - $LinkContainer = Split-Path $Link -Parent - if (!(Test-Path $LinkContainer)) { mkdir $LinkContainer } - Write-Verbose "Linking $Link to $Target" - if ($IsMacOS -or $IsLinux) { - ln $Target $Link - } else { - cmd /c mklink $Link $Target - } -} - -# Stage all artifacts -$Artifacts = & "$PSScriptRoot\_all.ps1" -$Artifacts |% { - $DestinationFolder = (Join-Path (Join-Path $ArtifactStagingFolder "$($_.ArtifactName)$ArtifactNameSuffix") $_.ContainerFolder).TrimEnd('\') - $Name = "$(Split-Path $_.Source -Leaf)" - - #Write-Host "$($_.Source) -> $($_.ArtifactName)\$($_.ContainerFolder)" -ForegroundColor Yellow - - if (-not (Test-Path $DestinationFolder)) { New-Item -ItemType Directory -Path $DestinationFolder | Out-Null } - if (Test-Path -PathType Leaf $_.Source) { # skip folders - Create-SymbolicLink -Link "$DestinationFolder\$Name" -Target $_.Source - } -} - -$Artifacts |% { $_.ArtifactName } | Get-Unique |% { - Write-Host "##vso[artifact.upload containerfolder=$_$ArtifactNameSuffix;artifactname=$_$ArtifactNameSuffix;]$ArtifactStagingFolder/$_$ArtifactNameSuffix" +& "$PSScriptRoot/_stage_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix |% { + Write-Host "##vso[artifact.upload containerfolder=$($_.Name);artifactname=$($_.Name);]$($_.Path)" } diff --git a/azure-pipelines/artifacts/_stage_all.ps1 b/azure-pipelines/artifacts/_stage_all.ps1 new file mode 100644 index 00000000..a05db529 --- /dev/null +++ b/azure-pipelines/artifacts/_stage_all.ps1 @@ -0,0 +1,59 @@ +# This script links all the artifacts described by _all.ps1 +# into a staging directory, reading for uploading to a cloud build artifact store. +# It returns a sequence of objects with Name and Path properties. + +param ( + [string]$ArtifactNameSuffix +) + +$RepoRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot (Join-Path .. ..))) +if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { + $ArtifactStagingFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY +} else { + $ArtifactStagingFolder = Join-Path $RepoRoot (Join-Path obj _artifacts) + if (Test-Path $ArtifactStagingFolder) { + Remove-Item $ArtifactStagingFolder -Recurse -Force + } +} + +function Create-SymbolicLink { + param ( + $Link, + $Target + ) + + if ($Link -eq $Target) { + return + } + + if (Test-Path $Link) { Remove-Item $Link } + $LinkContainer = Split-Path $Link -Parent + if (!(Test-Path $LinkContainer)) { mkdir $LinkContainer } + Write-Verbose "Linking $Link to $Target" + if ($IsMacOS -or $IsLinux) { + ln $Target $Link | Out-Null + } else { + cmd /c mklink $Link $Target | Out-Null + } +} + +# Stage all artifacts +$Artifacts = & "$PSScriptRoot\_all.ps1" +$Artifacts |% { + $DestinationFolder = (Join-Path (Join-Path $ArtifactStagingFolder "$($_.ArtifactName)$ArtifactNameSuffix") $_.ContainerFolder).TrimEnd('\') + $Name = "$(Split-Path $_.Source -Leaf)" + + #Write-Host "$($_.Source) -> $($_.ArtifactName)\$($_.ContainerFolder)" -ForegroundColor Yellow + + if (-not (Test-Path $DestinationFolder)) { New-Item -ItemType Directory -Path $DestinationFolder | Out-Null } + if (Test-Path -PathType Leaf $_.Source) { # skip folders + Create-SymbolicLink -Link (Join-Path $DestinationFolder $Name) -Target $_.Source + } +} + +$Artifacts |% { "$($_.ArtifactName)$ArtifactNameSuffix" } | Get-Unique |% { + $artifact = New-Object -TypeName PSObject + Add-Member -InputObject $artifact -MemberType NoteProperty -Name Name -Value $_ + Add-Member -InputObject $artifact -MemberType NoteProperty -Name Path -Value (Join-Path $ArtifactStagingFolder $_) + Write-Output $artifact +} diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 05e32a18..e1a73d4d 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -17,7 +17,7 @@ jobs: - job: Linux pool: - vmImage: Ubuntu 16.04 + vmImage: Ubuntu 18.04 steps: - checkout: self clean: true @@ -41,7 +41,7 @@ jobs: - Linux - macOS pool: - vmImage: Ubuntu 16.04 + vmImage: Ubuntu 18.04 condition: succeededOrFailed() steps: - checkout: self diff --git a/azure-pipelines/variables/_pipelines.ps1 b/azure-pipelines/variables/_pipelines.ps1 index 9fa0c16b..28230b81 100644 --- a/azure-pipelines/variables/_pipelines.ps1 +++ b/azure-pipelines/variables/_pipelines.ps1 @@ -5,11 +5,15 @@ # what the build would do. So only set them if they have not already been set. (& "$PSScriptRoot\_all.ps1").GetEnumerator() |% { - if (Test-Path -Path "env:$($_.Key.ToUpper())") { + if (Test-Path -Path "env:$($_.Key)") { Write-Host "Skipping setting $($_.Key) because variable is already set." -ForegroundColor Cyan } else { Write-Host "$($_.Key)=$($_.Value)" -ForegroundColor Yellow - Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)" + if ($env:TF_BUILD) { + Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)" + } elseif ($env:GITHUB_ACTIONS) { + Write-Host "::set-env name=$($_.Key)::$($_.Value)" + } Set-Item -Path "env:$($_.Key)" -Value $_.Value } } diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 50687706..f29cb0a6 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -156,41 +156,5 @@ $runtimeVersions | Get-Unique |% { } if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these installed runtimes?")) { - if ($env:TF_BUILD) { - Write-Host "Azure Pipelines detected. Logging commands will be used to propagate environment variables and prepend path." - } - - if ($IsMacOS -or $IsLinux) { - $envVars['PATH'] = "${DotNetInstallDir}:$env:PATH" - } else { - $envVars['PATH'] = "$DotNetInstallDir;$env:PATH" - } - - $envVars.GetEnumerator() |% { - Set-Item -Path env:$($_.Key) -Value $_.Value - - # If we're running in Azure Pipelines, set these environment variables - if ($env:TF_BUILD) { - Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)" - } - } - - if ($env:TF_BUILD) { - Write-Host "##vso[task.prependpath]$DotNetInstallDir" - } -} - -if ($env:PS1UnderCmd -eq '1') { - Write-Warning "Environment variable changes will be lost because you're running under cmd.exe. Run these commands manually:" - $envVars.GetEnumerator() |% { - if ($_.Key -eq 'PATH') { - # Special case this one for readability - Write-Host "SET PATH=$DotNetInstallDir;%PATH%" - } else { - Write-Host "SET $($_.Key)=$($_.Value)" - } - } -} else { - Write-Host "Environment variables set:" -ForegroundColor Blue - $envVars + & "$PSScriptRoot/../azure-pipelines/Set-EnvVars.ps1" -Variables $envVars -PrependPath $DotNetInstallDir | Out-Null } From ad12e4a7f4af5563a6132015340e888cd068a714 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 14 Jan 2020 20:22:47 -0700 Subject: [PATCH 097/889] Simpler way to avoid shallow clone --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e991873..4e178096 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,8 +29,8 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Deep clone - run: git fetch --prune --unshallow origin HEAD + with: + fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - name: Install prerequisites run: | ./init.ps1 -UpgradePrerequisites From 2e0c3eb6f0273c6f2350eb5d4a01016dccced6a8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 16 Jan 2020 13:49:59 -0700 Subject: [PATCH 098/889] Pin the compiler version Although we already pin the SDK which includes compilers, when we use msbuild.exe (including VS) to build we still get whatever compilers are on the box. Pinning the compilers has many of the same merits as pinning the SDK. --- src/Directory.Build.props | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index ddd8ae60..03a6a1c3 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -27,6 +27,7 @@ + From 45818306689ea5709b30f398e86908cf02eb1ab9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 17 Jan 2020 07:29:10 -0700 Subject: [PATCH 099/889] Set NUGET_PACKAGES in CI workflow --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e178096..2d71d97a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ env: BUILDCONFIGURATION: Release codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ ci_feed: /a5a3bad0-e566-4c53-be83-6458be8d1653 # find guid used by Azure DevOps Artifacts for the feed. Learn more at https://github.com/AArnott/Library.Template/issues/28 -# NUGET_PACKAGES: ${{ env.GITHUB_WORKSPACE }}/.nuget/packages + NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages jobs: build: From f2a16d29d53c6bc953aeb4e4e55812de80b27697 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 21 Jan 2020 21:34:09 -0700 Subject: [PATCH 100/889] Update Azure Repos SourceLink reference --- src/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 9cea46c7..86226016 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -26,7 +26,7 @@ - + From aa77109d0aaada2d6e53b3035a9a57e4249ea35e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 13 Feb 2020 13:45:54 -0700 Subject: [PATCH 101/889] Update coverlet.msbuild to 2.8.0 --- azure-pipelines/artifacts/coverageResults.ps1 | 4 ++-- azure-pipelines/publish-codecoverage.yml | 2 +- src/Library.Tests/Library.Tests.csproj | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/artifacts/coverageResults.ps1 b/azure-pipelines/artifacts/coverageResults.ps1 index 7d1e9a35..addbf85c 100644 --- a/azure-pipelines/artifacts/coverageResults.ps1 +++ b/azure-pipelines/artifacts/coverageResults.ps1 @@ -3,7 +3,7 @@ $RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") # Prepare code coverage reports for merging on another machine if ($env:SYSTEM_DEFAULTWORKINGDIRECTORY) { Write-Host "Substituting $env:SYSTEM_DEFAULTWORKINGDIRECTORY with `"{reporoot}`"" - $reports = Get-ChildItem "$RepoRoot/bin/coverage.cobertura.xml" -Recurse + $reports = Get-ChildItem "$RepoRoot/bin/coverage.*.cobertura.xml" -Recurse $reports |% { $content = Get-Content -Path $_ |% { $_ -Replace [regex]::Escape($env:SYSTEM_DEFAULTWORKINGDIRECTORY), "{reporoot}" } Set-Content -Path $_ -Value $content -Encoding UTF8 @@ -16,7 +16,7 @@ if (!((Test-Path $RepoRoot\bin) -and (Test-Path $RepoRoot\obj))) { return } @{ $RepoRoot = ( - @(Get-ChildItem "$RepoRoot\bin\coverage.cobertura.xml" -Recurse) + + @(Get-ChildItem "$RepoRoot\bin\coverage.*.cobertura.xml" -Recurse) + (Get-ChildItem "$RepoRoot\obj\*.cs" -Recurse) ); } diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index 6d367de9..976f0781 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -15,7 +15,7 @@ steps: dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.2.2 --configfile azure-pipelines/justnugetorg.nuget.config Copy-Item -Recurse $(Pipeline.Workspace)/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj Write-Host "Substituting {reporoot} with $(System.DefaultWorkingDirectory)" - $reports = Get-ChildItem -Recurse "$(Pipeline.Workspace)/coverage.cobertura.xml" + $reports = Get-ChildItem -Recurse "$(Pipeline.Workspace)/coverage.*.cobertura.xml" $reports |% { $content = Get-Content -Path $_ |% { $_.Replace("{reporoot}", "$(System.DefaultWorkingDirectory)") } Set-Content -Path $_ -Value $content -Encoding UTF8 diff --git a/src/Library.Tests/Library.Tests.csproj b/src/Library.Tests/Library.Tests.csproj index 78ebcfd4..1cf1c1b0 100644 --- a/src/Library.Tests/Library.Tests.csproj +++ b/src/Library.Tests/Library.Tests.csproj @@ -14,7 +14,7 @@ - + From ca0811eb720026e8510a4f83813eb15019ac476c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 13 Feb 2020 13:48:09 -0700 Subject: [PATCH 102/889] Update SDK package references --- src/Directory.Build.props | 2 +- src/Library.Tests/Library.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 03a6a1c3..9b208727 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -26,7 +26,7 @@ - + diff --git a/src/Library.Tests/Library.Tests.csproj b/src/Library.Tests/Library.Tests.csproj index 1cf1c1b0..8018f97d 100644 --- a/src/Library.Tests/Library.Tests.csproj +++ b/src/Library.Tests/Library.Tests.csproj @@ -15,7 +15,7 @@ - + From fc25f7a1665fccf4c1cc4d574f18e22894955387 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 30 Jan 2020 13:05:05 -0700 Subject: [PATCH 103/889] Remove unused ci_feed from GitHub workflow --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2d71d97a..86c35164 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,6 @@ env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BUILDCONFIGURATION: Release codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ - ci_feed: /a5a3bad0-e566-4c53-be83-6458be8d1653 # find guid used by Azure DevOps Artifacts for the feed. Learn more at https://github.com/AArnott/Library.Template/issues/28 NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages jobs: From 5fbad730e20884725a8930a733f2490ac919c07f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 3 Feb 2020 15:53:59 -0700 Subject: [PATCH 104/889] Always collect artifacts, even on build failures --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 86c35164..f3e10f53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,6 +50,7 @@ jobs: - name: Collect artifacts run: azure-pipelines/artifacts/_stage_all.ps1 shell: pwsh + if: always() - name: Upload project.assets.json files if: always() uses: actions/upload-artifact@v1 From ba764031a80c365dbf0182c67fda295fd89aaa5b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 25 Feb 2020 13:33:55 -0700 Subject: [PATCH 105/889] Use macOS-10.15 macOS 10.13 is about to be decommissioned on Azure Pipelines --- azure-pipelines/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index e1a73d4d..186438a1 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -27,7 +27,7 @@ jobs: - job: macOS pool: - vmImage: macOS 10.13 + vmImage: macOS-10.15 steps: - checkout: self clean: true From d54e43ed8c74c7bc243eee86717fd1fdff9f9bfb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 27 Feb 2020 23:18:59 -0700 Subject: [PATCH 106/889] More assuredly pin the .NET Core SDK version There's talk that the .NET SDK may change the default value for rollForward from "patch" to "latestMajor", effectively turning our "version" property to a minimum instead of a 'pin'. Setting rollForward explicitly guards against this. --- global.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/global.json b/global.json index e9aac8c2..5c8032d3 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,7 @@ { "sdk": { - "version": "3.1.100" + "version": "3.1.100", + "rollForward": "latestPatch", + "allowPrerelease": false } } From e0365203f8562571e344bfeb54418ca65af08fb5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 29 Feb 2020 07:06:03 -0700 Subject: [PATCH 107/889] Generate msbuild properties for every restored package --- src/Directory.Build.props | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 9b208727..5e0395b5 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,4 +1,5 @@ - + Debug $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\')) @@ -34,4 +35,9 @@ + + + + + From c608bf061aaa56fd21b6c2af0b950f61e5132d05 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 3 Mar 2020 09:33:08 -0700 Subject: [PATCH 108/889] Only install .NET Core runtimes once per version --- tools/Install-DotNetSdk.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index f29cb0a6..0bd4082f 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -91,7 +91,7 @@ if ($InstallLocality -eq 'machine') { Install-DotNet -Version $sdkVersion } - $runtimeVersions |% { + $runtimeVersions | Get-Unique |% { if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { Install-DotNet -Version $_ -Runtime } From abf3830bc939537776c45be9d437cb4b89471baf Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 3 Mar 2020 09:50:03 -0700 Subject: [PATCH 109/889] Add Directory.Build.rsp file --- .gitignore | 1 + Directory.Build.rsp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 Directory.Build.rsp diff --git a/.gitignore b/.gitignore index e353101d..d060a300 100644 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,7 @@ StyleCopReport.xml *.pgc *.pgd *.rsp +!Directory.Build.rsp *.sbr *.tlb *.tli diff --git a/Directory.Build.rsp b/Directory.Build.rsp new file mode 100644 index 00000000..9a833a03 --- /dev/null +++ b/Directory.Build.rsp @@ -0,0 +1,16 @@ +#------------------------------------------------------------------------------ +# This file contains command-line options that MSBuild will process as part of +# every build, unless the "/noautoresponse" switch is specified. +# +# MSBuild processes the options in this file first, before processing the +# options on the command line. As a result, options on the command line can +# override the options in this file. However, depending on the options being +# set, the overriding can also result in conflicts. +# +# NOTE: The "/noautoresponse" switch cannot be specified in this file, nor in +# any response file that is referenced by this file. +#------------------------------------------------------------------------------ +/nr:false +/m +/verbosity:minimal +/clp:Summary;ForceNoAlign From d3613f0e0680faa5ddcc90386a1c310d8d076b96 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 6 Mar 2020 12:35:23 -0700 Subject: [PATCH 110/889] Fix ci_feed to allow for SignType.ps1 influence --- azure-pipelines/variables/ci_feed.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/variables/ci_feed.ps1 b/azure-pipelines/variables/ci_feed.ps1 index b5530b3f..82bad79d 100644 --- a/azure-pipelines/variables/ci_feed.ps1 +++ b/azure-pipelines/variables/ci_feed.ps1 @@ -1,4 +1,7 @@ -if ($env:SIGNTYPE -eq 'Real') { +$signType = $env:SIGNTYPE +if (!$signType) { $signType = & "$PSScriptRoot/SignType.ps1" } + +if ($signType -eq 'Real') { '09d8d03c-1ac8-456e-9274-4d2364527d99' # VSIDE-RealSigned-Release } else { 'da484c78-f942-44ef-b197-99e2a1bef53c' # VSIDE-TestSigned-Release From 3d164a2c0cfdd219930cd84db2db38051483da6d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 6 Mar 2020 13:07:24 -0700 Subject: [PATCH 111/889] Fix _pipelines.ps1 to check env vars in all caps --- azure-pipelines/variables/_pipelines.ps1 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/azure-pipelines/variables/_pipelines.ps1 b/azure-pipelines/variables/_pipelines.ps1 index 28230b81..14d6ffc2 100644 --- a/azure-pipelines/variables/_pipelines.ps1 +++ b/azure-pipelines/variables/_pipelines.ps1 @@ -5,15 +5,17 @@ # what the build would do. So only set them if they have not already been set. (& "$PSScriptRoot\_all.ps1").GetEnumerator() |% { - if (Test-Path -Path "env:$($_.Key)") { - Write-Host "Skipping setting $($_.Key) because variable is already set." -ForegroundColor Cyan + # Always use ALL CAPS for env var names since Azure Pipelines converts variable names to all caps and on non-Windows OS, env vars are case sensitive. + $keyCaps = $_.Key.ToUpper() + if (Test-Path -Path "env:$keyCaps") { + Write-Host "Skipping setting $keyCaps because variable is already set." -ForegroundColor Cyan } else { - Write-Host "$($_.Key)=$($_.Value)" -ForegroundColor Yellow + Write-Host "$keyCaps=$($_.Value)" -ForegroundColor Yellow if ($env:TF_BUILD) { - Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)" + Write-Host "##vso[task.setvariable variable=$keyCaps;]$($_.Value)" } elseif ($env:GITHUB_ACTIONS) { - Write-Host "::set-env name=$($_.Key)::$($_.Value)" + Write-Host "::set-env name=$keyCaps::$($_.Value)" } - Set-Item -Path "env:$($_.Key)" -Value $_.Value + Set-Item -Path "env:$keyCaps" -Value $_.Value } } From 43d492bdd13912fca8e600824e702b527ee7c2d1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 6 Mar 2020 13:12:28 -0700 Subject: [PATCH 112/889] Fix artifacts/variables.ps1 to check env vars in all caps --- azure-pipelines/artifacts/Variables.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/artifacts/Variables.ps1 b/azure-pipelines/artifacts/Variables.ps1 index 2ee09d42..c6330cd3 100644 --- a/azure-pipelines/artifacts/Variables.ps1 +++ b/azure-pipelines/artifacts/Variables.ps1 @@ -12,8 +12,11 @@ Get-ChildItem -Path (Join-Path $PSScriptRoot (Join-Path .. variables)) |% { $value = $null if (-not $_.BaseName.StartsWith('_')) { # Skip trying to interpret special scripts # First check the environment variables in case the variable was set in a queued build - if (Test-Path env:$($_.BaseName)) { - $value = Get-Content "env:$($_.BaseName)" + # Always use all caps for env var access because Azure Pipelines converts variables to upper-case for env vars, + # and on non-Windows env vars are case sensitive. + $envVarName = $_.BaseName.ToUpper() + if (Test-Path env:$envVarName) { + $value = Get-Content "env:$envVarName" } # If that didn't give us anything, try executing the script right now from its original position From 53448b3d6825a478d98c90af5b8fbf444ee8870a Mon Sep 17 00:00:00 2001 From: Tina Chen <43013310+xuachen@users.noreply.github.com> Date: Wed, 25 Mar 2020 15:36:12 -0700 Subject: [PATCH 113/889] Use agent jobname for for symbols folder --- azure-pipelines/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 9d910d2d..9b5a2e88 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -49,7 +49,7 @@ steps: - task: PublishSymbols@2 inputs: - SymbolsFolder: $(Build.ArtifactStagingDirectory)/symbols-Windows + SymbolsFolder: $(Build.ArtifactStagingDirectory)/symbols-$(Agent.JobName) SearchPattern: '**/*.pdb' IndexSources: false SymbolServerType: TeamServices From bdd6849d9956088b9163d771a926e1dc0a5f0b08 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 27 Mar 2020 10:05:42 -0600 Subject: [PATCH 114/889] Update to global.json 3.1.201 --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 5c8032d3..0275fa5c 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "3.1.100", - "rollForward": "latestPatch", + "version": "3.1.201", + "rollForward": "patch", "allowPrerelease": false } } From 8c4c16154cf2df279e716f6921fe9cb6cd7edffb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 27 Mar 2020 10:11:57 -0600 Subject: [PATCH 115/889] Consider test .runsettings files to be xml --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 03c2bcf3..3a833bdb 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,7 +16,7 @@ insert_final_newline = true trim_trailing_whitespace = true # Xml project files -[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,runsettings}] indent_size = 2 # Xml config files From 917c0492532ac0669bad1696df2b151926562d9a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 27 Mar 2020 10:12:41 -0600 Subject: [PATCH 116/889] Accommodate PathInfo as keys from artifact scripts --- azure-pipelines/artifacts/_all.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1 index 6f62be5c..171b55b8 100644 --- a/azure-pipelines/artifacts/_all.ps1 +++ b/azure-pipelines/artifacts/_all.ps1 @@ -28,7 +28,7 @@ Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% { Write-Warning "No files found for the `"$ArtifactName`" artifact." } else { $fileGroups.GetEnumerator() | % { - $BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key), [UriKind]::Absolute) + $BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key.ToString()), [UriKind]::Absolute) $_.Value | % { if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) { $_ = $_.FullName From 70a1f50d261b02bde5f121957c317a7cf8dbef3e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 27 Mar 2020 10:29:44 -0600 Subject: [PATCH 117/889] Collect dumps and sequence.xml files on test hangs and crashes This makes diagnosing test runner crashes and hangs on Azure Pipelines possible. After such a failure, a testResults artifact is collected that includes the `Sequence_*.xml` and `testhost.*.dmp` files collected at the timeout or crash. These files can then be downloaded from the Azure Pipeline artifacts for study. --- azure-pipelines/Darwin.runsettings | 1 + azure-pipelines/Linux.runsettings | 1 + azure-pipelines/Windows_NT.runsettings | 14 ++++++++++++++ azure-pipelines/artifacts/testResults.ps1 | 12 ++++++++++++ azure-pipelines/dotnet.yml | 6 +++--- azure-pipelines/install-dependencies.yml | 7 +++++++ 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 azure-pipelines/Darwin.runsettings create mode 100644 azure-pipelines/Linux.runsettings create mode 100644 azure-pipelines/Windows_NT.runsettings create mode 100644 azure-pipelines/artifacts/testResults.ps1 diff --git a/azure-pipelines/Darwin.runsettings b/azure-pipelines/Darwin.runsettings new file mode 100644 index 00000000..b444e819 --- /dev/null +++ b/azure-pipelines/Darwin.runsettings @@ -0,0 +1 @@ + diff --git a/azure-pipelines/Linux.runsettings b/azure-pipelines/Linux.runsettings new file mode 100644 index 00000000..b444e819 --- /dev/null +++ b/azure-pipelines/Linux.runsettings @@ -0,0 +1 @@ + diff --git a/azure-pipelines/Windows_NT.runsettings b/azure-pipelines/Windows_NT.runsettings new file mode 100644 index 00000000..0b43ecb0 --- /dev/null +++ b/azure-pipelines/Windows_NT.runsettings @@ -0,0 +1,14 @@ + + + + + + + + + %BUILD_ARTIFACTSTAGINGDIRECTORY% + + + + + diff --git a/azure-pipelines/artifacts/testResults.ps1 b/azure-pipelines/artifacts/testResults.ps1 new file mode 100644 index 00000000..1c9d3572 --- /dev/null +++ b/azure-pipelines/artifacts/testResults.ps1 @@ -0,0 +1,12 @@ +if ($env:AGENT_TEMPDIRECTORY) { + # The DotNetCoreCLI uses an alternate location to publish these files + $guidRegex = '^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$' + @{ + $env:AGENT_TEMPDIRECTORY = (Get-ChildItem $env:AGENT_TEMPDIRECTORY -Directory |? { $_.Name -match $guidRegex } |% { Get-ChildItem "$($_.FullName)\testhost.*.dmp","$($_.FullName)\Sequence_*.xml" -Recurse }); + } +} else { + $srcRoot = Resolve-Path "$PSScriptRoot\..\..\src" + @{ + $srcRoot = (Get-ChildItem "$srcRoot\TestResults" -Recurse -Directory | Get-ChildItem -Recurse -File); + } +} diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 9b5a2e88..0d837acb 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -12,7 +12,7 @@ steps: displayName: dotnet test -f net472 inputs: command: test - arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true + arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" testRunTitle: net472-$(Agent.JobName) workingDirectory: src condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) @@ -21,7 +21,7 @@ steps: displayName: dotnet test -f netcoreapp2.1 inputs: command: test - arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true + arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" testRunTitle: netcoreapp2.1-$(Agent.JobName) workingDirectory: src @@ -29,7 +29,7 @@ steps: displayName: dotnet test -f netcoreapp3.1 inputs: command: test - arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true + arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" testRunTitle: netcoreapp3.1-$(Agent.JobName) workingDirectory: src diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 9257db85..a778022a 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -8,6 +8,13 @@ steps: dotnet --info displayName: Install prerequisites +# The procdump tool and env var is required for dotnet test to collect hang/crash dumps of tests. +- powershell: | + choco install procdump + Write-Host "##vso[task.setvariable variable=PROCDUMP_PATH;]$env:ProgramData\chocolatey\bin\" + displayName: Install procdump + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) + - task: PowerShell@2 inputs: filePath: azure-pipelines/variables/_pipelines.ps1 From 941448de1f90a8abebfd487fbcfb9230f5bcdbb7 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 27 Mar 2020 14:51:27 -0600 Subject: [PATCH 118/889] Collect crash/hang dumps on GitHub Actions --- .github/workflows/Linux.runsettings | 1 + .github/workflows/Windows.runsettings | 14 ++++++++++++++ .github/workflows/build.yml | 13 ++++++++++++- .github/workflows/macOS.runsettings | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/Linux.runsettings create mode 100644 .github/workflows/Windows.runsettings create mode 100644 .github/workflows/macOS.runsettings diff --git a/.github/workflows/Linux.runsettings b/.github/workflows/Linux.runsettings new file mode 100644 index 00000000..b444e819 --- /dev/null +++ b/.github/workflows/Linux.runsettings @@ -0,0 +1 @@ + diff --git a/.github/workflows/Windows.runsettings b/.github/workflows/Windows.runsettings new file mode 100644 index 00000000..5e2244a0 --- /dev/null +++ b/.github/workflows/Windows.runsettings @@ -0,0 +1,14 @@ + + + + + + + + + %GITHUB_WORKSPACE% + + + + + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3e10f53..b167b51f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,10 @@ jobs: run: | ./init.ps1 -UpgradePrerequisites dotnet --info + if ($env:RUNNER_OS -eq "Windows") { + choco install procdump + Write-Host "##[set-env name=PROCDUMP_PATH;]$env:PROGRAMDATA\chocolatey\bin\" + } shell: pwsh - name: Set pipeline variables based on source run: azure-pipelines/variables/_pipelines.ps1 @@ -43,7 +47,7 @@ jobs: - name: pack run: dotnet pack src --no-build -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/pack.binlog" - name: test - run: dotnet test src --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true + run: dotnet test src --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --logger trx --settings "${{ github.workspace }}/.github/workflows/${{ runner.os }}.runsettings" - name: Update pipeline variables based on build outputs run: azure-pipelines/variables/_pipelines.ps1 shell: pwsh @@ -72,6 +76,13 @@ jobs: name: build_logs-${{ runner.os }} path: obj/_artifacts/build_logs continue-on-error: true + - name: Upload testResults + if: always() + uses: actions/upload-artifact@v1 + with: + name: testResults-${{ runner.os }} + path: obj/_artifacts/testResults + continue-on-error: true - name: Upload coverageResults if: always() uses: actions/upload-artifact@v1 diff --git a/.github/workflows/macOS.runsettings b/.github/workflows/macOS.runsettings new file mode 100644 index 00000000..b444e819 --- /dev/null +++ b/.github/workflows/macOS.runsettings @@ -0,0 +1 @@ + From 8a3f6cd5d471bc588b5eb1cf54446a297e4cd3f5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 27 Mar 2020 14:58:41 -0600 Subject: [PATCH 119/889] Collect deployables on GitHub Actions even for failing jobs --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3e10f53..b50c5605 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: - ubuntu-18.04 @@ -91,7 +92,7 @@ jobs: with: name: deployables path: obj/_artifacts/deployables - if: runner.os == 'Windows' + if: always() && runner.os == 'Windows' - name: Publish code coverage results to codecov.io run: bash <(curl -s https://codecov.io/bash) shell: bash From c5581d16fedaaaf95549f1f8105a8f6a7171534d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 27 Mar 2020 15:39:20 -0600 Subject: [PATCH 120/889] Fix dmp collection on Azure Pipelines --- azure-pipelines/artifacts/testResults.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/artifacts/testResults.ps1 b/azure-pipelines/artifacts/testResults.ps1 index 1c9d3572..bc9e0467 100644 --- a/azure-pipelines/artifacts/testResults.ps1 +++ b/azure-pipelines/artifacts/testResults.ps1 @@ -2,7 +2,7 @@ if ($env:AGENT_TEMPDIRECTORY) { # The DotNetCoreCLI uses an alternate location to publish these files $guidRegex = '^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$' @{ - $env:AGENT_TEMPDIRECTORY = (Get-ChildItem $env:AGENT_TEMPDIRECTORY -Directory |? { $_.Name -match $guidRegex } |% { Get-ChildItem "$($_.FullName)\testhost.*.dmp","$($_.FullName)\Sequence_*.xml" -Recurse }); + $env:AGENT_TEMPDIRECTORY = (Get-ChildItem $env:AGENT_TEMPDIRECTORY -Directory |? { $_.Name -match $guidRegex } |% { Get-ChildItem "$($_.FullName)\testhost*.dmp","$($_.FullName)\Sequence_*.xml" -Recurse }); } } else { $srcRoot = Resolve-Path "$PSScriptRoot\..\..\src" From ce7cd13abbdfd6b7cd0fe95c196bc82e36e7bddb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 28 Mar 2020 13:03:09 -0600 Subject: [PATCH 121/889] Recommend C# extension in VS Code by its new name --- .vscode/extensions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index c5b615df..ecda668e 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,7 +4,7 @@ // List of extensions which should be recommended for users of this workspace. "recommendations": [ "ms-azure-devops.azure-pipelines", - "ms-vscode.csharp", + "ms-dotnettools.csharp", "k--kato.docomment", "editorconfig.editorconfig", "pflannery.vscode-versionlens", From 426a7bd79f81f9c5dabf5e7f48fc24251e0e5577 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 28 Mar 2020 16:15:06 -0600 Subject: [PATCH 122/889] Update package references --- src/Directory.Build.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 5e0395b5..bdfdc2b2 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -27,9 +27,9 @@ - - - + + + From f0b174a54640be9482a14dea28cd19c9b1cd481b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 29 Mar 2020 07:35:13 -0600 Subject: [PATCH 123/889] Update NB.GV This gets Omnisharp on Linux to work. --- src/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index bdfdc2b2..ce9c3194 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -27,7 +27,7 @@ - + From ae335995e9c2dd914b642a64084e4be0090901e6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 29 Mar 2020 19:35:18 -0600 Subject: [PATCH 124/889] Make ps1 scripts directly executable from linux --- azure-pipelines/artifacts/_all.ps1 | 2 ++ azure-pipelines/variables/_all.ps1 | 2 ++ init.ps1 | 2 ++ tools/Install-DotNetSdk.ps1 | 2 ++ tools/Install-NuGetCredProvider.ps1 | 2 ++ 5 files changed, 10 insertions(+) mode change 100644 => 100755 azure-pipelines/artifacts/_all.ps1 mode change 100644 => 100755 azure-pipelines/variables/_all.ps1 mode change 100644 => 100755 init.ps1 mode change 100644 => 100755 tools/Install-DotNetSdk.ps1 mode change 100644 => 100755 tools/Install-NuGetCredProvider.ps1 diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1 old mode 100644 new mode 100755 index 171b55b8..4b544236 --- a/azure-pipelines/artifacts/_all.ps1 +++ b/azure-pipelines/artifacts/_all.ps1 @@ -1,3 +1,5 @@ +#!/usr/bin/pwsh + # This script returns all the artifacts that should be collected after a build. # # Each powershell artifact is expressed as an object with these properties: diff --git a/azure-pipelines/variables/_all.ps1 b/azure-pipelines/variables/_all.ps1 old mode 100644 new mode 100755 index ed099792..269425b5 --- a/azure-pipelines/variables/_all.ps1 +++ b/azure-pipelines/variables/_all.ps1 @@ -1,3 +1,5 @@ +#!/usr/bin/pwsh + # This script returns a hashtable of build variables that should be set # at the start of a build or release definition's execution. diff --git a/init.ps1 b/init.ps1 old mode 100644 new mode 100755 index ae4ce9a6..ac980028 --- a/init.ps1 +++ b/init.ps1 @@ -1,3 +1,5 @@ +#!/usr/bin/pwsh + <# .SYNOPSIS Installs dependencies required to build and test the projects in this repository. diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 old mode 100644 new mode 100755 index 0bd4082f..a830dd40 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -1,3 +1,5 @@ +#!/usr/bin/pwsh + <# .SYNOPSIS Installs the .NET SDK specified in the global.json file at the root of this repository, diff --git a/tools/Install-NuGetCredProvider.ps1 b/tools/Install-NuGetCredProvider.ps1 old mode 100644 new mode 100755 index 0a8d77f6..9e0e2fce --- a/tools/Install-NuGetCredProvider.ps1 +++ b/tools/Install-NuGetCredProvider.ps1 @@ -1,3 +1,5 @@ +#!/usr/bin/pwsh + <# .SYNOPSIS Downloads and installs the Microsoft Artifacts Credential Provider From c2c2ec18581074f1ab53333bc97e0b2d9e9e9d51 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 29 Mar 2020 20:26:44 -0600 Subject: [PATCH 125/889] Use more portable #! for ps1 --- azure-pipelines/artifacts/_all.ps1 | 2 +- azure-pipelines/variables/_all.ps1 | 2 +- init.ps1 | 2 +- tools/Install-DotNetSdk.ps1 | 2 +- tools/Install-NuGetCredProvider.ps1 | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1 index 4b544236..efd6bdb3 100755 --- a/azure-pipelines/artifacts/_all.ps1 +++ b/azure-pipelines/artifacts/_all.ps1 @@ -1,4 +1,4 @@ -#!/usr/bin/pwsh +#!/usr/bin/env pwsh # This script returns all the artifacts that should be collected after a build. # diff --git a/azure-pipelines/variables/_all.ps1 b/azure-pipelines/variables/_all.ps1 index 269425b5..0407d307 100755 --- a/azure-pipelines/variables/_all.ps1 +++ b/azure-pipelines/variables/_all.ps1 @@ -1,4 +1,4 @@ -#!/usr/bin/pwsh +#!/usr/bin/env pwsh # This script returns a hashtable of build variables that should be set # at the start of a build or release definition's execution. diff --git a/init.ps1 b/init.ps1 index ac980028..6701e725 100755 --- a/init.ps1 +++ b/init.ps1 @@ -1,4 +1,4 @@ -#!/usr/bin/pwsh +#!/usr/bin/env pwsh <# .SYNOPSIS diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index a830dd40..2a444134 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -1,4 +1,4 @@ -#!/usr/bin/pwsh +#!/usr/bin/env pwsh <# .SYNOPSIS diff --git a/tools/Install-NuGetCredProvider.ps1 b/tools/Install-NuGetCredProvider.ps1 index 9e0e2fce..496dcd96 100755 --- a/tools/Install-NuGetCredProvider.ps1 +++ b/tools/Install-NuGetCredProvider.ps1 @@ -1,4 +1,4 @@ -#!/usr/bin/pwsh +#!/usr/bin/env pwsh <# .SYNOPSIS From cbb60159af1bd4bbe336ba677e277152bd8b050b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 30 Mar 2020 10:16:19 -0600 Subject: [PATCH 126/889] Add machine-wide .NET install support off Windows --- tools/Install-DotNetSdk.ps1 | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 2a444134..101b68fe 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -83,25 +83,6 @@ Function Install-DotNet($Version, [switch]$Runtime) { } } -if ($InstallLocality -eq 'machine') { - if ($IsMacOS -or $IsLinux) { - Write-Error "Installing the .NET Core SDK or runtime at a machine-wide location is only supported by this script on Windows." - exit 1 - } - - if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { - Install-DotNet -Version $sdkVersion - } - - $runtimeVersions | Get-Unique |% { - if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { - Install-DotNet -Version $_ -Runtime - } - } - - return -} - $switches = @( '-Architecture','x64' ) @@ -110,7 +91,23 @@ $envVars = @{ 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' = 'true'; } -if ($InstallLocality -eq 'repo') { +if ($InstallLocality -eq 'machine') { + if ($IsWindows) { + if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { + Install-DotNet -Version $sdkVersion + } + + $runtimeVersions | Get-Unique |% { + if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { + Install-DotNet -Version $_ -Runtime + } + } + + return + } else { + $DotNetInstallDir = '/usr/share/dotnet' + } +} elseif ($InstallLocality -eq 'repo') { $DotNetInstallDir = "$DotNetInstallScriptRoot/.dotnet" } elseif ($env:AGENT_TOOLSDIRECTORY) { $DotNetInstallDir = "$env:AGENT_TOOLSDIRECTORY/dotnet" From ef30ea448e502db518bbe3d245dd6b185e084ad0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 7 Apr 2020 17:22:02 -0600 Subject: [PATCH 127/889] Use PowerShell Core in Azure Pipelines --- azure-pipelines/build.yml | 2 +- azure-pipelines/dotnet.yml | 12 ++++-------- azure-pipelines/expand-template.yml | 2 +- azure-pipelines/install-dependencies.yml | 10 ++++------ azure-pipelines/publish-codecoverage.yml | 2 +- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 186438a1..218e1c3d 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -9,7 +9,7 @@ jobs: clean: true - template: install-dependencies.yml - - powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud' + - pwsh: '& (./azure-pipelines/Get-nbgv.ps1) cloud' displayName: Set build number - template: dotnet.yml diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 0d837acb..0b6e3cc5 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -33,17 +33,13 @@ steps: testRunTitle: netcoreapp3.1-$(Agent.JobName) workingDirectory: src -- task: PowerShell@2 - inputs: - filePath: azure-pipelines/variables/_pipelines.ps1 - failOnStderr: true +- pwsh: azure-pipelines/variables/_pipelines.ps1 + failOnStderr: true displayName: Update pipeline variables based on build outputs condition: succeededOrFailed() -- task: PowerShell@2 - inputs: - filePath: azure-pipelines/artifacts/_pipelines.ps1 - arguments: -ArtifactNameSuffix "-$(Agent.JobName)" +- pwsh: azure-pipelines/artifacts/_pipelines.ps1 -ArtifactNameSuffix "-$(Agent.JobName)" + failOnStderr: true displayName: Publish artifacts condition: succeededOrFailed() diff --git a/azure-pipelines/expand-template.yml b/azure-pipelines/expand-template.yml index 2d9ea7b3..a66a1157 100644 --- a/azure-pipelines/expand-template.yml +++ b/azure-pipelines/expand-template.yml @@ -3,7 +3,7 @@ steps: dotnet build-server shutdown git clean -fdx displayName: Cleaning repo for template expansion -- powershell: | +- pwsh: | git config user.name "test user" git config user.email "andrewarnott@gmail.com" ./Expand-Template.ps1 -LibraryName Calc -Author "Andrew Arnott" diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index a778022a..af97093b 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -3,20 +3,18 @@ parameters: steps: -- powershell: | +- pwsh: | .\init.ps1 -AccessToken '$(System.AccessToken)' ${{ parameters['initArgs'] }} -UpgradePrerequisites dotnet --info displayName: Install prerequisites # The procdump tool and env var is required for dotnet test to collect hang/crash dumps of tests. -- powershell: | +- pwsh: | choco install procdump Write-Host "##vso[task.setvariable variable=PROCDUMP_PATH;]$env:ProgramData\chocolatey\bin\" displayName: Install procdump condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) -- task: PowerShell@2 - inputs: - filePath: azure-pipelines/variables/_pipelines.ps1 - failOnStderr: true +- pwsh: azure-pipelines/variables/_pipelines.ps1 + failOnStderr: true displayName: Set pipeline variables based on source diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index 976f0781..080a0f60 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -11,7 +11,7 @@ steps: artifact: coverageResults-macOS displayName: Download macOS code coverage results continueOnError: true -- powershell: | +- pwsh: | dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.2.2 --configfile azure-pipelines/justnugetorg.nuget.config Copy-Item -Recurse $(Pipeline.Workspace)/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj Write-Host "Substituting {reporoot} with $(System.DefaultWorkingDirectory)" From cae9277ee0851c093aac955ca82e6cb94bfe7408 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 7 Apr 2020 18:56:36 -0600 Subject: [PATCH 128/889] Revert "Use PowerShell Core in Azure Pipelines" This reverts commit ef30ea448e502db518bbe3d245dd6b185e084ad0. --- azure-pipelines/build.yml | 2 +- azure-pipelines/dotnet.yml | 12 ++++++++---- azure-pipelines/expand-template.yml | 2 +- azure-pipelines/install-dependencies.yml | 10 ++++++---- azure-pipelines/publish-codecoverage.yml | 2 +- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 218e1c3d..186438a1 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -9,7 +9,7 @@ jobs: clean: true - template: install-dependencies.yml - - pwsh: '& (./azure-pipelines/Get-nbgv.ps1) cloud' + - powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud' displayName: Set build number - template: dotnet.yml diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 0b6e3cc5..0d837acb 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -33,13 +33,17 @@ steps: testRunTitle: netcoreapp3.1-$(Agent.JobName) workingDirectory: src -- pwsh: azure-pipelines/variables/_pipelines.ps1 - failOnStderr: true +- task: PowerShell@2 + inputs: + filePath: azure-pipelines/variables/_pipelines.ps1 + failOnStderr: true displayName: Update pipeline variables based on build outputs condition: succeededOrFailed() -- pwsh: azure-pipelines/artifacts/_pipelines.ps1 -ArtifactNameSuffix "-$(Agent.JobName)" - failOnStderr: true +- task: PowerShell@2 + inputs: + filePath: azure-pipelines/artifacts/_pipelines.ps1 + arguments: -ArtifactNameSuffix "-$(Agent.JobName)" displayName: Publish artifacts condition: succeededOrFailed() diff --git a/azure-pipelines/expand-template.yml b/azure-pipelines/expand-template.yml index a66a1157..2d9ea7b3 100644 --- a/azure-pipelines/expand-template.yml +++ b/azure-pipelines/expand-template.yml @@ -3,7 +3,7 @@ steps: dotnet build-server shutdown git clean -fdx displayName: Cleaning repo for template expansion -- pwsh: | +- powershell: | git config user.name "test user" git config user.email "andrewarnott@gmail.com" ./Expand-Template.ps1 -LibraryName Calc -Author "Andrew Arnott" diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index af97093b..a778022a 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -3,18 +3,20 @@ parameters: steps: -- pwsh: | +- powershell: | .\init.ps1 -AccessToken '$(System.AccessToken)' ${{ parameters['initArgs'] }} -UpgradePrerequisites dotnet --info displayName: Install prerequisites # The procdump tool and env var is required for dotnet test to collect hang/crash dumps of tests. -- pwsh: | +- powershell: | choco install procdump Write-Host "##vso[task.setvariable variable=PROCDUMP_PATH;]$env:ProgramData\chocolatey\bin\" displayName: Install procdump condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) -- pwsh: azure-pipelines/variables/_pipelines.ps1 - failOnStderr: true +- task: PowerShell@2 + inputs: + filePath: azure-pipelines/variables/_pipelines.ps1 + failOnStderr: true displayName: Set pipeline variables based on source diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index 080a0f60..976f0781 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -11,7 +11,7 @@ steps: artifact: coverageResults-macOS displayName: Download macOS code coverage results continueOnError: true -- pwsh: | +- powershell: | dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.2.2 --configfile azure-pipelines/justnugetorg.nuget.config Copy-Item -Recurse $(Pipeline.Workspace)/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj Write-Host "Substituting {reporoot} with $(System.DefaultWorkingDirectory)" From fbca91fdfbdbc4cced5d8a7eb2193710e3eb27e5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 7 Apr 2020 18:57:50 -0600 Subject: [PATCH 129/889] Simplify syntax of Powershell tasks --- azure-pipelines/dotnet.yml | 12 ++++-------- azure-pipelines/install-dependencies.yml | 6 ++---- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 0d837acb..71bd42e1 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -33,17 +33,13 @@ steps: testRunTitle: netcoreapp3.1-$(Agent.JobName) workingDirectory: src -- task: PowerShell@2 - inputs: - filePath: azure-pipelines/variables/_pipelines.ps1 - failOnStderr: true +- powershell: azure-pipelines/variables/_pipelines.ps1 + failOnStderr: true displayName: Update pipeline variables based on build outputs condition: succeededOrFailed() -- task: PowerShell@2 - inputs: - filePath: azure-pipelines/artifacts/_pipelines.ps1 - arguments: -ArtifactNameSuffix "-$(Agent.JobName)" +- powershell: azure-pipelines/artifacts/_pipelines.ps1 -ArtifactNameSuffix "-$(Agent.JobName)" + failOnStderr: true displayName: Publish artifacts condition: succeededOrFailed() diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index a778022a..ec9c3f56 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -15,8 +15,6 @@ steps: displayName: Install procdump condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) -- task: PowerShell@2 - inputs: - filePath: azure-pipelines/variables/_pipelines.ps1 - failOnStderr: true +- powershell: azure-pipelines/variables/_pipelines.ps1 + failOnStderr: true displayName: Set pipeline variables based on source From 8441b31c2d4509873d92a28896d12955e2917f7f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 8 Apr 2020 07:27:52 -0600 Subject: [PATCH 130/889] Specify nuget version to use This shields us against default version changes and service outages such as the one we just experienced. --- azure-pipelines/publish-deployables.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml index a89f389f..a4f8e593 100644 --- a/azure-pipelines/publish-deployables.yml +++ b/azure-pipelines/publish-deployables.yml @@ -3,6 +3,11 @@ steps: displayName: Download deployables artifact: deployables-Windows +- task: NuGetToolInstaller@1 + displayName: Use NuGet 5.x + inputs: + versionSpec: 5.x + - task: NuGetCommand@2 displayName: Push packages to CI feed inputs: From 606547170822ba211cb097dcdf5e8da44f4f90e6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 9 Apr 2020 21:34:11 -0600 Subject: [PATCH 131/889] Move sln file to repo root --- .github/workflows/build.yml | 6 +++--- Expand-Template.ps1 | 29 +++++++++++++---------------- src/Library.sln => Library.sln | 22 +++++++++++----------- azure-pipelines/dotnet.yml | 5 ----- azure-pipelines/expand-template.yml | 1 - init.ps1 | 2 +- 6 files changed, 28 insertions(+), 37 deletions(-) rename src/Library.sln => Library.sln (75%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d8d7655..55575add 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,11 +44,11 @@ jobs: run: azure-pipelines/variables/_pipelines.ps1 shell: pwsh - name: build - run: dotnet build src --no-restore -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/build.binlog" + run: dotnet build --no-restore -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/build.binlog" - name: pack - run: dotnet pack src --no-build -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/pack.binlog" + run: dotnet pack --no-build -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/pack.binlog" - name: test - run: dotnet test src --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --logger trx --settings "${{ github.workspace }}/.github/workflows/${{ runner.os }}.runsettings" + run: dotnet test --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --logger trx --settings "${{ github.workspace }}/.github/workflows/${{ runner.os }}.runsettings" - name: Update pipeline variables based on build outputs run: azure-pipelines/variables/_pipelines.ps1 shell: pwsh diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index aa4f5ec2..6a030fc1 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -80,30 +80,27 @@ try { } # Rename project directories and solution - Set-Location src git mv Library.sln "$LibraryName.sln" - git mv Library/Library.csproj "Library/$LibraryName.csproj" - git mv Library "$LibraryName" - git mv Library.Tests/Library.Tests.csproj "Library.Tests/$LibraryName.Tests.csproj" - git mv Library.Tests "$LibraryName.Tests" + git mv src/Library/Library.csproj "src/Library/$LibraryName.csproj" + git mv src/Library "src/$LibraryName" + git mv src/Library.Tests/Library.Tests.csproj "src/Library.Tests/$LibraryName.Tests.csproj" + git mv src/Library.Tests "src/$LibraryName.Tests" # Refresh solution file both to update paths and give the projects unique GUIDs - dotnet sln remove Library/Library.csproj - dotnet sln remove Library.Tests/Library.Tests.csproj - dotnet sln add "$LibraryName" - dotnet sln add "$LibraryName.Tests" + dotnet sln remove src/Library/Library.csproj + dotnet sln remove src/Library.Tests/Library.Tests.csproj + dotnet sln add "src/$LibraryName" + dotnet sln add "src/$LibraryName.Tests" git add "$LibraryName.sln" # Update project reference in test project. Add before removal to keep the same ItemGroup in place. - dotnet add "$LibraryName.Tests" reference "$LibraryName" - dotnet remove "$LibraryName.Tests" reference Library/Library.csproj - git add "$LibraryName.Tests/$LibraryName.Tests.csproj" + dotnet add "src/$LibraryName.Tests" reference "src/$LibraryName" + dotnet remove "src/$LibraryName.Tests" reference src/Library/Library.csproj + git add "src/$LibraryName.Tests/$LibraryName.Tests.csproj" # Establish a new strong-name key - & $sn.Path -k 2048 strongname.snk - git add strongname.snk - - Set-Location .. + & $sn.Path -k 2048 src/strongname.snk + git add src/strongname.snk # Replace placeholders in source files Replace-Placeholders -Path "src/$LibraryName/Calculator.cs" -Replacements @{ diff --git a/src/Library.sln b/Library.sln similarity index 75% rename from src/Library.sln rename to Library.sln index 09dfb1fe..d034f5b2 100644 --- a/src/Library.sln +++ b/Library.sln @@ -3,21 +3,21 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29322.22 MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library", "Library\Library.csproj", "{C06D702E-6FC7-453B-BDDF-608F825EC003}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library", "src\Library\Library.csproj", "{C06D702E-6FC7-453B-BDDF-608F825EC003}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library.Tests", "Library.Tests\Library.Tests.csproj", "{DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library.Tests", "src\Library.Tests\Library.Tests.csproj", "{DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1CE9670B-D5FF-46A7-9D00-24E70E6ED48B}" ProjectSection(SolutionItems) = preProject - ..\.editorconfig = ..\.editorconfig - Directory.Build.props = Directory.Build.props - Directory.Build.targets = Directory.Build.targets - ..\global.json = ..\global.json - ..\nuget.config = ..\nuget.config - shipping.ruleset = shipping.ruleset - stylecop.json = stylecop.json - tests.ruleset = tests.ruleset - ..\version.json = ..\version.json + .editorconfig = .editorconfig + src\Directory.Build.props = src\Directory.Build.props + src\Directory.Build.targets = src\Directory.Build.targets + global.json = global.json + nuget.config = nuget.config + src\shipping.ruleset = src\shipping.ruleset + src\stylecop.json = src\stylecop.json + src\tests.ruleset = src\tests.ruleset + version.json = version.json EndProjectSection EndProject Global diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 71bd42e1..6764e6ec 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -2,11 +2,9 @@ steps: - script: dotnet build --no-restore -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" displayName: dotnet build - workingDirectory: src - script: dotnet pack --no-build -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/pack.binlog" displayName: dotnet pack - workingDirectory: src - task: DotNetCoreCLI@2 displayName: dotnet test -f net472 @@ -14,7 +12,6 @@ steps: command: test arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" testRunTitle: net472-$(Agent.JobName) - workingDirectory: src condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - task: DotNetCoreCLI@2 @@ -23,7 +20,6 @@ steps: command: test arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" testRunTitle: netcoreapp2.1-$(Agent.JobName) - workingDirectory: src - task: DotNetCoreCLI@2 displayName: dotnet test -f netcoreapp3.1 @@ -31,7 +27,6 @@ steps: command: test arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" testRunTitle: netcoreapp3.1-$(Agent.JobName) - workingDirectory: src - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true diff --git a/azure-pipelines/expand-template.yml b/azure-pipelines/expand-template.yml index 2d9ea7b3..ed510de3 100644 --- a/azure-pipelines/expand-template.yml +++ b/azure-pipelines/expand-template.yml @@ -11,5 +11,4 @@ steps: failOnStderr: true # TODO: Verify that all changes are staged to the git index - script: dotnet build - workingDirectory: src displayName: dotnet build (expanded template) diff --git a/init.ps1 b/init.ps1 index 6701e725..a0c9961f 100755 --- a/init.ps1 +++ b/init.ps1 @@ -54,7 +54,7 @@ try { if (!$NoRestore -and $PSCmdlet.ShouldProcess("NuGet packages", "Restore")) { Write-Host "Restoring NuGet packages" -ForegroundColor $HeaderColor - dotnet restore src + dotnet restore if ($lastexitcode -ne 0) { throw "Failure while restoring packages." } From 234e1da8eb8a1b077214b6e4d8dfc64edcab21b1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 9 Apr 2020 23:06:03 -0600 Subject: [PATCH 132/889] Fix Install-DotNetSdk script under -WhatIf --- tools/Install-DotNetSdk.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 101b68fe..8d77a9fe 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -23,7 +23,7 @@ Param ( ) $DotNetInstallScriptRoot = "$PSScriptRoot/../obj/tools" -if (!(Test-Path $DotNetInstallScriptRoot)) { New-Item -ItemType Directory -Path $DotNetInstallScriptRoot | Out-Null } +if (!(Test-Path $DotNetInstallScriptRoot)) { New-Item -ItemType Directory -Path $DotNetInstallScriptRoot -WhatIf:$false | Out-Null } $DotNetInstallScriptRoot = Resolve-Path $DotNetInstallScriptRoot # Look up actual required .NET Core SDK version from global.json From e9107462f142ba4c25289ef1d609378e0c2bb270 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 9 Apr 2020 23:23:30 -0600 Subject: [PATCH 133/889] Avoid building on Azure Pipelines for .github folder changes --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c6eeb7b6..fc1b06e3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,6 +8,7 @@ trigger: - doc/ - '*.md' - .vscode/ + - .github/ variables: TreatWarningsAsErrors: true From 18676a3d915d6be387f2b76e19a492c623b9930c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 9 Apr 2020 23:14:23 -0600 Subject: [PATCH 134/889] Lose guid in favor of feed name Closes #28 --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fc1b06e3..22f8b553 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,7 +15,7 @@ variables: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ - ci_feed: /a5a3bad0-e566-4c53-be83-6458be8d1653 # find guid used by Azure DevOps Artifacts for the feed. Learn more at https://github.com/AArnott/Library.Template/issues/28 + ci_feed: CI # Azure Artifacts feed name NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages jobs: From 9c3b3fe1534bf2b05aa1b7163699590d5027b06b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 9 Apr 2020 23:30:24 -0600 Subject: [PATCH 135/889] Fix build of WPF projects Fixes #22 --- src/Directory.Build.targets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 1ddcba6f..8f529fae 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,4 +1,8 @@ + + + false + cobertura [xunit.*]* From 3c0c7dae0fe407097af6455adbfb4d6e8b8ba600 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 9 Apr 2020 22:36:49 -0600 Subject: [PATCH 136/889] Use top-level test folder --- .editorconfig | 8 ++ Directory.Build.props | 43 ++++++++++ Directory.Build.targets | 8 ++ Expand-Template.ps1 | 22 +++--- Library.sln | 28 +++++-- azure-pipelines/artifacts/testResults.ps1 | 4 +- src/.editorconfig | 0 src/Directory.Build.props | 44 +---------- src/Directory.Build.targets | 8 +- src/Library.Tests/Library.Tests.csproj | 23 ------ src/Library/Library.csproj | 5 -- src/shipping.ruleset | 74 ------------------ src/tests.ruleset | 18 ----- src/strongname.snk => strongname.snk | Bin src/stylecop.json => stylecop.json | 0 test/.editorconfig | 28 +++++++ test/Directory.Build.props | 11 +++ test/Directory.Build.targets | 3 + .../Library.Tests/CalculatorTests.cs | 0 test/Library.Tests/Library.Tests.csproj | 14 ++++ {src => test}/Library.Tests/app.config | 0 tools/Install-DotNetSdk.ps1 | 2 +- 22 files changed, 157 insertions(+), 186 deletions(-) create mode 100644 Directory.Build.props create mode 100644 Directory.Build.targets create mode 100644 src/.editorconfig delete mode 100644 src/Library.Tests/Library.Tests.csproj delete mode 100644 src/shipping.ruleset delete mode 100644 src/tests.ruleset rename src/strongname.snk => strongname.snk (100%) rename src/stylecop.json => stylecop.json (100%) create mode 100644 test/.editorconfig create mode 100644 test/Directory.Build.props create mode 100644 test/Directory.Build.targets rename {src => test}/Library.Tests/CalculatorTests.cs (100%) create mode 100644 test/Library.Tests/Library.Tests.csproj rename {src => test}/Library.Tests/app.config (100%) diff --git a/.editorconfig b/.editorconfig index 3a833bdb..979d170a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -155,3 +155,11 @@ csharp_new_line_before_members_in_anonymous_types = true # Blocks are allowed csharp_prefer_braces = true:silent + +[*.cs] + +# SA1130: Use lambda syntax +dotnet_diagnostic.SA1130.severity = silent + +[*.sln] +indent_style = tab diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..7a97368f --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,43 @@ + + + Debug + $(MSBuildThisFileDirectory) + $(RepoRootPath)obj\$(MSBuildProjectName)\ + $(RepoRootPath)bin\$(MSBuildProjectName)\ + $(RepoRootPath)bin\Packages\$(Configuration)\ + 8.0 + enable + true + + true + $(MSBuildThisFileDirectory)\strongname.snk + + COMPANY-PLACEHOLDER + COMPANY-PLACEHOLDER + © COMPANY-PLACEHOLDER. All rights reserved. + MIT + true + true + true + snupkg + + + + + + + + + + + + + + + + + + + + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 00000000..1ddcba6f --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,8 @@ + + + cobertura + [xunit.*]* + + $(OutputPath)/ + + diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 6a030fc1..9a05ecec 100644 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -83,20 +83,20 @@ try { git mv Library.sln "$LibraryName.sln" git mv src/Library/Library.csproj "src/Library/$LibraryName.csproj" git mv src/Library "src/$LibraryName" - git mv src/Library.Tests/Library.Tests.csproj "src/Library.Tests/$LibraryName.Tests.csproj" - git mv src/Library.Tests "src/$LibraryName.Tests" + git mv test/Library.Tests/Library.Tests.csproj "test/Library.Tests/$LibraryName.Tests.csproj" + git mv test/Library.Tests "test/$LibraryName.Tests" # Refresh solution file both to update paths and give the projects unique GUIDs dotnet sln remove src/Library/Library.csproj - dotnet sln remove src/Library.Tests/Library.Tests.csproj + dotnet sln remove test/Library.Tests/Library.Tests.csproj dotnet sln add "src/$LibraryName" - dotnet sln add "src/$LibraryName.Tests" + dotnet sln add "test/$LibraryName.Tests" git add "$LibraryName.sln" # Update project reference in test project. Add before removal to keep the same ItemGroup in place. - dotnet add "src/$LibraryName.Tests" reference "src/$LibraryName" - dotnet remove "src/$LibraryName.Tests" reference src/Library/Library.csproj - git add "src/$LibraryName.Tests/$LibraryName.Tests.csproj" + dotnet add "test/$LibraryName.Tests" reference "src/$LibraryName" + dotnet remove "test/$LibraryName.Tests" reference src/Library/Library.csproj + git add "test/$LibraryName.Tests/$LibraryName.Tests.csproj" # Establish a new strong-name key & $sn.Path -k 2048 src/strongname.snk @@ -107,17 +107,17 @@ try { 'Library'=$LibraryName 'COMPANY-PLACEHOLDER'=$Author } - Replace-Placeholders -Path "src/$LibraryName.Tests/CalculatorTests.cs" -Replacements @{ + Replace-Placeholders -Path "test/$LibraryName.Tests/CalculatorTests.cs" -Replacements @{ 'Library'=$LibraryName 'COMPANY-PLACEHOLDER'=$Author } Replace-Placeholders -Path "LICENSE" -Replacements @{ 'COMPANY-PLACEHOLDER'=$Author } - Replace-Placeholders -Path "src/stylecop.json" -Replacements @{ + Replace-Placeholders -Path "stylecop.json" -Replacements @{ 'COMPANY-PLACEHOLDER'=$Author } - Replace-Placeholders -Path "src/Directory.Build.props" -Replacements @{ + Replace-Placeholders -Path "Directory.Build.props" -Replacements @{ 'COMPANY-PLACEHOLDER'=$Author } Replace-Placeholders -Path "README.md" -Replacements @{ @@ -174,4 +174,4 @@ try { } # When testing this script, all the changes can be quickly reverted with this command: -# git reset HEAD :/README.md :/LICENSE :/azure-pipelines.yml :/src :/azure-pipelines; git co -- :/README.md :/LICENSE :/azure-pipelines.yml :/src :/azure-pipelines; git clean -fd :/src +# git reset HEAD :/README.md :/LICENSE :/azure-pipelines.yml :/src :/test :/azure-pipelines; git co -- :/README.md :/LICENSE :/azure-pipelines.yml :/src :/azure-pipelines; git clean -fd :/src :/test diff --git a/Library.sln b/Library.sln index d034f5b2..85b8939d 100644 --- a/Library.sln +++ b/Library.sln @@ -5,21 +5,33 @@ VisualStudioVersion = 16.0.29322.22 MinimumVisualStudioVersion = 15.0.26124.0 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library", "src\Library\Library.csproj", "{C06D702E-6FC7-453B-BDDF-608F825EC003}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library.Tests", "src\Library.Tests\Library.Tests.csproj", "{DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library.Tests", "test\Library.Tests\Library.Tests.csproj", "{DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1CE9670B-D5FF-46A7-9D00-24E70E6ED48B}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig - src\Directory.Build.props = src\Directory.Build.props - src\Directory.Build.targets = src\Directory.Build.targets + Directory.Build.props = Directory.Build.props + Directory.Build.targets = Directory.Build.targets global.json = global.json nuget.config = nuget.config - src\shipping.ruleset = src\shipping.ruleset - src\stylecop.json = src\stylecop.json - src\tests.ruleset = src\tests.ruleset + stylecop.json = stylecop.json version.json = version.json EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9E154A29-1796-4B85-BD81-B6A385D8FF71}" + ProjectSection(SolutionItems) = preProject + src\.editorconfig = src\.editorconfig + src\Directory.Build.props = src\Directory.Build.props + src\Directory.Build.targets = src\Directory.Build.targets + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{36CCE840-6FE5-4DB9-A8D5-8CF3CB6D342A}" + ProjectSection(SolutionItems) = preProject + test\.editorconfig = test\.editorconfig + test\Directory.Build.props = test\Directory.Build.props + test\Directory.Build.targets = test\Directory.Build.targets + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -38,6 +50,10 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {9E154A29-1796-4B85-BD81-B6A385D8FF71} = {1CE9670B-D5FF-46A7-9D00-24E70E6ED48B} + {36CCE840-6FE5-4DB9-A8D5-8CF3CB6D342A} = {1CE9670B-D5FF-46A7-9D00-24E70E6ED48B} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E3944F6A-384B-4B0F-B93F-3BD513DC57BD} EndGlobalSection diff --git a/azure-pipelines/artifacts/testResults.ps1 b/azure-pipelines/artifacts/testResults.ps1 index bc9e0467..1e4c4c4e 100644 --- a/azure-pipelines/artifacts/testResults.ps1 +++ b/azure-pipelines/artifacts/testResults.ps1 @@ -5,8 +5,8 @@ if ($env:AGENT_TEMPDIRECTORY) { $env:AGENT_TEMPDIRECTORY = (Get-ChildItem $env:AGENT_TEMPDIRECTORY -Directory |? { $_.Name -match $guidRegex } |% { Get-ChildItem "$($_.FullName)\testhost*.dmp","$($_.FullName)\Sequence_*.xml" -Recurse }); } } else { - $srcRoot = Resolve-Path "$PSScriptRoot\..\..\src" + $testRoot = Resolve-Path "$PSScriptRoot\..\..\test" @{ - $srcRoot = (Get-ChildItem "$srcRoot\TestResults" -Recurse -Directory | Get-ChildItem -Recurse -File); + $testRoot = (Get-ChildItem "$testRoot\TestResults" -Recurse -Directory | Get-ChildItem -Recurse -File); } } diff --git a/src/.editorconfig b/src/.editorconfig new file mode 100644 index 00000000..e69de29b diff --git a/src/Directory.Build.props b/src/Directory.Build.props index ce9c3194..50b6409e 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,43 +1,7 @@ - - - Debug - $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\')) - $(RepoRootPath)obj\$(MSBuildProjectName)\ - $(RepoRootPath)bin\$(MSBuildProjectName)\ - $(RepoRootPath)bin\Packages\$(Configuration)\ - 8.0 - enable - true - - true - $(MSBuildThisFileDirectory)\strongname.snk + + - COMPANY-PLACEHOLDER - COMPANY-PLACEHOLDER - © COMPANY-PLACEHOLDER. All rights reserved. - MIT - true - true - true - snupkg + + netstandard2.0 - - - - - - - - - - - - - - - - - - diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 8f529fae..ada76655 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -3,10 +3,6 @@ false - - cobertura - [xunit.*]* - - $(OutputPath)/ - + + diff --git a/src/Library.Tests/Library.Tests.csproj b/src/Library.Tests/Library.Tests.csproj deleted file mode 100644 index 8018f97d..00000000 --- a/src/Library.Tests/Library.Tests.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net472;netcoreapp2.1;netcoreapp3.1 - false - $(NoWarn);CS1591 - true - ..\tests.ruleset - - - - - - - - - - - - - - - diff --git a/src/Library/Library.csproj b/src/Library/Library.csproj index ae6eca97..61718a1f 100644 --- a/src/Library/Library.csproj +++ b/src/Library/Library.csproj @@ -1,8 +1,3 @@ - - netstandard2.0 - ..\shipping.ruleset - - diff --git a/src/shipping.ruleset b/src/shipping.ruleset deleted file mode 100644 index 72903546..00000000 --- a/src/shipping.ruleset +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/tests.ruleset b/src/tests.ruleset deleted file mode 100644 index a1365976..00000000 --- a/src/tests.ruleset +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/strongname.snk b/strongname.snk similarity index 100% rename from src/strongname.snk rename to strongname.snk diff --git a/src/stylecop.json b/stylecop.json similarity index 100% rename from src/stylecop.json rename to stylecop.json diff --git a/test/.editorconfig b/test/.editorconfig new file mode 100644 index 00000000..eac6d8ae --- /dev/null +++ b/test/.editorconfig @@ -0,0 +1,28 @@ +[*.cs] + +# SA1600: Elements should be documented +dotnet_diagnostic.SA1600.severity = silent + +# SA1601: Partial elements should be documented +dotnet_diagnostic.SA1601.severity = silent + +# SA1602: Enumeration items should be documented +dotnet_diagnostic.SA1602.severity = silent + +# SA1615: Element return value should be documented +dotnet_diagnostic.SA1615.severity = silent + +# VSTHRD103: Call async methods when in an async method +dotnet_diagnostic.VSTHRD103.severity = silent + +# VSTHRD111: Use .ConfigureAwait(bool) +dotnet_diagnostic.VSTHRD111.severity = none + +# VSTHRD200: Use Async suffix for async methods +dotnet_diagnostic.VSTHRD200.severity = silent + +# CA1303: Do not pass literals as localized parameters +dotnet_diagnostic.CA1303.severity = none + +# CS1591: Missing XML comment for publicly visible type or member +dotnet_diagnostic.CS1591.severity = silent diff --git a/test/Directory.Build.props b/test/Directory.Build.props new file mode 100644 index 00000000..66b41d56 --- /dev/null +++ b/test/Directory.Build.props @@ -0,0 +1,11 @@ + + + + + net472;netcoreapp2.1;netcoreapp3.1 + false + true + + + + diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets new file mode 100644 index 00000000..6a5a72c2 --- /dev/null +++ b/test/Directory.Build.targets @@ -0,0 +1,3 @@ + + + diff --git a/src/Library.Tests/CalculatorTests.cs b/test/Library.Tests/CalculatorTests.cs similarity index 100% rename from src/Library.Tests/CalculatorTests.cs rename to test/Library.Tests/CalculatorTests.cs diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj new file mode 100644 index 00000000..6113925a --- /dev/null +++ b/test/Library.Tests/Library.Tests.csproj @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/Library.Tests/app.config b/test/Library.Tests/app.config similarity index 100% rename from src/Library.Tests/app.config rename to test/Library.Tests/app.config diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 8d77a9fe..7f9bf6cd 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -31,7 +31,7 @@ $sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1 # Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them. $runtimeVersions = @() -Get-ChildItem "$PSScriptRoot\..\src\*.*proj" -Recurse |% { +Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$PSScriptRoot\..\Directory.Build.props" -Recurse |% { $projXml = [xml](Get-Content -Path $_) $targetFrameworks = $projXml.Project.PropertyGroup.TargetFramework if (!$targetFrameworks) { From acda37b47951338b6c06a579a49e6215ce5bc586 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 10 Apr 2020 09:14:13 -0600 Subject: [PATCH 137/889] Add -y switch to choco install Fixes #47 --- .github/workflows/build.yml | 2 +- azure-pipelines/install-dependencies.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55575add..4ea0df36 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: ./init.ps1 -UpgradePrerequisites dotnet --info if ($env:RUNNER_OS -eq "Windows") { - choco install procdump + choco install procdump -y Write-Host "##[set-env name=PROCDUMP_PATH;]$env:PROGRAMDATA\chocolatey\bin\" } shell: pwsh diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index ec9c3f56..d4804866 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -10,7 +10,7 @@ steps: # The procdump tool and env var is required for dotnet test to collect hang/crash dumps of tests. - powershell: | - choco install procdump + choco install procdump -y Write-Host "##vso[task.setvariable variable=PROCDUMP_PATH;]$env:ProgramData\chocolatey\bin\" displayName: Install procdump condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) From fd029d44e16358417a3e30cacc159f2efb9f5da0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 14 Apr 2020 07:50:02 -0600 Subject: [PATCH 138/889] Stop passing $(System.AccessToken) as an arg in AzP Fixes #49 --- azure-pipelines/install-dependencies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index d4804866..96917c4f 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -4,7 +4,7 @@ parameters: steps: - powershell: | - .\init.ps1 -AccessToken '$(System.AccessToken)' ${{ parameters['initArgs'] }} -UpgradePrerequisites + .\init.ps1 ${{ parameters['initArgs'] }} -UpgradePrerequisites dotnet --info displayName: Install prerequisites From f45370dbf3dc173e09d8738e462a81431bd7c70b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 14 Apr 2020 09:42:24 -0600 Subject: [PATCH 139/889] Fix Set-EnvVars to print vars to console When run in the context of init.ps1, they were just swallowed up. Also we should only return a boolean. Outputing more than that will cause callers to malfunction. --- azure-pipelines/Set-EnvVars.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/Set-EnvVars.ps1 b/azure-pipelines/Set-EnvVars.ps1 index 907659a7..9d14d9aa 100644 --- a/azure-pipelines/Set-EnvVars.ps1 +++ b/azure-pipelines/Set-EnvVars.ps1 @@ -24,7 +24,7 @@ if ($cmdInstructions) { Write-Host "Environment variables that must be set manually:" -ForegroundColor Blue } else { Write-Host "Environment variables set:" -ForegroundColor Blue - $envVars + Write-Host ($Variables | Out-String) if ($PrependPath) { Write-Host "Paths prepended to PATH: $PrependPath" } From e9dcc410b3a0cc01d48927253a66e9e3e8eb0a21 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 14 Apr 2020 09:44:37 -0600 Subject: [PATCH 140/889] Acquire procdump via nuget Just using nuget instead of choco makes it take less than 1 second instead of nearly a minute. It also removes the requirement for chocolatey to be installed on AzP agents, which helps compatibility with custom/private agents. Also move it to init.ps1 so it doesn't require a special AzP or GitHub Actions task and it canl run on local dev boxes. --- .github/workflows/build.yml | 4 ---- azure-pipelines/Get-ProcDump.ps1 | 14 ++++++++++++++ azure-pipelines/install-dependencies.yml | 7 ------- init.ps1 | 10 ++++++++++ 4 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 azure-pipelines/Get-ProcDump.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4ea0df36..91040d81 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,10 +35,6 @@ jobs: run: | ./init.ps1 -UpgradePrerequisites dotnet --info - if ($env:RUNNER_OS -eq "Windows") { - choco install procdump -y - Write-Host "##[set-env name=PROCDUMP_PATH;]$env:PROGRAMDATA\chocolatey\bin\" - } shell: pwsh - name: Set pipeline variables based on source run: azure-pipelines/variables/_pipelines.ps1 diff --git a/azure-pipelines/Get-ProcDump.ps1 b/azure-pipelines/Get-ProcDump.ps1 new file mode 100644 index 00000000..1493fe4b --- /dev/null +++ b/azure-pipelines/Get-ProcDump.ps1 @@ -0,0 +1,14 @@ +<# +.SYNOPSIS +Downloads 32-bit and 64-bit procdump executables and returns the path to where they were installed. +#> +$version = '0.0.1' +$baseDir = "$PSScriptRoot\..\obj\tools" +$procDumpToolPath = "$baseDir\procdump.$version\bin" +if (-not (Test-Path $procDumpToolPath)) { + if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null } + $baseDir = (Resolve-Path $baseDir).Path # Normalize it + & (& $PSScriptRoot\Get-NuGetTool.ps1) install procdump -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://api.nuget.org/v3/index.json | Out-Null +} + +(Resolve-Path $procDumpToolPath).Path diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 96917c4f..51cf839d 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -8,13 +8,6 @@ steps: dotnet --info displayName: Install prerequisites -# The procdump tool and env var is required for dotnet test to collect hang/crash dumps of tests. -- powershell: | - choco install procdump -y - Write-Host "##vso[task.setvariable variable=PROCDUMP_PATH;]$env:ProgramData\chocolatey\bin\" - displayName: Install procdump - condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true displayName: Set pipeline variables based on source diff --git a/init.ps1 b/init.ps1 index a0c9961f..ca0d718a 100755 --- a/init.ps1 +++ b/init.ps1 @@ -39,9 +39,17 @@ Param ( [string]$AccessToken ) +$EnvVars = @{} + if (!$NoPrerequisites) { & "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken -Force:$UpgradePrerequisites & "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality + + # The procdump tool and env var is required for dotnet test to collect hang/crash dumps of tests. + # But it only works on Windows. + if ($env:OS -eq 'Windows_NT') { + $EnvVars['PROCDUMP_PATH'] = & "$PSScriptRoot\azure-pipelines\Get-ProcDump.ps1" + } } # Workaround nuget credential provider bug that causes very unreliable package restores on Azure Pipelines @@ -59,6 +67,8 @@ try { throw "Failure while restoring packages." } } + + & "$PSScriptRoot\azure-pipelines\Set-EnvVars.ps1" -Variables $EnvVars | Out-Null } catch { Write-Error $error[0] From e5347ab78aada5c9401f35fe6d16b3b5569b0cc6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 14 Apr 2020 11:54:51 -0600 Subject: [PATCH 141/889] Update README file --- README.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0c3bcf59..32a67820 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,22 @@ ## Features * Follow the best and simplest patterns of build, pack and test with dotnet CLI. +* Init script that installs prerequisites and auth helpers, supporting both non-elevation and elevation modes. * Static analyzers: [FxCop](https://docs.microsoft.com/en-us/visualstudio/code-quality/fxcop-analyzers?view=vs-2019) and [StyleCop](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) * Read-only source tree (builds to top-level bin/obj folders) * Auto-versioning (via [Nerdbank.GitVersioning](https://github.com/aarnott/nerdbank.gitversioning)) -* Azure Pipeline via YAML with all dependencies declared for long-term serviceability. -* Testing on .NET Framework, multiple .NET Core versions -* Testing on Windows, Linux and OSX -* Code coverage published to Azure Pipelines -* Code coverage published to codecov.io so GitHub PRs get code coverage results added as a PR comment +* Builds with a "pinned" .NET Core SDK to ensure reproducible builds across machines and across time. +* Automatically pack the library and publish it as an artifact, and even push it to some NuGet feed for consumption. +* Testing + * Testing on .NET Framework, multiple .NET Core versions + * Testing on Windows, Linux and OSX + * Tests that crash or hang in Azure Pipelines automatically collect dumps and publish as a pipeline artifact for later investigation. +* Cloud build support: + * YAML based build for long-term serviceability, and PR review opportunities for any changes. + * Azure Pipelines and GitHub Action support + * Emphasis on PowerShell scripts over reliance on tasks for a more locally reproducible build. + * Code coverage published to Azure Pipelines + * Code coverage published to codecov.io so GitHub PRs get code coverage results added as a PR comment ## Consumption From b38ffc731de6cd80b20e1f5f612bb5c2b8ce1055 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 14 Apr 2020 11:56:47 -0600 Subject: [PATCH 142/889] touchup readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 32a67820..e235ca64 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ * Testing on .NET Framework, multiple .NET Core versions * Testing on Windows, Linux and OSX * Tests that crash or hang in Azure Pipelines automatically collect dumps and publish as a pipeline artifact for later investigation. -* Cloud build support: +* Cloud build support * YAML based build for long-term serviceability, and PR review opportunities for any changes. * Azure Pipelines and GitHub Action support * Emphasis on PowerShell scripts over reliance on tasks for a more locally reproducible build. From 091601252d2dfefb66e63da77295dbc853013e79 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 16 Apr 2020 12:02:32 -0600 Subject: [PATCH 143/889] Bring back access tokens for AzP feed access Fixes #49 (properly) --- azure-pipelines/install-dependencies.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 51cf839d..5b1ac4af 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -4,7 +4,8 @@ parameters: steps: - powershell: | - .\init.ps1 ${{ parameters['initArgs'] }} -UpgradePrerequisites + $AccessToken = '$(System.AccessToken)' # Avoid specifying the access token directly on the init.ps1 command line to avoid it showing up in errors + .\init.ps1 -AccessToken $AccessToken ${{ parameters['initArgs'] }} -UpgradePrerequisites dotnet --info displayName: Install prerequisites From ce6f1d1170dfff88bc1f6f44095442f75bd94e2d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 17 Apr 2020 12:10:46 -0600 Subject: [PATCH 144/889] Update link to NB.GV --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e235ca64..5424ff0a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ * Init script that installs prerequisites and auth helpers, supporting both non-elevation and elevation modes. * Static analyzers: [FxCop](https://docs.microsoft.com/en-us/visualstudio/code-quality/fxcop-analyzers?view=vs-2019) and [StyleCop](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) * Read-only source tree (builds to top-level bin/obj folders) -* Auto-versioning (via [Nerdbank.GitVersioning](https://github.com/aarnott/nerdbank.gitversioning)) +* Auto-versioning (via [Nerdbank.GitVersioning](https://github.com/dotnet/nerdbank.gitversioning)) * Builds with a "pinned" .NET Core SDK to ensure reproducible builds across machines and across time. * Automatically pack the library and publish it as an artifact, and even push it to some NuGet feed for consumption. * Testing From fa4481025d591efbcc7635fa36e990c7cef07596 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 17 Apr 2020 22:44:25 -0600 Subject: [PATCH 145/889] Use SignType parameter instead of variable --- azure-pipelines.yml | 2 ++ azure-pipelines/build.yml | 7 ++++++- azure-pipelines/microbuild.before.yml | 5 ++++- azure-pipelines/official.yml | 9 +++++++++ azure-pipelines/variables/SignType.ps1 | 3 --- azure-pipelines/variables/ci_feed.ps1 | 5 +---- 6 files changed, 22 insertions(+), 9 deletions(-) delete mode 100644 azure-pipelines/variables/SignType.ps1 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e590031a..a8a143bb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,3 +20,5 @@ variables: jobs: - template: azure-pipelines/build.yml + parameters: + SignType: diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index b327a94e..12298dfe 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -1,5 +1,8 @@ parameters: - windowsPool: Hosted Windows 2019 with VS2019 +- name: windowsPool + type: string + default: Hosted Windows 2019 with VS2019 +- name: SignType jobs: - job: Windows @@ -14,6 +17,8 @@ jobs: - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - template: microbuild.before.yml + parameters: + SignType: ${{ parameters.SignType }} - template: dotnet.yml diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index b1efae6e..07fadebf 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -1,6 +1,9 @@ +parameters: +- name: SignType + steps: - task: MicroBuildSigningPlugin@2 inputs: - signType: $(SignType) + signType: ${{ parameters.SignType }} zipSources: false displayName: Install MicroBuild Signing Plugin diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index d002dbb3..3126dc97 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -10,6 +10,13 @@ trigger: - '*.md' - .vscode/ +parameters: +- name: SignType + displayName: Sign type + type: string + default: Test + values: [ 'Test', 'Real' ] + variables: TreatWarningsAsErrors: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true @@ -17,8 +24,10 @@ variables: BuildPlatform: Any CPU push_to_ci: true NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages + SignType: ${{ parameters.SignType }} jobs: - template: build.yml parameters: windowsPool: VSEng-MicroBuildVS2019 + SignType: ${{ parameters.SignType }} diff --git a/azure-pipelines/variables/SignType.ps1 b/azure-pipelines/variables/SignType.ps1 deleted file mode 100644 index 7d3a4729..00000000 --- a/azure-pipelines/variables/SignType.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9') { - 'test' -} diff --git a/azure-pipelines/variables/ci_feed.ps1 b/azure-pipelines/variables/ci_feed.ps1 index 82bad79d..b5530b3f 100644 --- a/azure-pipelines/variables/ci_feed.ps1 +++ b/azure-pipelines/variables/ci_feed.ps1 @@ -1,7 +1,4 @@ -$signType = $env:SIGNTYPE -if (!$signType) { $signType = & "$PSScriptRoot/SignType.ps1" } - -if ($signType -eq 'Real') { +if ($env:SIGNTYPE -eq 'Real') { '09d8d03c-1ac8-456e-9274-4d2364527d99' # VSIDE-RealSigned-Release } else { 'da484c78-f942-44ef-b197-99e2a1bef53c' # VSIDE-TestSigned-Release From ebb0cb39f8ba823761693db82e7e0e509e080df2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 19 Apr 2020 10:10:43 -0600 Subject: [PATCH 146/889] Make Expand-Template.ps1 executable on linux --- Expand-Template.ps1 | 2 ++ 1 file changed, 2 insertions(+) mode change 100644 => 100755 Expand-Template.ps1 diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 old mode 100644 new mode 100755 index 9a05ecec..84b96680 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -1,3 +1,5 @@ +#!/usr/bin/env pwsh + <# .SYNOPSIS Expands this template into an actual project, taking values for placeholders From 7688576a6aa2badce32e092a66708b0a4f452875 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 19 Apr 2020 10:13:23 -0600 Subject: [PATCH 147/889] Remove line that doesn't work on pwsh --- Expand-Template.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 84b96680..dc53d1c1 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -148,7 +148,6 @@ try { Replace-Placeholders -Path "azure-pipelines.yml" -Replacements $YmlReplacements # Self destruct - $Invocation = (Get-Variable MyInvocation -Scope 1).Value git rm Expand-Template.* git rm :/azure-pipelines/expand-template.yml From 35cd5a2502d02cf0ba3e0141b7156403bf0b49e0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 19 Apr 2020 10:34:22 -0600 Subject: [PATCH 148/889] Move test project authoring into test folder --- Directory.Build.targets | 6 ------ test/Directory.Build.targets | 7 +++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index 1ddcba6f..8c119d54 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,8 +1,2 @@ - - cobertura - [xunit.*]* - - $(OutputPath)/ - diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets index 6a5a72c2..c48559e7 100644 --- a/test/Directory.Build.targets +++ b/test/Directory.Build.targets @@ -1,3 +1,10 @@ + + cobertura + [xunit.*]* + + $(OutputPath)/ + + From 498b5e6a34037dca15b629a07ef0d05908fc6782 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 20 Apr 2020 12:19:03 -0600 Subject: [PATCH 149/889] Authorize feeds in all nuget.config files throughout the repo --- tools/Install-NuGetCredProvider.ps1 | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/Install-NuGetCredProvider.ps1 b/tools/Install-NuGetCredProvider.ps1 index 496dcd96..2b3fb6fb 100755 --- a/tools/Install-NuGetCredProvider.ps1 +++ b/tools/Install-NuGetCredProvider.ps1 @@ -46,14 +46,20 @@ if ($IsMacOS -or $IsLinux) { if ($AccessToken) { $endpoints = @() - $nugetConfig = [xml](Get-Content -Path "$PSScriptRoot\..\nuget.config") + $endpointURIs = @() + Get-ChildItem "$PSScriptRoot\..\nuget.config" -Recurse |% { + $nugetConfig = [xml](Get-Content -Path $_) - $nugetConfig.configuration.packageSources.add |? { ($_.value -match '^https://pkgs\.dev\.azure\.com/') -or ($_.value -match '^https://[\w\-]+\.pkgs\.visualstudio\.com/') } |% { - $endpoint = New-Object -TypeName PSObject - Add-Member -InputObject $endpoint -MemberType NoteProperty -Name endpoint -Value $_.value - Add-Member -InputObject $endpoint -MemberType NoteProperty -Name username -Value ado - Add-Member -InputObject $endpoint -MemberType NoteProperty -Name password -Value $AccessToken - $endpoints += $endpoint + $nugetConfig.configuration.packageSources.add |? { ($_.value -match '^https://pkgs\.dev\.azure\.com/') -or ($_.value -match '^https://[\w\-]+\.pkgs\.visualstudio\.com/') } |% { + if ($endpointURIs -notcontains $_.Value) { + $endpointURIs += $_.Value + $endpoint = New-Object -TypeName PSObject + Add-Member -InputObject $endpoint -MemberType NoteProperty -Name endpoint -Value $_.value + Add-Member -InputObject $endpoint -MemberType NoteProperty -Name username -Value ado + Add-Member -InputObject $endpoint -MemberType NoteProperty -Name password -Value $AccessToken + $endpoints += $endpoint + } + } } $auth = New-Object -TypeName PSObject From ddccc9105d88680362b8d59de699dfec0ce94bce Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 23 Apr 2020 09:36:52 -0600 Subject: [PATCH 150/889] Fix conditional imports so they skip import on linux --- src/Directory.Build.props | 2 +- src/Directory.Build.targets | 2 +- test/Directory.Build.props | 2 +- test/Directory.Build.targets | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 50b6409e..165d2ddd 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,5 +1,5 @@ - + netstandard2.0 diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index ada76655..c1ce3634 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -4,5 +4,5 @@ false - + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 66b41d56..b48b5d81 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -1,5 +1,5 @@ - + net472;netcoreapp2.1;netcoreapp3.1 diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets index c48559e7..2faab375 100644 --- a/test/Directory.Build.targets +++ b/test/Directory.Build.targets @@ -6,5 +6,5 @@ $(OutputPath)/ - + From a67e84559d64cf88a38e01c95e7f59a41104787d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 23 Apr 2020 09:38:05 -0600 Subject: [PATCH 151/889] Reorder the docs to make more sense --- CONTRIBUTING.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0893b308..2102ba9b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,6 +14,9 @@ with any additional questions or comments. ## Prerequisites +All dependencies can be installed by running the `init.ps1` script at the root of the repository +using Windows PowerShell or [PowerShell Core][pwsh] (on any OS). + The only prerequisite for building, testing, and deploying from this repository is the [.NET SDK](https://get.dot.net/). You should install the version specified in `global.json` or a later version within @@ -22,11 +25,6 @@ For example if 2.2.300 is specified, you may install 2.2.300, 2.2.301, or 2.2.31 while the 2.2.400 version would not be considered compatible by .NET SDK. See [.NET Core Versioning](https://docs.microsoft.com/en-us/dotnet/core/versions/) for more information. -All dependencies can be installed by running the `init.ps1` script at the root of the repository -using Windows PowerShell or [PowerShell Core][pwsh] (on any OS). - -This repository can be built on Windows, Linux, and OSX. - ## Package restore The easiest way to restore packages may be to run `init.ps1` which automatically authenticates @@ -35,6 +33,8 @@ to the feeds that packages for this repo come from, if any. ## Building +This repository can be built on Windows, Linux, and OSX. + Building, testing, and packing this repository can be done by using the standard dotnet CLI commands (e.g. `dotnet build`, `dotnet test`, `dotnet pack`, etc.). [pwsh]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6 From e649d82e01088d680a1182a49697e5dfa892a553 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 23 Apr 2020 09:38:25 -0600 Subject: [PATCH 152/889] Update dependencies --- test/Library.Tests/Library.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 6113925a..28433bf5 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -5,8 +5,8 @@ - - + + From 8c54c69baede3744b4e8f8ed3d72b7115bdffc3b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 11 May 2020 09:40:52 -0600 Subject: [PATCH 153/889] Reduce certain rule severities in test projects --- test/.editorconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/.editorconfig b/test/.editorconfig index eac6d8ae..89195dda 100644 --- a/test/.editorconfig +++ b/test/.editorconfig @@ -26,3 +26,15 @@ dotnet_diagnostic.CA1303.severity = none # CS1591: Missing XML comment for publicly visible type or member dotnet_diagnostic.CS1591.severity = silent + +# CA1707: Identifiers should not contain underscores +dotnet_diagnostic.CA1707.severity = silent + +# CA1062: Validate arguments of public methods +dotnet_diagnostic.CA1062.severity = suggestion + +# CA1063: Implement IDisposable Correctly +dotnet_diagnostic.CA1063.severity = silent + +# CA1816: Dispose methods should call SuppressFinalize +dotnet_diagnostic.CA1816.severity = silent From 76eadc7926fc96ebc71e61988d2ee4516b34d73a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 11 May 2020 09:40:59 -0600 Subject: [PATCH 154/889] Add README as solution item --- Library.sln | 1 + 1 file changed, 1 insertion(+) diff --git a/Library.sln b/Library.sln index 85b8939d..606811aa 100644 --- a/Library.sln +++ b/Library.sln @@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Directory.Build.targets = Directory.Build.targets global.json = global.json nuget.config = nuget.config + README.md = README.md stylecop.json = stylecop.json version.json = version.json EndProjectSection From 160569a53024729c70b014fcad3c005e05a11ad2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 22 May 2020 09:35:59 -0600 Subject: [PATCH 155/889] Update package references --- Directory.Build.props | 6 +++--- test/Library.Tests/Library.Tests.csproj | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 7a97368f..9c119f37 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -24,11 +24,11 @@ - + - - + + diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 28433bf5..29ac7bf8 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -6,7 +6,7 @@ - + From 6d120a6a222577b239671d0f14f89bd5c63dbb59 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 22 May 2020 09:56:20 -0600 Subject: [PATCH 156/889] Update SDK to 3.1.300 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 0275fa5c..0200a660 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.201", + "version": "3.1.300", "rollForward": "patch", "allowPrerelease": false } From ecbb92cd2f3022bb408014c8394869c8f9ed20a2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 22 May 2020 10:20:17 -0600 Subject: [PATCH 157/889] Quote arguments to mklink This prevents breaks when the linked paths contain spaces, commas or other characters. --- azure-pipelines/artifacts/_stage_all.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/artifacts/_stage_all.ps1 b/azure-pipelines/artifacts/_stage_all.ps1 index a05db529..4e6a6dbe 100644 --- a/azure-pipelines/artifacts/_stage_all.ps1 +++ b/azure-pipelines/artifacts/_stage_all.ps1 @@ -33,7 +33,7 @@ function Create-SymbolicLink { if ($IsMacOS -or $IsLinux) { ln $Target $Link | Out-Null } else { - cmd /c mklink $Link $Target | Out-Null + cmd /c "mklink `"$Link`" `"$Target`"" | Out-Null } } From 860402b0b5cd59f44ca392c4ae42d38013eb637f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 8 Jun 2020 15:23:03 -0600 Subject: [PATCH 158/889] Fix Install-DotNetSdk.ps1 script on Windows PowerShell It misinterpreted it as a Mac/Linux environment under Windows Powershell. It only worked as-is under PowerShell Core, where `$IsWindows` is defined. --- tools/Install-DotNetSdk.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 7f9bf6cd..a13638ae 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -92,7 +92,9 @@ $envVars = @{ } if ($InstallLocality -eq 'machine') { - if ($IsWindows) { + if ($IsMacOS -or $IsLinux) { + $DotNetInstallDir = '/usr/share/dotnet' + } else { if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { Install-DotNet -Version $sdkVersion } @@ -104,8 +106,6 @@ if ($InstallLocality -eq 'machine') { } return - } else { - $DotNetInstallDir = '/usr/share/dotnet' } } elseif ($InstallLocality -eq 'repo') { $DotNetInstallDir = "$DotNetInstallScriptRoot/.dotnet" From 3c97ead14af585787a0cc41040dbb8e7077c5f9a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 15 Jun 2020 07:17:00 -0600 Subject: [PATCH 159/889] Update .NET Core SDK version to 3.1.301 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 0200a660..11833de0 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.300", + "version": "3.1.301", "rollForward": "patch", "allowPrerelease": false } From bc3f88d11b10f7f34769ad7af884a3eb9cb66fe9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 15 Jun 2020 07:09:02 -0600 Subject: [PATCH 160/889] Avoid unannounced system restart When installing the .NET SDK or runtime, if the installer wants a system restart, it would do so quietly. This avoids the restart but adds a prompt at the end of the script to inform the user of a restart being required when necessary. Fixes #57 --- init.ps1 | 3 +++ tools/Install-DotNetSdk.ps1 | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/init.ps1 b/init.ps1 index ca0d718a..72d68b5f 100755 --- a/init.ps1 +++ b/init.ps1 @@ -44,6 +44,9 @@ $EnvVars = @{} if (!$NoPrerequisites) { & "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken -Force:$UpgradePrerequisites & "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality + if ($LASTEXITCODE -eq 3010) { + Exit 3010 + } # The procdump tool and env var is required for dotnet test to collect hang/crash dumps of tests. # But it only works on Windows. diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index a13638ae..be5f6a27 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -77,8 +77,10 @@ Function Install-DotNet($Version, [switch]$Runtime) { Write-Host "Downloading .NET Core $sdkSubstring$Version..." $Installer = Get-InstallerExe -Version $Version -Runtime:$Runtime Write-Host "Installing .NET Core $sdkSubstring$Version..." - cmd /c start /wait $Installer /install /quiet - if ($LASTEXITCODE -ne 0) { + cmd /c start /wait $Installer /install /passive /norestart + if ($LASTEXITCODE -eq 3010) { + Write-Verbose "Restart required" + } elseif ($LASTEXITCODE -ne 0) { throw "Failure to install .NET Core SDK" } } @@ -95,16 +97,24 @@ if ($InstallLocality -eq 'machine') { if ($IsMacOS -or $IsLinux) { $DotNetInstallDir = '/usr/share/dotnet' } else { + $restartRequired = $false if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { Install-DotNet -Version $sdkVersion + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) } $runtimeVersions | Get-Unique |% { if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { Install-DotNet -Version $_ -Runtime + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) } } + if ($restartRequired) { + Write-Host -ForegroundColor Yellow "System restart required" + Exit 3010 + } + return } } elseif ($InstallLocality -eq 'repo') { From 4a0dface5e4967814178cdf2ebf67f38b01744a7 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 15 Jul 2020 15:08:50 -0600 Subject: [PATCH 161/889] Remove strongname.snk This is generated by expanding the template. It was mistakenly checked in at some point. --- strongname.snk | Bin 596 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 strongname.snk diff --git a/strongname.snk b/strongname.snk deleted file mode 100644 index a4d0a2ce39df5f7c284340b4a2c4690385c44208..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50097Td7B6KsP|cl#<{bONo_!&t)QUG9wW^j zM1zvNAOI=XF}potSO>54lS%MGl8tv)xYTSw?~K<1McvNlJ;DITeY__C?><|;F`bgX zj;&2ME}KBWPb0zVSK+iW?{2`tzZR-#x0K_|t&0FhD+3urA!lNmCH;&b|?g|_AC39ox-0 zcV%KJis3}%`RVWSXN58fc}#LF$A#kcB2VWh=MH0zs+k7{ zQT<5V>NGhWzC7Jnt4A?n%Kk`fPt&FR4k~q{TSW%@D{plIpotzop}i+x`~C))*Vr-i zrW2)aE17f*=wCRa_#bHkYlQko_Jh)wN@;?yML9mYk)XZ`l6IQ*D7xZmmL=m(T|zMG i={(T>StYQl!YSPV From 2095a96269bc9bcf6c2eb9e21e3bbd2ccc33cc97 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 24 Jul 2020 07:57:24 -0600 Subject: [PATCH 162/889] Print existing variable in Azure Pipelines --- azure-pipelines/variables/_pipelines.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/variables/_pipelines.ps1 b/azure-pipelines/variables/_pipelines.ps1 index 14d6ffc2..3de19d7a 100644 --- a/azure-pipelines/variables/_pipelines.ps1 +++ b/azure-pipelines/variables/_pipelines.ps1 @@ -8,7 +8,7 @@ # Always use ALL CAPS for env var names since Azure Pipelines converts variable names to all caps and on non-Windows OS, env vars are case sensitive. $keyCaps = $_.Key.ToUpper() if (Test-Path -Path "env:$keyCaps") { - Write-Host "Skipping setting $keyCaps because variable is already set." -ForegroundColor Cyan + Write-Host "Skipping setting $keyCaps because variable is already set to '$(Get-Content env:$keyCaps)'." -ForegroundColor Cyan } else { Write-Host "$keyCaps=$($_.Value)" -ForegroundColor Yellow if ($env:TF_BUILD) { From ecf6c16025a3905e673cdd542ad80185a9587e9e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 24 Jul 2020 08:46:23 -0600 Subject: [PATCH 163/889] Fix build and snk updates during template expansion We inappropriately removed the required snk file for our own build in 4a0dface5e496. This brings it back. It also updates Expand-Template.ps1 to overwrite the existing one rather than creating a new one in an ignored location. --- Expand-Template.ps1 | 4 ++-- strongname.snk | Bin 0 -> 596 bytes 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 strongname.snk diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index dc53d1c1..5ed211d0 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -101,8 +101,8 @@ try { git add "test/$LibraryName.Tests/$LibraryName.Tests.csproj" # Establish a new strong-name key - & $sn.Path -k 2048 src/strongname.snk - git add src/strongname.snk + & $sn.Path -k 2048 strongname.snk + git add strongname.snk # Replace placeholders in source files Replace-Placeholders -Path "src/$LibraryName/Calculator.cs" -Replacements @{ diff --git a/strongname.snk b/strongname.snk new file mode 100644 index 0000000000000000000000000000000000000000..a4d0a2ce39df5f7c284340b4a2c4690385c44208 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50097Td7B6KsP|cl#<{bONo_!&t)QUG9wW^j zM1zvNAOI=XF}potSO>54lS%MGl8tv)xYTSw?~K<1McvNlJ;DITeY__C?><|;F`bgX zj;&2ME}KBWPb0zVSK+iW?{2`tzZR-#x0K_|t&0FhD+3urA!lNmCH;&b|?g|_AC39ox-0 zcV%KJis3}%`RVWSXN58fc}#LF$A#kcB2VWh=MH0zs+k7{ zQT<5V>NGhWzC7Jnt4A?n%Kk`fPt&FR4k~q{TSW%@D{plIpotzop}i+x`~C))*Vr-i zrW2)aE17f*=wCRa_#bHkYlQko_Jh)wN@;?yML9mYk)XZ`l6IQ*D7xZmmL=m(T|zMG i={(T>StYQl!YSPV literal 0 HcmV?d00001 From c03b185de7c83b21f1f84ac01656e2d3226625ac Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 25 Jul 2020 09:59:36 -0600 Subject: [PATCH 164/889] Set output variables as well This allows them to be referenced by subsequent jobs and stages. --- azure-pipelines/install-dependencies.yml | 1 + azure-pipelines/variables/_pipelines.ps1 | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 5b1ac4af..f773f385 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -12,3 +12,4 @@ steps: - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true displayName: Set pipeline variables based on source + name: SetPipelineVariables diff --git a/azure-pipelines/variables/_pipelines.ps1 b/azure-pipelines/variables/_pipelines.ps1 index 3de19d7a..55299550 100644 --- a/azure-pipelines/variables/_pipelines.ps1 +++ b/azure-pipelines/variables/_pipelines.ps1 @@ -12,7 +12,10 @@ } else { Write-Host "$keyCaps=$($_.Value)" -ForegroundColor Yellow if ($env:TF_BUILD) { - Write-Host "##vso[task.setvariable variable=$keyCaps;]$($_.Value)" + # Create two variables: the first that can be used by its simple name and accessible only within this job. + Write-Host "##vso[task.setvariable variable=$keyCaps]$($_.Value)" + # and the second that works across jobs and stages but must be fully qualified when referenced. + Write-Host "##vso[task.setvariable variable=$keyCaps;isOutput=true]$($_.Value)" } elseif ($env:GITHUB_ACTIONS) { Write-Host "::set-env name=$keyCaps::$($_.Value)" } From 171534d501b52b18a1d8bba53f93ec0149ad016a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 27 Jul 2020 16:13:01 -0600 Subject: [PATCH 165/889] Remove microbuild from CI list --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91040d81..b9f17c23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,6 @@ on: push: branches: - master - - microbuild - validate/* pull_request: From 285bd4f1a116799fe42bbb454710fec90155e9f8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 4 Aug 2020 10:01:41 -0600 Subject: [PATCH 166/889] Enable GitHub Dependabot --- .editorconfig | 4 ++++ .github/dependabot.yml | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.editorconfig b/.editorconfig index 979d170a..15f0b0e6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,6 +9,10 @@ indent_style = space # (Please don't specify an indent_size here; that has too many unintended consequences.) +[*.yml] +indent_size = 2 +indent_style = space + # Code files [*.{cs,csx,vb,vbx,h,cpp,idl}] indent_size = 4 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..aa48b0fe --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: +- package-ecosystem: nuget + directory: / + schedule: + interval: weekly From cc969eccc71582c459b528fbd6f2a7752a302e4f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Aug 2020 16:03:35 +0000 Subject: [PATCH 167/889] Bump xunit.runner.visualstudio from 2.4.1 to 2.4.3 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.4.1 to 2.4.3. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/commits/v2.4.3) Signed-off-by: dependabot[bot] --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 29ac7bf8..a491f369 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -8,7 +8,7 @@ - + From 116a8b074c2cc91e2ee2105e29b6bbaf9010c793 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Aug 2020 16:03:38 +0000 Subject: [PATCH 168/889] Bump Nerdbank.GitVersioning from 3.1.91 to 3.2.31 Bumps [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning) from 3.1.91 to 3.2.31. - [Release notes](https://github.com/dotnet/Nerdbank.GitVersioning/releases) - [Commits](https://github.com/dotnet/Nerdbank.GitVersioning/compare/v3.1.91...v3.2.31) Signed-off-by: dependabot[bot] --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 9c119f37..7a6a46ae 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -27,7 +27,7 @@ - + From a6010319f64a75446a3f0c513388e736e0c98c0f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Aug 2020 16:16:14 +0000 Subject: [PATCH 169/889] Bump coverlet.msbuild from 2.8.1 to 2.9.0 Bumps [coverlet.msbuild](https://github.com/coverlet-coverage/coverlet) from 2.8.1 to 2.9.0. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/commits) Signed-off-by: dependabot[bot] --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index a491f369..4b76c54b 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -5,7 +5,7 @@ - + From a8c59c572c872c495b467e1a1a1f81d174592bd6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Aug 2020 06:21:04 +0000 Subject: [PATCH 170/889] Bump Microsoft.Net.Compilers.Toolset from 3.6.0 to 3.7.0 Bumps [Microsoft.Net.Compilers.Toolset](https://github.com/dotnet/roslyn) from 3.6.0 to 3.7.0. - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/master/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits) Signed-off-by: dependabot[bot] --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 7a6a46ae..8ffdea80 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -28,7 +28,7 @@ - + From c73b9220f6b0131fc5ac67af91b71c96df51d782 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Aug 2020 06:21:04 +0000 Subject: [PATCH 171/889] Bump Microsoft.NET.Test.Sdk from 16.6.1 to 16.7.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 16.6.1 to 16.7.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v16.6.1...v16.7.0) Signed-off-by: dependabot[bot] --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 4b76c54b..6e1c8293 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -6,7 +6,7 @@ - + From 29cf0a517da6adf751a11d2558361d5240f831a2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 10 Aug 2020 08:02:17 -0600 Subject: [PATCH 172/889] Update .NET Core SDK to 3.1.302 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 11833de0..cc9e47f2 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.301", + "version": "3.1.302", "rollForward": "patch", "allowPrerelease": false } From fe64abe20bc74fc6aecedcbc54176b76298e4302 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 10 Aug 2020 09:13:44 -0600 Subject: [PATCH 173/889] Get WPF inner-builds to import NuGet packages' imports Workaround for https://github.com/dotnet/wpf/issues/810 --- Directory.Build.props | 27 +++++++++++++++++++++++++++ Directory.Build.targets | 6 ++++++ src/Directory.Build.targets | 5 ----- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 7a6a46ae..23d033f6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -40,4 +40,31 @@ + + + false + true + + + + + <_WpfTempProjectNuGetFilePathNoExt>$(RepoRootPath)obj\$(_TargetAssemblyProjectName)\$(_TargetAssemblyProjectName)$(MSBuildProjectExtension).nuget.g + + false + false + false + false + + + + diff --git a/Directory.Build.targets b/Directory.Build.targets index 8c119d54..65a15bfc 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,2 +1,8 @@ + + + false + + + diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index c1ce3634..e7edee55 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,8 +1,3 @@ - - - false - - From 225c8e7b9ea43c30640323f8ba4b89c5783b386c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 15 Aug 2020 09:00:24 -0600 Subject: [PATCH 174/889] Ignore CA2007 in tests --- test/.editorconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/.editorconfig b/test/.editorconfig index 89195dda..2abae62d 100644 --- a/test/.editorconfig +++ b/test/.editorconfig @@ -38,3 +38,6 @@ dotnet_diagnostic.CA1063.severity = silent # CA1816: Dispose methods should call SuppressFinalize dotnet_diagnostic.CA1816.severity = silent + +# CA2007: Consider calling ConfigureAwait on the awaited task +dotnet_diagnostic.CA2007.severity = none From eef30466f115466841d4107cfc7cd6affec91e08 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2020 06:30:20 +0000 Subject: [PATCH 175/889] Bump Microsoft.CodeAnalysis.FxCopAnalyzers from 3.0.0 to 3.3.0 Bumps [Microsoft.CodeAnalysis.FxCopAnalyzers](https://github.com/dotnet/roslyn-analyzers) from 3.0.0 to 3.3.0. - [Release notes](https://github.com/dotnet/roslyn-analyzers/releases) - [Changelog](https://github.com/dotnet/roslyn-analyzers/blob/master/PostReleaseActivities.md) - [Commits](https://github.com/dotnet/roslyn-analyzers/compare/v3.0.0...v3.3.0) Signed-off-by: dependabot[bot] --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index ce0d2a55..b9f89e5a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -24,7 +24,7 @@ - + From d5f3e774f5b345b578742607edc91513fcf66d0f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 19 Aug 2020 10:57:24 -0600 Subject: [PATCH 176/889] Add YAML based release pipeline --- azure-pipelines/release.yml | 72 +++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 azure-pipelines/release.yml diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml new file mode 100644 index 00000000..bfe5987c --- /dev/null +++ b/azure-pipelines/release.yml @@ -0,0 +1,72 @@ +trigger: none # We only want to trigger manually or based on resources +pr: none + +resources: + pipelines: + - pipeline: CI + source: Library # TODO: This should match the name of your CI pipeline + trigger: + tags: + - auto-release + +stages: +- stage: GitHubRelease + displayName: GitHub Release + jobs: + - deployment: create + pool: + vmImage: ubuntu-latest + environment: No-Approval + strategy: + runOnce: + deploy: + steps: + - download: none + - powershell: | + Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" + displayName: Set pipeline name + - task: GitHubRelease@1 + displayName: GitHub release (create) + inputs: + gitHubConnection: # TODO: fill in service connection here + repositoryName: $(Build.Repository.Name) + target: $(resources.pipeline.CI.sourceCommit) + tagSource: userSpecifiedTag + tag: v$(resources.pipeline.CI.runName) + title: v$(resources.pipeline.CI.runName) + isDraft: true # After running this step, visit the new draft release, edit, and publish. + changeLogCompareToRelease: lastNonDraftRelease + changeLogType: issueBased + changeLogLabels: | + [ + { "label" : "bug", "displayName" : "Fixes", "state" : "closed" }, + { "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" } + ] + +- stage: nuget_org + displayName: nuget.org + dependsOn: GitHubRelease + jobs: + - deployment: push + pool: + vmImage: ubuntu-latest + environment: No-Approval + strategy: + runOnce: + deploy: + steps: + - download: CI + artifact: deployables-Windows + displayName: Download deployables-Windows artifact + patterns: 'deployables-Windows/*' + - task: NuGetToolInstaller@1 + displayName: Use NuGet 5.x + inputs: + versionSpec: 5.x + - task: NuGetCommand@2 + displayName: NuGet push + inputs: + command: push + packagesToPush: $(Pipeline.Workspace)/CI/deployables-Windows/*.nupkg + nuGetFeedType: external + publishFeedCredentials: # TODO: fill in service connection here From 9469bdf8c4e70ac8a8d5d7b8eacbf94ad2b1c5e0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 19 Aug 2020 12:13:49 -0600 Subject: [PATCH 177/889] Fix up init.cmd to set env vars from .ps1 child process --- azure-pipelines/Set-EnvVars.ps1 | 20 ++++++++++++++++++- init.cmd | 16 +++++++++++++++ init.ps1 | 35 ++++++++++++++++++--------------- tools/Install-DotNetSdk.ps1 | 22 ++++++++++----------- 4 files changed, 65 insertions(+), 28 deletions(-) diff --git a/azure-pipelines/Set-EnvVars.ps1 b/azure-pipelines/Set-EnvVars.ps1 index 9d14d9aa..bde2e343 100644 --- a/azure-pipelines/Set-EnvVars.ps1 +++ b/azure-pipelines/Set-EnvVars.ps1 @@ -4,8 +4,13 @@ Azure Pipeline and CMD environments are considered. .PARAMETER Variables A hashtable of variables to be set. +.PARAMETER PrependPath + A set of paths to prepend to the PATH environment variable. .OUTPUTS A boolean indicating whether the environment variables can be expected to propagate to the caller's environment. +.DESCRIPTION + The CmdEnvScriptPath environment variable may be optionally set to a path to a cmd shell script to be created (or appended to if it already exists) that will set the environment variables in cmd.exe that are set within the PowerShell environment. + This is used by init.cmd in order to reapply any new environment variables to the parent cmd.exe process that were set in the powershell child process. #> [CmdletBinding(SupportsShouldProcess=$true)] Param( @@ -18,7 +23,7 @@ if ($Variables.Count -eq 0) { return $true } -$cmdInstructions = !$env:TF_BUILD -and !$env:GITHUB_ACTIONS -and $env:PS1UnderCmd -eq '1' +$cmdInstructions = !$env:TF_BUILD -and !$env:GITHUB_ACTIONS -and !$env:CmdEnvScriptPath -and ($env:PS1UnderCmd -eq '1') if ($cmdInstructions) { Write-Warning "Environment variables have been set that will be lost because you're running under cmd.exe" Write-Host "Environment variables that must be set manually:" -ForegroundColor Blue @@ -38,6 +43,7 @@ if ($env:GITHUB_ACTIONS) { Write-Host "GitHub Actions detected. Logging commands will be used to propagate environment variables and prepend path." } +$CmdEnvScript = '' $Variables.GetEnumerator() |% { Set-Item -Path env:$($_.Key) -Value $_.Value @@ -52,6 +58,8 @@ $Variables.GetEnumerator() |% { if ($cmdInstructions) { Write-Host "SET $($_.Key)=$($_.Value)" } + + $CmdEnvScript += "SET $($_.Key)=$($_.Value)`r`n" } $pathDelimiter = ';' @@ -73,7 +81,17 @@ if ($PrependPath) { if ($env:GITHUB_ACTIONS) { Write-Host "::add-path::$_" } + + $CmdEnvScript += "SET PATH=$_$pathDelimiter%PATH%" + } +} + +if ($env:CmdEnvScriptPath) { + if (Test-Path $env:CmdEnvScriptPath) { + $CmdEnvScript = (Get-Content -Path $env:CmdEnvScriptPath) + $CmdEnvScript } + + Set-Content -Path $env:CmdEnvScriptPath -Value $CmdEnvScript } return !$cmdInstructions diff --git a/init.cmd b/init.cmd index 970285c2..667efabb 100644 --- a/init.cmd +++ b/init.cmd @@ -1,4 +1,20 @@ @echo off SETLOCAL set PS1UnderCmd=1 + +:: Get the datetime in a format that can go in a filename. +set _my_datetime=%date%_%time% +set _my_datetime=%_my_datetime: =_% +set _my_datetime=%_my_datetime::=% +set _my_datetime=%_my_datetime:/=_% +set _my_datetime=%_my_datetime:.=_% +set CmdEnvScriptPath=%temp%\envvarscript_%_my_datetime%.cmd + powershell.exe -NoProfile -NoLogo -ExecutionPolicy bypass -Command "try { & '%~dpn0.ps1' %*; exit $LASTEXITCODE } catch { write-host $_; exit 1 }" + +:: Set environment variables in the parent cmd.exe process. +IF EXIST "%CmdEnvScriptPath%" ( + ENDLOCAL + CALL "%CmdEnvScriptPath%" + DEL "%CmdEnvScriptPath%" +) diff --git a/init.ps1 b/init.ps1 index 72d68b5f..a6978b6f 100755 --- a/init.ps1 +++ b/init.ps1 @@ -2,28 +2,31 @@ <# .SYNOPSIS -Installs dependencies required to build and test the projects in this repository. + Installs dependencies required to build and test the projects in this repository. .DESCRIPTION -This MAY not require elevation, as the SDK and runtimes are installed to a per-user location, -unless the `-InstallLocality` switch is specified directing to a per-repo or per-machine location. -See detailed help on that switch for more information. + This MAY not require elevation, as the SDK and runtimes are installed to a per-user location, + unless the `-InstallLocality` switch is specified directing to a per-repo or per-machine location. + See detailed help on that switch for more information. + + The CmdEnvScriptPath environment variable may be optionally set to a path to a cmd shell script to be created (or appended to if it already exists) that will set the environment variables in cmd.exe that are set within the PowerShell environment. + This is used by init.cmd in order to reapply any new environment variables to the parent cmd.exe process that were set in the powershell child process. .PARAMETER InstallLocality -A value indicating whether dependencies should be installed locally to the repo or at a per-user location. -Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. -Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. -Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. -When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. -Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. -Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. + A value indicating whether dependencies should be installed locally to the repo or at a per-user location. + Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. + Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. + Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. + When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. + Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. + Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. .PARAMETER NoPrerequisites -Skips the installation of prerequisite software (e.g. SDKs, tools). + Skips the installation of prerequisite software (e.g. SDKs, tools). .PARAMETER UpgradePrerequisites -Takes time to install prerequisites even if they are already present in case they need to be upgraded. -No effect if -NoPrerequisites is specified. + Takes time to install prerequisites even if they are already present in case they need to be upgraded. + No effect if -NoPrerequisites is specified. .PARAMETER NoRestore -Skips the package restore step. + Skips the package restore step. .PARAMETER AccessToken -An optional access token for authenticating to Azure Artifacts authenticated feeds. + An optional access token for authenticating to Azure Artifacts authenticated feeds. #> [CmdletBinding(SupportsShouldProcess=$true)] Param ( diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index be5f6a27..a02b5cdc 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -2,19 +2,19 @@ <# .SYNOPSIS -Installs the .NET SDK specified in the global.json file at the root of this repository, -along with supporting .NET Core runtimes used for testing. + Installs the .NET SDK specified in the global.json file at the root of this repository, + along with supporting .NET Core runtimes used for testing. .DESCRIPTION -This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location, -unless `-InstallLocality machine` is specified. + This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location, + unless `-InstallLocality machine` is specified. .PARAMETER InstallLocality -A value indicating whether dependencies should be installed locally to the repo or at a per-user location. -Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. -Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. -Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. -When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. -Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. -Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. + A value indicating whether dependencies should be installed locally to the repo or at a per-user location. + Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. + Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. + Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. + When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. + Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. + Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. #> [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] Param ( From 5439be7fde0ebed774cffc561bf2390cea1a87b3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 19 Aug 2020 12:14:19 -0600 Subject: [PATCH 178/889] Move Set-EnvVars.ps1 to tools --- init.ps1 | 2 +- tools/Install-DotNetSdk.ps1 | 2 +- tools/Install-NuGetCredProvider.ps1 | 8 +++++--- {azure-pipelines => tools}/Set-EnvVars.ps1 | 0 4 files changed, 7 insertions(+), 5 deletions(-) rename {azure-pipelines => tools}/Set-EnvVars.ps1 (100%) diff --git a/init.ps1 b/init.ps1 index a6978b6f..e5aad5bf 100755 --- a/init.ps1 +++ b/init.ps1 @@ -74,7 +74,7 @@ try { } } - & "$PSScriptRoot\azure-pipelines\Set-EnvVars.ps1" -Variables $EnvVars | Out-Null + & "$PSScriptRoot/tools/Set-EnvVars.ps1" -Variables $EnvVars | Out-Null } catch { Write-Error $error[0] diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index a02b5cdc..2da4a73d 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -165,5 +165,5 @@ $runtimeVersions | Get-Unique |% { } if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these installed runtimes?")) { - & "$PSScriptRoot/../azure-pipelines/Set-EnvVars.ps1" -Variables $envVars -PrependPath $DotNetInstallDir | Out-Null + & "$PSScriptRoot/Set-EnvVars.ps1" -Variables $envVars -PrependPath $DotNetInstallDir | Out-Null } diff --git a/tools/Install-NuGetCredProvider.ps1 b/tools/Install-NuGetCredProvider.ps1 index 2b3fb6fb..6d310034 100755 --- a/tools/Install-NuGetCredProvider.ps1 +++ b/tools/Install-NuGetCredProvider.ps1 @@ -19,6 +19,8 @@ Param ( [string]$AccessToken ) +$envVars = @{} + $toolsPath = & "$PSScriptRoot\..\azure-pipelines\Get-TempToolsPath.ps1" if ($IsMacOS -or $IsLinux) { @@ -66,9 +68,9 @@ if ($AccessToken) { Add-Member -InputObject $auth -MemberType NoteProperty -Name endpointCredentials -Value $endpoints $authJson = ConvertTo-Json -InputObject $auth - $envVars = @{ + $envVars += @{ 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS'=$authJson; } - - & "$PSScriptRoot\..\azure-pipelines\Set-EnvVars.ps1" -Variables $envVars | Out-Null } + +& "$PSScriptRoot/Set-EnvVars.ps1" -Variables $envVars | Out-Null diff --git a/azure-pipelines/Set-EnvVars.ps1 b/tools/Set-EnvVars.ps1 similarity index 100% rename from azure-pipelines/Set-EnvVars.ps1 rename to tools/Set-EnvVars.ps1 From 7d217d1f1658b5348bd9739b1e742c9ad7e21402 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 21 Aug 2020 21:54:00 -0600 Subject: [PATCH 179/889] Run net472 tests on mac/linux (which means on Mono) --- azure-pipelines/dotnet.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 6764e6ec..8f4e950f 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -12,7 +12,7 @@ steps: command: test arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" testRunTitle: net472-$(Agent.JobName) - condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) + condition: succeededOrFailed() - task: DotNetCoreCLI@2 displayName: dotnet test -f netcoreapp2.1 @@ -20,6 +20,7 @@ steps: command: test arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" testRunTitle: netcoreapp2.1-$(Agent.JobName) + condition: succeededOrFailed() - task: DotNetCoreCLI@2 displayName: dotnet test -f netcoreapp3.1 @@ -27,6 +28,7 @@ steps: command: test arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" testRunTitle: netcoreapp3.1-$(Agent.JobName) + condition: succeededOrFailed() - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true From 461288dfc334ecacc78d797ab9ceba504bbac25b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 23 Aug 2020 12:58:47 -0600 Subject: [PATCH 180/889] Beef up contrib doc explanation of init.ps1 --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2102ba9b..36424c42 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,6 +16,8 @@ with any additional questions or comments. All dependencies can be installed by running the `init.ps1` script at the root of the repository using Windows PowerShell or [PowerShell Core][pwsh] (on any OS). +Some dependencies installed by `init.ps1` may only be discoverable from the same command line environment the init script was run from due to environment variables, so be sure to launch Visual Studio or build the repo from that same environment. +Alternatively, run `init.ps1 -InstallLocality Machine` (which may require elevation) in order to install dependencies at machine-wide locations so Visual Studio and builds work everywhere. The only prerequisite for building, testing, and deploying from this repository is the [.NET SDK](https://get.dot.net/). From b79b08af1a6da50c9bee63c8b5e932992be53fa2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 23 Aug 2020 13:15:57 -0600 Subject: [PATCH 181/889] Add warning that non-machine installs must run within same environment --- tools/Install-DotNetSdk.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 2da4a73d..ec66c949 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -148,7 +148,10 @@ if (-not (Test-Path $DotNetInstallScriptPath)) { } } +$anythingInstalled = $false + if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { + $anythingInstalled = $true Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches" } else { Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches -DryRun" @@ -158,6 +161,7 @@ $switches += '-Runtime','dotnet' $runtimeVersions | Get-Unique |% { if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { + $anythingInstalled = $true Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches" } else { Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches -DryRun" @@ -167,3 +171,7 @@ $runtimeVersions | Get-Unique |% { if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these installed runtimes?")) { & "$PSScriptRoot/Set-EnvVars.ps1" -Variables $envVars -PrependPath $DotNetInstallDir | Out-Null } + +if ($anythingInstalled -and ($InstallLocality -ne 'machine') -and !$env:TF_BUILD -and !$env:GITHUB_ACTIONS) { + Write-Warning ".NET Core runtimes or SDKs were installed to a non-machine location. Perform your builds or open Visual Studio from this same environment in order for tools to discover the location of these dependencies." +} From 3d1c43c3d3222adfec73c0981fc799308a6a94e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2020 06:48:20 -0600 Subject: [PATCH 182/889] Bump Microsoft.NET.Test.Sdk from 16.7.0 to 16.7.1 (#72) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 16.7.0 to 16.7.1. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v16.7.0...v16.7.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 6e1c8293..ea4220b9 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -6,7 +6,7 @@ - + From 641eaa17cdf690aacad122a78b3f32b13cf36d8a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 11 Sep 2020 03:40:22 -0600 Subject: [PATCH 183/889] Provide better error when sn is not on the PATH Since the .NET Core SDK does not include the sn tool, on mac/linux the only way to create strong name keys is with mono. The expand-template.ps1 script didn't explain this to the user, but instead searched a Windows directory. This commit improves the error they see. Fixes #73 --- Expand-Template.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 5ed211d0..e0708bd4 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -56,6 +56,10 @@ function Replace-Placeholders { # Try to find sn.exe if it isn't on the PATH $sn = Get-Command sn -ErrorAction SilentlyContinue if (-not $sn) { + if ($IsMacOS -or $IsLinux) { + Write-Error "sn command not found on PATH. Install mono and/or vote up this issue: https://github.com/dotnet/sdk/issues/13560" + exit(1) + } $snExes = Get-ChildItem -Recurse "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\sn.exe" if ($snExes) { $sn = Get-Command $snExes[0].FullName From e3449f0b073df5ec14886be35a8f01e76f4c50f1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 11 Sep 2020 03:44:08 -0600 Subject: [PATCH 184/889] Fail fast when dotnet returns an exit code --- Expand-Template.ps1 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index e0708bd4..adc4fb11 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -82,31 +82,48 @@ try { if ($Squash) { $originalCommitId = git rev-parse HEAD git reset --soft $(git rev-list --max-parents=0 HEAD) + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } git commit --amend -qm "Initial template from https://github.com/AArnott/Library.Template" -m "Original commit from template $originalCommitId" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } # Rename project directories and solution git mv Library.sln "$LibraryName.sln" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } git mv src/Library/Library.csproj "src/Library/$LibraryName.csproj" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } git mv src/Library "src/$LibraryName" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } git mv test/Library.Tests/Library.Tests.csproj "test/Library.Tests/$LibraryName.Tests.csproj" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } git mv test/Library.Tests "test/$LibraryName.Tests" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Refresh solution file both to update paths and give the projects unique GUIDs dotnet sln remove src/Library/Library.csproj + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } dotnet sln remove test/Library.Tests/Library.Tests.csproj + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } dotnet sln add "src/$LibraryName" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } dotnet sln add "test/$LibraryName.Tests" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } git add "$LibraryName.sln" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Update project reference in test project. Add before removal to keep the same ItemGroup in place. dotnet add "test/$LibraryName.Tests" reference "src/$LibraryName" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } dotnet remove "test/$LibraryName.Tests" reference src/Library/Library.csproj + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } git add "test/$LibraryName.Tests/$LibraryName.Tests.csproj" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Establish a new strong-name key & $sn.Path -k 2048 strongname.snk + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } git add strongname.snk + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Replace placeholders in source files Replace-Placeholders -Path "src/$LibraryName/Calculator.cs" -Replacements @{ @@ -153,7 +170,9 @@ try { # Self destruct git rm Expand-Template.* + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } git rm :/azure-pipelines/expand-template.yml + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Self-integrity check Get-ChildItem -Recurse -File -Exclude bin,obj,README.md,Expand-Template.* |? { -not $_.FullName.Contains("obj") } |% { @@ -165,6 +184,7 @@ try { # Commit the changes git commit -qm "Expanded template for $LibraryName" -m "This expansion done by the (now removed) Expand-Template.ps1 script." + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Write-Host -ForegroundColor Green "Template successfully expanded." From 0c212b6459c470633a941c7854eb6f73f258f488 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 11 Sep 2020 05:59:22 -0600 Subject: [PATCH 185/889] Skip .NET SDK and runtime install when unneeded --- tools/Check-DotNetRuntime.ps1 | 41 +++++++++++++++++++++++++++++ tools/Check-DotNetSdk.ps1 | 31 ++++++++++++++++++++++ tools/Install-DotNetSdk.ps1 | 49 ++++++++++++++++++++++++----------- 3 files changed, 106 insertions(+), 15 deletions(-) create mode 100644 tools/Check-DotNetRuntime.ps1 create mode 100644 tools/Check-DotNetSdk.ps1 diff --git a/tools/Check-DotNetRuntime.ps1 b/tools/Check-DotNetRuntime.ps1 new file mode 100644 index 00000000..9d012109 --- /dev/null +++ b/tools/Check-DotNetRuntime.ps1 @@ -0,0 +1,41 @@ +<# +.SYNOPSIS + Checks whether a given .NET Core runtime is installed. +#> +[CmdletBinding()] +Param ( + [Parameter()] + [ValidateSet('Microsoft.AspNetCore.App','Microsoft.NETCore.App')] + [string]$Runtime='Microsoft.NETCore.App', + [Parameter(Mandatory=$true)] + [Version]$Version +) + +$dotnet = Get-Command dotnet -ErrorAction SilentlyContinue +if (!$dotnet) { + # Nothing is installed. + Write-Output $false + exit 1 +} + +Function IsVersionMatch { + Param( + [Parameter()] + $actualVersion + ) + return $actualVersion -and + $Version.Major -eq $actualVersion.Major -and + $Version.Minor -eq $actualVersion.Minor -and + (($Version.Build -eq -1) -or ($Version.Build -eq $actualVersion.Build)) -and + (($Version.Revision -eq -1) -or ($Version.Revision -eq $actualVersion.Revision)) +} + +$installedRuntimes = dotnet --list-runtimes |? { $_.Split()[0] -ieq $Runtime } |% { $v = $null; [Version]::tryparse($_.Split()[1], [ref] $v); $v } +$matchingRuntimes = $installedRuntimes |? { IsVersionMatch -actualVersion $_ } +if (!$matchingRuntimes) { + Write-Output $false + exit 1 +} + +Write-Output $true +exit 0 diff --git a/tools/Check-DotNetSdk.ps1 b/tools/Check-DotNetSdk.ps1 new file mode 100644 index 00000000..9d080f75 --- /dev/null +++ b/tools/Check-DotNetSdk.ps1 @@ -0,0 +1,31 @@ +<# +.SYNOPSIS + Checks whether the .NET Core SDK required by this repo is installed. +#> +[CmdletBinding()] +Param ( +) + +$dotnet = Get-Command dotnet -ErrorAction SilentlyContinue +if (!$dotnet) { + # Nothing is installed. + Write-Output $false + exit 1 +} + +# We need to set the current directory so dotnet considers the SDK required by our global.json file. +Push-Location "$PSScriptRoot\.." +try { + dotnet -h 2>&1 | Out-Null + if ($LASTEXITCODE -eq 129) { + # This error code indicates no matching SDK exists. + Write-Output $false + exit 2 + } + + # The required SDK is already installed! + Write-Output $true + exit 0 +} finally { + Pop-Location +} diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index ec66c949..f7c023e6 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -15,11 +15,14 @@ When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. +.PARAMETER Force + Installs the preferred .NET SDK and runtime versions even if compatible versions are found to already be installed. #> [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] Param ( [ValidateSet('repo','user','machine')] - [string]$InstallLocality='user' + [string]$InstallLocality='user', + [switch]$Force ) $DotNetInstallScriptRoot = "$PSScriptRoot/../obj/tools" @@ -98,15 +101,23 @@ if ($InstallLocality -eq 'machine') { $DotNetInstallDir = '/usr/share/dotnet' } else { $restartRequired = $false - if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { - Install-DotNet -Version $sdkVersion - $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + if ($Force -or (-not (& "$PSScriptRoot/Check-DotNetSdk.ps1"))) { + if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { + Install-DotNet -Version $sdkVersion + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + } + } else { + Write-Verbose "A .NET SDK version compatible with $sdkVersion is already installed." } $runtimeVersions | Get-Unique |% { - if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { - Install-DotNet -Version $_ -Runtime - $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + if ($Force -or (-not (& "$PSScriptRoot/Check-DotNetRuntime.ps1" -Version $_))) { + if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { + Install-DotNet -Version $_ -Runtime + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + } + } else { + Write-Verbose ".NET runtime $_ is already installed." } } @@ -150,21 +161,29 @@ if (-not (Test-Path $DotNetInstallScriptPath)) { $anythingInstalled = $false -if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { - $anythingInstalled = $true - Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches" +if ($Force -or (-not (& "$PSScriptRoot/Check-DotNetSdk.ps1"))) { + if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches" + } else { + Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches -DryRun" + } } else { - Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches -DryRun" + Write-Verbose "A .NET SDK version compatible with $sdkVersion is already installed." } $switches += '-Runtime','dotnet' $runtimeVersions | Get-Unique |% { - if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { - $anythingInstalled = $true - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches" + if ($Force -or (-not (& "$PSScriptRoot/Check-DotNetRuntime.ps1" -Version $_))) { + if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches" + } else { + Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches -DryRun" + } } else { - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches -DryRun" + Write-Verbose ".NET runtime $_ is already installed." } } From 1c2cb37ea5e403f058c045559bc1788d416c2bf7 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 11 Sep 2020 05:59:35 -0600 Subject: [PATCH 186/889] Install SDK to expand-template when necessary --- Expand-Template.ps1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index adc4fb11..c6ae8cba 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -15,7 +15,7 @@ The `/{guid}` path to the Azure Pipelines artifact feed to push your nuget packa .PARAMETER Squash A switch that causes all of git history to be squashed to just one initial commit for the template, and one for its expansion. #> -[CmdletBinding()] +[CmdletBinding(SupportsShouldProcess, ConfirmImpact='Medium')] Param( [Parameter(Mandatory=$true)] [string]$LibraryName, @@ -69,6 +69,15 @@ if (-not $sn) { } } +if (-not (& "$PSScriptRoot\tools\Check-DotNetSdk.ps1")) { + if ($PSCmdlet.ShouldProcess('Install .NET Core SDK?')) { + & "$PSScriptRoot\tools\Install-DotNetSdk.ps1" + } else { + Write-Error "Matching .NET Core SDK version not found. Install now?" + exit 1 + } +} + # Verify all commands we use are on the PATH ('git','dotnet') |% { if (-not (Get-Command $_ -ErrorAction SilentlyContinue)) { From 8377c641a87333da635846e2b4511900407ac1bd Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 13 Sep 2020 07:40:35 -0600 Subject: [PATCH 187/889] Catch exception thrown on some machines --- tools/Check-DotNetSdk.ps1 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/Check-DotNetSdk.ps1 b/tools/Check-DotNetSdk.ps1 index 9d080f75..6c9fa772 100644 --- a/tools/Check-DotNetSdk.ps1 +++ b/tools/Check-DotNetSdk.ps1 @@ -17,8 +17,10 @@ if (!$dotnet) { Push-Location "$PSScriptRoot\.." try { dotnet -h 2>&1 | Out-Null - if ($LASTEXITCODE -eq 129) { - # This error code indicates no matching SDK exists. + if (($LASTEXITCODE -eq 129) -or # On Linux + ($LASTEXITCODE -eq -2147450751) # On Windows + ) { + # These exit codes indicate no matching SDK exists. Write-Output $false exit 2 } @@ -26,6 +28,10 @@ try { # The required SDK is already installed! Write-Output $true exit 0 +} catch { + # I don't know why, but on some build agents (e.g. MicroBuild), an exception is thrown from the `dotnet` invocation when a match is not found. + Write-Output $false + exit 3 } finally { Pop-Location } From 69a74f8c05201c01d1771f9ea2fa528283275e0d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Sep 2020 11:46:12 -0600 Subject: [PATCH 188/889] Revert incremental install of SDKs/Runtimes The 0c212b6459c4 commit brought this optimization in, but it is buggy because an SDK or runtime might not be installed because it's at the machine level, but if another runtime is missing and installed, it sets env vars which hide the machine level ones already found, so now they need to also be installed. But they weren't, so the build would just fail. Similarly, if the script is supposed to install to the machine location and the SDK is already installed at the user location, the recent optimization would skip installing it at the machine location. --- tools/Install-DotNetSdk.ps1 | 49 ++++++++++++------------------------- 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index f7c023e6..ec66c949 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -15,14 +15,11 @@ When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. -.PARAMETER Force - Installs the preferred .NET SDK and runtime versions even if compatible versions are found to already be installed. #> [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] Param ( [ValidateSet('repo','user','machine')] - [string]$InstallLocality='user', - [switch]$Force + [string]$InstallLocality='user' ) $DotNetInstallScriptRoot = "$PSScriptRoot/../obj/tools" @@ -101,23 +98,15 @@ if ($InstallLocality -eq 'machine') { $DotNetInstallDir = '/usr/share/dotnet' } else { $restartRequired = $false - if ($Force -or (-not (& "$PSScriptRoot/Check-DotNetSdk.ps1"))) { - if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { - Install-DotNet -Version $sdkVersion - $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) - } - } else { - Write-Verbose "A .NET SDK version compatible with $sdkVersion is already installed." + if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { + Install-DotNet -Version $sdkVersion + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) } $runtimeVersions | Get-Unique |% { - if ($Force -or (-not (& "$PSScriptRoot/Check-DotNetRuntime.ps1" -Version $_))) { - if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { - Install-DotNet -Version $_ -Runtime - $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) - } - } else { - Write-Verbose ".NET runtime $_ is already installed." + if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { + Install-DotNet -Version $_ -Runtime + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) } } @@ -161,29 +150,21 @@ if (-not (Test-Path $DotNetInstallScriptPath)) { $anythingInstalled = $false -if ($Force -or (-not (& "$PSScriptRoot/Check-DotNetSdk.ps1"))) { - if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { - $anythingInstalled = $true - Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches" - } else { - Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches -DryRun" - } +if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches" } else { - Write-Verbose "A .NET SDK version compatible with $sdkVersion is already installed." + Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches -DryRun" } $switches += '-Runtime','dotnet' $runtimeVersions | Get-Unique |% { - if ($Force -or (-not (& "$PSScriptRoot/Check-DotNetRuntime.ps1" -Version $_))) { - if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { - $anythingInstalled = $true - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches" - } else { - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches -DryRun" - } + if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches" } else { - Write-Verbose ".NET runtime $_ is already installed." + Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches -DryRun" } } From 6c9781abbfcdcf0bd3001583cae8be38ab4c4903 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Sep 2020 11:34:03 -0600 Subject: [PATCH 189/889] Bump SDK to 3.1.402 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index cc9e47f2..a2e8ff9e 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.302", + "version": "3.1.402", "rollForward": "patch", "allowPrerelease": false } From b30fd8c4581092f01199563ab5f130e6e6f859f3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Sep 2020 11:55:07 -0600 Subject: [PATCH 190/889] VS default branch is now 'main' --- azure-pipelines/variables/InsertTargetBranch.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/variables/InsertTargetBranch.ps1 b/azure-pipelines/variables/InsertTargetBranch.ps1 index 67462ece..cdcc9194 100644 --- a/azure-pipelines/variables/InsertTargetBranch.ps1 +++ b/azure-pipelines/variables/InsertTargetBranch.ps1 @@ -1,2 +1,2 @@ # This is the default branch of the VS repo that we will use to insert into VS. -'master' +'main' From 1304c04d58a501d47ce335515b8aa61404a8126e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Sep 2020 14:52:20 -0600 Subject: [PATCH 191/889] Use lowercase for privateassets --- Directory.Build.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index b9f89e5a..c6652de4 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -25,8 +25,8 @@ - - + + From 35ce94a23526a98dd3b827c1c609f6a4cf9968e9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Sep 2020 14:50:01 -0600 Subject: [PATCH 192/889] Simplify Project tag --- Directory.Build.props | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index c6652de4..8bb360bf 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,4 @@ - + Debug $(MSBuildThisFileDirectory) From c406cb86fdc100dd8ace0902562701f6a0110b1f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Sep 2020 14:50:11 -0600 Subject: [PATCH 193/889] Update URL for NB.GV schema --- version.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.json b/version.json index 38da1662..a13f567b 100644 --- a/version.json +++ b/version.json @@ -1,8 +1,8 @@ { - "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", "version": "0.1-beta", "publicReleaseRefSpec": [ "^refs/heads/master$", "^refs/heads/v\\d+(?:\\.\\d+)?$" ] -} \ No newline at end of file +} From 0e61dca4a45f1acafac48c379f336f5469d0fe25 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Sep 2020 14:51:07 -0600 Subject: [PATCH 194/889] Update MicroBuild version --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 88d099b8..43443a42 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -19,7 +19,7 @@ true snupkg - 2.0.58 + 2.0.61 From 6b65934cf810450cd8e38761635acaedbaa1fbd1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Sep 2020 20:57:23 -0600 Subject: [PATCH 195/889] Add symbol archive stage and insertion pipeline Also: * make SignType more amiable to schedule triggers that are real signed. * avoid Ref12 indexing except on default branch. --- azure-pipelines.yml | 2 - azure-pipelines/artifacts/VSInsertion.ps1 | 15 ++++++ azure-pipelines/build.yml | 3 -- azure-pipelines/microbuild.after.yml | 2 +- azure-pipelines/microbuild.before.yml | 5 +- azure-pipelines/official.yml | 59 +++++++++++++++++------ azure-pipelines/variables/SignType.ps1 | 11 +++++ azure-pipelines/variables/ci_feed.ps1 | 5 +- azure-pipelines/vs-insertion.yml | 50 +++++++++++++++++++ 9 files changed, 127 insertions(+), 25 deletions(-) create mode 100644 azure-pipelines/artifacts/VSInsertion.ps1 create mode 100644 azure-pipelines/variables/SignType.ps1 create mode 100644 azure-pipelines/vs-insertion.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a8a143bb..e590031a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,5 +20,3 @@ variables: jobs: - template: azure-pipelines/build.yml - parameters: - SignType: diff --git a/azure-pipelines/artifacts/VSInsertion.ps1 b/azure-pipelines/artifacts/VSInsertion.ps1 new file mode 100644 index 00000000..9c9c4250 --- /dev/null +++ b/azure-pipelines/artifacts/VSInsertion.ps1 @@ -0,0 +1,15 @@ +# This artifact captures everything needed to insert into VS (NuGet packages, insertion metadata, etc.) + +$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") +$BuildConfiguration = $env:BUILDCONFIGURATION +if (!$BuildConfiguration) { + $BuildConfiguration = 'Debug' +} + +$PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration/NuGet" + +if (!(Test-Path $PackagesRoot)) { return } + +@{ + "$PackagesRoot" = (Get-ChildItem $PackagesRoot -Recurse) +} diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 12298dfe..b42cc549 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -2,7 +2,6 @@ parameters: - name: windowsPool type: string default: Hosted Windows 2019 with VS2019 -- name: SignType jobs: - job: Windows @@ -17,8 +16,6 @@ jobs: - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - template: microbuild.before.yml - parameters: - SignType: ${{ parameters.SignType }} - template: dotnet.yml diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 31fe8470..ca7bcac3 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -23,5 +23,5 @@ steps: /repoName:$(Build.Repository.Name) /additionalCodexArguments:-bld /additionalCodexArguments:$(Build.ArtifactStagingDirectory)/build_logs - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), ne(variables['Build.Reason'], 'PullRequest')) continueOnError: true diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index 07fadebf..b1efae6e 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -1,9 +1,6 @@ -parameters: -- name: SignType - steps: - task: MicroBuildSigningPlugin@2 inputs: - signType: ${{ parameters.SignType }} + signType: $(SignType) zipSources: false displayName: Install MicroBuild Signing Plugin diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 3126dc97..e2957470 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -11,23 +11,54 @@ trigger: - .vscode/ parameters: -- name: SignType +- name: SignTypeSelection displayName: Sign type type: string default: Test values: [ 'Test', 'Real' ] -variables: - TreatWarningsAsErrors: true - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - BuildConfiguration: Release - BuildPlatform: Any CPU - push_to_ci: true - NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages - SignType: ${{ parameters.SignType }} +stages: -jobs: -- template: build.yml - parameters: - windowsPool: VSEng-MicroBuildVS2019 - SignType: ${{ parameters.SignType }} +- stage: Build + variables: + TreatWarningsAsErrors: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + BuildConfiguration: Release + BuildPlatform: Any CPU + push_to_ci: true + NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages + SignTypeSelection: ${{ parameters.SignTypeSelection }} + + jobs: + - template: build.yml + parameters: + windowsPool: VSEng-MicroBuildVS2019 + +- stage: symbol_archive + displayName: Symbol archival + condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) + jobs: + - job: archive + pool: VSEng-ReleasePool + steps: + - download: current + artifact: Variables-Windows + displayName: Download Variables-Windows artifact + - task: PowerShell@2 + displayName: Set VSTS variables based on artifacts + inputs: + targetType: filePath + filePath: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 + - download: current + artifact: symbols-Windows + displayName: Download symbols-Windows artifact + - task: MicroBuildArchiveSymbols@1 + displayName: Archive $(SymbolsFeatureName) on Symweb + inputs: + SymbolsFeatureName: $(SymbolsFeatureName) + SymbolsSymwebProject: VS + SymbolsUncPath: \\cpvsbuild\drops\$(TeamName)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildNumber)\Symbols.Archival + SymbolsEmailContacts: vsidemicrobuild + SymbolsAgentPath: $(Pipeline.Workspace)/symbols-Windows + - task: MicroBuildCleanup@1 + displayName: Send Telemetry diff --git a/azure-pipelines/variables/SignType.ps1 b/azure-pipelines/variables/SignType.ps1 new file mode 100644 index 00000000..a2f7845e --- /dev/null +++ b/azure-pipelines/variables/SignType.ps1 @@ -0,0 +1,11 @@ +if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9') { + if ($env:BUILD_REASON -eq 'Schedule') { + 'real' + } else { + if ($env:SignTypeSelection) { + $env:SignTypeSelection + } else { + 'test' + } + } + } diff --git a/azure-pipelines/variables/ci_feed.ps1 b/azure-pipelines/variables/ci_feed.ps1 index b5530b3f..82bad79d 100644 --- a/azure-pipelines/variables/ci_feed.ps1 +++ b/azure-pipelines/variables/ci_feed.ps1 @@ -1,4 +1,7 @@ -if ($env:SIGNTYPE -eq 'Real') { +$signType = $env:SIGNTYPE +if (!$signType) { $signType = & "$PSScriptRoot/SignType.ps1" } + +if ($signType -eq 'Real') { '09d8d03c-1ac8-456e-9274-4d2364527d99' # VSIDE-RealSigned-Release } else { 'da484c78-f942-44ef-b197-99e2a1bef53c' # VSIDE-TestSigned-Release diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml new file mode 100644 index 00000000..75c54f31 --- /dev/null +++ b/azure-pipelines/vs-insertion.yml @@ -0,0 +1,50 @@ +trigger: none # We only want to trigger manually or based on resources +pr: none + +resources: + pipelines: + - pipeline: CI + source: Library # TODO: This should match the name of your CI pipeline + tags: + - Real signed + trigger: + tags: + - Real signed + - auto-insertion + +stages: +- stage: VS + displayName: VS insertion + jobs: + - deployment: insertion + pool: VSEng-ReleasePool + environment: No-Approval + strategy: + runOnce: + deploy: + steps: + - powershell: | + Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" + displayName: Set pipeline name + - template: release-deployment-prep.yml + - download: CI + artifact: VSInsertion-Windows + displayName: Download VSInsertion-Windows artifact + - task: NuGetCommand@2 + displayName: Push CoreXT packages to VS feed + inputs: + command: push + packagesToPush: $(Pipeline.Workspace)/CI/VSInsertion-windows/*.nupkg + publishVstsFeed: 97a41293-2972-4f48-8c0e-05493ae82010 + allowPackageConflicts: true + - task: MicroBuildInsertVsPayload@3 + displayName: Insert VS Payload + inputs: + TeamName: $(TeamName) + TeamEmail: $(TeamEmail) + InsertionPayloadName: $(Build.Repository.Name) $(Build.BuildNumber) + InsertionBuildPolicy: Request Perf DDRITs + AutoCompletePR: true + AutoCompleteMergeStrategy: Squash + - task: MicroBuildCleanup@1 + displayName: Send Telemetry From 3d8ca75830e89fad6a2edb545d5a011b23a73a24 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Sep 2020 21:05:02 -0600 Subject: [PATCH 196/889] Switch (back) to VSEng-RMPool This is so the pipeline can be tested on the devdiv account's "Personal" project. --- azure-pipelines/official.yml | 2 +- azure-pipelines/vs-insertion.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index e2957470..7c78b472 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -39,7 +39,7 @@ stages: condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) jobs: - job: archive - pool: VSEng-ReleasePool + pool: VSEng-RMPool steps: - download: current artifact: Variables-Windows diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 75c54f31..43ceba0a 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -17,7 +17,7 @@ stages: displayName: VS insertion jobs: - deployment: insertion - pool: VSEng-ReleasePool + pool: VSEng-RMPool environment: No-Approval strategy: runOnce: From 897c8f1ef13971edc27cdce4229c79677e18c90b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Sep 2020 21:12:49 -0600 Subject: [PATCH 197/889] Revert "Bump SDK to 3.1.402" Our MicroBuild agents do not have MSBuild 16.7 as required by this SDK. This reverts commit 6c9781abbfcdcf0bd3001583cae8be38ab4c4903. --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index a2e8ff9e..cc9e47f2 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.402", + "version": "3.1.302", "rollForward": "patch", "allowPrerelease": false } From 8988145e2fb94d742b70b0f9546496aeddf39a39 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 15 Sep 2020 06:57:38 -0600 Subject: [PATCH 198/889] Switch to VSEng-RMPool This reverts commit 3d8ca75830e89fad6a2edb545d5a011b23a73a24. --- azure-pipelines/official.yml | 2 +- azure-pipelines/vs-insertion.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 7c78b472..e2957470 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -39,7 +39,7 @@ stages: condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) jobs: - job: archive - pool: VSEng-RMPool + pool: VSEng-ReleasePool steps: - download: current artifact: Variables-Windows diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 43ceba0a..75c54f31 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -17,7 +17,7 @@ stages: displayName: VS insertion jobs: - deployment: insertion - pool: VSEng-RMPool + pool: VSEng-ReleasePool environment: No-Approval strategy: runOnce: From dab310dc23288d38578206c1f283831fd0b4cccb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 21 Sep 2020 18:34:43 -0600 Subject: [PATCH 199/889] Add CredScan and PoliCheck --- azure-pipelines/microbuild.after.yml | 2 ++ azure-pipelines/secure-development-tools.yml | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 azure-pipelines/secure-development-tools.yml diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index ca7bcac3..38f53b58 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -25,3 +25,5 @@ steps: /additionalCodexArguments:$(Build.ArtifactStagingDirectory)/build_logs condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), ne(variables['Build.Reason'], 'PullRequest')) continueOnError: true + +- template: secure-development-tools.yml diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml new file mode 100644 index 00000000..941d5b0c --- /dev/null +++ b/azure-pipelines/secure-development-tools.yml @@ -0,0 +1,11 @@ +steps: + + ### Check for checked in credentials. +- task: CredScan@3 + displayName: 'Run CredScan' + + ### Run PoliCheck to check for disallowed terms. targetType: F indicates we're searching files and folders. +- task: PoliCheck@1 + displayName: 'Run PoliCheck' + inputs: + targetType: F From 5b68e5a3a37aec9850079fb16e074eb9518ed1ac Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 21 Sep 2020 23:10:41 -0600 Subject: [PATCH 200/889] Fix SignType variable on non-Windows agents --- azure-pipelines/variables/SignType.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/variables/SignType.ps1 b/azure-pipelines/variables/SignType.ps1 index a2f7845e..0c1a335a 100644 --- a/azure-pipelines/variables/SignType.ps1 +++ b/azure-pipelines/variables/SignType.ps1 @@ -2,8 +2,8 @@ if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9') { if ($env:BUILD_REASON -eq 'Schedule') { 'real' } else { - if ($env:SignTypeSelection) { - $env:SignTypeSelection + if ($env:SIGNTYPESELECTION) { + $env:SIGNTYPESELECTION } else { 'test' } From 19da325b6bb3aa7d61195098c546e6d0ed58cf31 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 25 Sep 2020 09:24:48 -0600 Subject: [PATCH 201/889] Add `Nullable` package --- Directory.Build.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 8bb360bf..4e95413b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -24,10 +24,11 @@ + - + From e00b38d09ce88c091325e6c572b397827b146683 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 25 Sep 2020 12:26:36 -0600 Subject: [PATCH 202/889] Checkout ps1 with LF endings --- .gitattributes | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitattributes b/.gitattributes index 9b6ea624..c22a129e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,8 +3,9 @@ ############################################################################### * text=auto -# Ensure bash shell scripts use LF line endings +# Ensure shell scripts use LF line endings (linux only accepts LF) *.sh eol=lf +*.ps1 eol=lf ############################################################################### # Set default behavior for command prompt diff. @@ -20,7 +21,7 @@ # # Merging from the command prompt will add diff markers to the files if there # are conflicts (Merging from VS is not affected by the settings below, in VS -# the diff markers are never inserted). Diff markers may cause the following +# the diff markers are never inserted). Diff markers may cause the following # file extensions to fail to load in VS. An alternative would be to treat # these files as binary and thus will always conflict and require user # intervention with every merge. To do so, just uncomment the entries below @@ -49,9 +50,9 @@ ############################################################################### # diff behavior for common document formats -# +# # Convert binary document formats to text before diffing them. This feature -# is only available from the command line. Turn it on by uncommenting the +# is only available from the command line. Turn it on by uncommenting the # entries below. ############################################################################### #*.doc diff=astextplain From 4765380c9ee5f82d2622728cfb4397d93e23a265 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 30 Mar 2020 10:00:18 -0600 Subject: [PATCH 203/889] Reorder TFMs in test project This gets the default run (and only run from VS Code) to work on Linux. --- test/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Directory.Build.props b/test/Directory.Build.props index b48b5d81..2b780029 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -2,7 +2,7 @@ - net472;netcoreapp2.1;netcoreapp3.1 + netcoreapp3.1;netcoreapp2.1;net472 false true From 68153893f540a33cd449500c5ca742888928e54e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 25 Sep 2020 13:50:58 -0600 Subject: [PATCH 204/889] Add devcontainer.json Also add other supporting files so that the VS Code 'dev container' scenario and GitHub Codespaces works nicely. --- .devcontainer/Dockerfile | 8 ++++++++ .devcontainer/devcontainer.json | 16 ++++++++++++++++ .vscode/extensions.json | 4 +++- .vscode/launch.json | 14 ++++++++++++++ .vscode/tasks.json | 17 +++++++++++++++++ 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..c551ecf2 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,8 @@ +FROM mcr.microsoft.com/dotnet/core/sdk:3.1-bionic + +# Installing mono makes `dotnet test` work without errors even for net472. +# But installing it takes a long time, so it's excluded by default. +#RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +#RUN echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | tee /etc/apt/sources.list.d/mono-official-stable.list +#RUN apt-get update +#RUN DEBIAN_FRONTEND=noninteractive apt-get install -y mono-devel diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..9a86e07d --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,16 @@ +{ + "name": "Dev space", + "dockerFile": "Dockerfile", + "postCreateCommand": "./init.ps1 -InstallLocality machine", + "extensions": [ + "ms-azure-devops.azure-pipelines", + "ms-dotnettools.csharp", + "k--kato.docomment", + "editorconfig.editorconfig", + "pflannery.vscode-versionlens", + "davidanson.vscode-markdownlint", + "dotjoshjohnson.xml", + "ms-vscode-remote.remote-containers", + "ms-azuretools.vscode-docker" + ] +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json index ecda668e..4ca01616 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -9,7 +9,9 @@ "editorconfig.editorconfig", "pflannery.vscode-versionlens", "davidanson.vscode-markdownlint", - "dotjoshjohnson.xml" + "dotjoshjohnson.xml", + "ms-vscode-remote.remote-containers", + "ms-azuretools.vscode-docker" ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [] diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..a6e4859c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..67b06180 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,17 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} From e1294286706d94b02029da23aa48ab177fa8d494 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 25 Sep 2020 17:59:29 -0600 Subject: [PATCH 205/889] Honor .editorconfig in Omnisharp --- .vscode/settings.json | 5 ++++- test/Library.Tests/CalculatorTests.cs | 7 +------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index f0cafc05..00aaed88 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,8 @@ { "files.trimTrailingWhitespace": true, "files.insertFinalNewline": true, - "files.trimFinalNewlines": true + "files.trimFinalNewlines": true, + "omnisharp.enableEditorConfigSupport": true, + "omnisharp.enableImportCompletion": true, + "omnisharp.enableRoslynAnalyzers": true } diff --git a/test/Library.Tests/CalculatorTests.cs b/test/Library.Tests/CalculatorTests.cs index 84fe9a97..44e89aaa 100644 --- a/test/Library.Tests/CalculatorTests.cs +++ b/test/Library.Tests/CalculatorTests.cs @@ -1,18 +1,13 @@ // Copyright (c) COMPANY-PLACEHOLDER. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System; using Library; using Xunit; -using Xunit.Abstractions; public class CalculatorTests { - private readonly ITestOutputHelper logger; - - public CalculatorTests(ITestOutputHelper logger) + public CalculatorTests() { - this.logger = logger; } [Fact] From aed5ff61d26dc1aa77f1eeeb73ddc47a640b1c39 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 26 Sep 2020 21:07:19 -0600 Subject: [PATCH 206/889] Fix RootNamespace property to actually take effect --- test/Directory.Build.props | 1 - test/Library.Tests/Library.Tests.csproj | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 2b780029..2371a7ef 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -5,7 +5,6 @@ netcoreapp3.1;netcoreapp2.1;net472 false true - diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index ea4220b9..3565372a 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -1,5 +1,9 @@ + + + + From ed5a2c7d9c9251c19276fba9035608daf26cccff Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 28 Sep 2020 08:24:57 -0600 Subject: [PATCH 207/889] Bump MicroBuild signing plugin to v3 --- azure-pipelines/microbuild.before.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index b1efae6e..206c1879 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -1,5 +1,5 @@ steps: -- task: MicroBuildSigningPlugin@2 +- task: MicroBuildSigningPlugin@3 inputs: signType: $(SignType) zipSources: false From 41d2e5533ffdacbb6abf9555860bead64cbcd1ea Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 30 Sep 2020 17:19:25 +0000 Subject: [PATCH 208/889] Use PowerShell as the preferred terminal --- .devcontainer/devcontainer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9a86e07d..99630282 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,9 @@ { "name": "Dev space", "dockerFile": "Dockerfile", + "settings": { + "terminal.integrated.shell.linux": "/usr/bin/pwsh" + }, "postCreateCommand": "./init.ps1 -InstallLocality machine", "extensions": [ "ms-azure-devops.azure-pipelines", From fa5d1e6eacf9de4a29fdf9d429541e33d0ddc8d2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Oct 2020 16:05:42 -0500 Subject: [PATCH 209/889] Bump Nerdbank.GitVersioning from 3.2.31 to 3.3.37 (#75) Bumps [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning) from 3.2.31 to 3.3.37. - [Release notes](https://github.com/dotnet/Nerdbank.GitVersioning/releases) - [Commits](https://github.com/dotnet/Nerdbank.GitVersioning/compare/v3.2.31...v3.3.37) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 4e95413b..7fb8d826 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -27,7 +27,7 @@ - + From bfd65cceb1895c72d04008ee5bcb9abed1f4d6dc Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 20 Oct 2020 08:23:21 -0600 Subject: [PATCH 210/889] Print mono version in Azure Pipelines --- azure-pipelines/install-dependencies.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index f773f385..7563bc1f 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -7,6 +7,11 @@ steps: $AccessToken = '$(System.AccessToken)' # Avoid specifying the access token directly on the init.ps1 command line to avoid it showing up in errors .\init.ps1 -AccessToken $AccessToken ${{ parameters['initArgs'] }} -UpgradePrerequisites dotnet --info + + # Print mono version if it is present. + if (Get-Command mono -ErrorAction SilentlyContinue) { + mono --version + } displayName: Install prerequisites - powershell: azure-pipelines/variables/_pipelines.ps1 From d565e565887678c06b0fe4194944cbbe1b1565cb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 20 Oct 2020 21:41:27 -0600 Subject: [PATCH 211/889] Add auto-insertion schedule --- azure-pipelines/build.yml | 4 ++++ azure-pipelines/official.yml | 6 ++++++ azure-pipelines/schedule-only-steps.yml | 3 +++ 3 files changed, 13 insertions(+) create mode 100644 azure-pipelines/schedule-only-steps.yml diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index b42cc549..bea76aa3 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -9,6 +9,10 @@ jobs: steps: - checkout: self clean: true + + - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: + - template: schedule-only-steps.yml + - template: install-dependencies.yml - powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud' diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index e2957470..5515aa48 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -9,6 +9,12 @@ trigger: - doc/ - '*.md' - .vscode/ +#schedules: +#- cron: "0 3 * * *" # Daily @ 8 PM PST +# displayName: Daily vs-insertion +# branches: +# include: +# - microbuild parameters: - name: SignTypeSelection diff --git a/azure-pipelines/schedule-only-steps.yml b/azure-pipelines/schedule-only-steps.yml new file mode 100644 index 00000000..ad07a341 --- /dev/null +++ b/azure-pipelines/schedule-only-steps.yml @@ -0,0 +1,3 @@ +steps: +- powershell: echo "##vso[build.addbuildtag]auto-insertion" + displayName: Tag for auto-insertion From 5fdb2443f20647acb95316eaa1c39f94422a8f39 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 21 Oct 2020 07:42:32 -0600 Subject: [PATCH 212/889] Update dependencies monthly instead of weekly --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index aa48b0fe..b9b0f54a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,4 +6,4 @@ updates: - package-ecosystem: nuget directory: / schedule: - interval: weekly + interval: monthly From ae3cf160dfc211aff23cb523c7dbd0444b9e3f51 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 22 Oct 2020 08:49:32 -0600 Subject: [PATCH 213/889] Add missing release-deployment-prep.yml file --- azure-pipelines/release-deployment-prep.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 azure-pipelines/release-deployment-prep.yml diff --git a/azure-pipelines/release-deployment-prep.yml b/azure-pipelines/release-deployment-prep.yml new file mode 100644 index 00000000..6dee28e5 --- /dev/null +++ b/azure-pipelines/release-deployment-prep.yml @@ -0,0 +1,9 @@ +steps: +- download: CI + artifact: Variables-Windows + displayName: Download Variables-Windows artifact +- task: PowerShell@2 + displayName: Set VSTS variables based on artifacts + inputs: + targetType: filePath + filePath: $(Pipeline.Workspace)/CI/Variables-Windows/_pipelines.ps1 From 7468032f6778fb28ceb8d5654f2be5f70005d791 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 22 Oct 2020 08:58:32 -0600 Subject: [PATCH 214/889] Fix push to nuget.org --- azure-pipelines/release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index bfe5987c..0ef91cb3 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -58,7 +58,6 @@ stages: - download: CI artifact: deployables-Windows displayName: Download deployables-Windows artifact - patterns: 'deployables-Windows/*' - task: NuGetToolInstaller@1 displayName: Use NuGet 5.x inputs: @@ -67,6 +66,6 @@ stages: displayName: NuGet push inputs: command: push - packagesToPush: $(Pipeline.Workspace)/CI/deployables-Windows/*.nupkg + packagesToPush: $(Pipeline.Workspace)/CI/deployables-Windows/NuGet/*.nupkg nuGetFeedType: external publishFeedCredentials: # TODO: fill in service connection here From 4f2a03546774ba1f8312a2c3c8d4838aff43ca13 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 22 Oct 2020 09:05:58 -0600 Subject: [PATCH 215/889] Add release notes link to built package --- Directory.Build.props | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index 7fb8d826..7ced2673 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -41,6 +41,13 @@ + + + + + + + false true From 02211a9bc3558d0048b57fc7e5739e2f24d89753 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 22 Oct 2020 12:30:22 -0600 Subject: [PATCH 216/889] Replace company placeholder for Microsoft --- Directory.Build.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 9620269c..c6264a38 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,9 +9,9 @@ enable true - COMPANY-PLACEHOLDER - COMPANY-PLACEHOLDER - © COMPANY-PLACEHOLDER. All rights reserved. + Microsoft + Microsoft + © Microsoft Corporation. All rights reserved. MIT true true From e3e2c9ba25855d12d4a253bca72fff72bbe1e790 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 25 Oct 2020 21:22:58 -0600 Subject: [PATCH 217/889] Fix template expansion --- Expand-Template.ps1 | 13 +------------ LICENSE | 2 +- src/Library/Calculator.cs | 2 +- stylecop.json | 2 +- test/Library.Tests/CalculatorTests.cs | 2 +- 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index ca081d3b..abd7fad0 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -17,7 +17,7 @@ A switch that causes all of git history to be squashed to just one initial commi Param( [Parameter(Mandatory=$true)] [string]$LibraryName, - [Parameter(Mandatory=$true)] + [Parameter()] [string]$Author = "Microsoft Corporation", [Parameter()] [string]$CodeCovToken, @@ -127,20 +127,9 @@ try { # Replace placeholders in source files Replace-Placeholders -Path "src/$LibraryName/Calculator.cs" -Replacements @{ 'Library'=$LibraryName - 'COMPANY-PLACEHOLDER'=$Author } Replace-Placeholders -Path "test/$LibraryName.Tests/CalculatorTests.cs" -Replacements @{ 'Library'=$LibraryName - 'COMPANY-PLACEHOLDER'=$Author - } - Replace-Placeholders -Path "LICENSE" -Replacements @{ - 'COMPANY-PLACEHOLDER'=$Author - } - Replace-Placeholders -Path "stylecop.json" -Replacements @{ - 'COMPANY-PLACEHOLDER'=$Author - } - Replace-Placeholders -Path "Directory.Build.props" -Replacements @{ - 'COMPANY-PLACEHOLDER'=$Author } Replace-Placeholders -Path "README.md" -Replacements @{ "(?m)^.*\[NuGet package\][^`r`n]*"="[![NuGet package](https://img.shields.io/nuget/v/$LibraryName.svg)](https://nuget.org/packages/$LibraryName)" diff --git a/LICENSE b/LICENSE index 44122ac6..5ae193c9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) COMPANY-PLACEHOLDER +Copyright (c) Microsoft Corporation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Library/Calculator.cs b/src/Library/Calculator.cs index 9156a1a3..84da575f 100644 --- a/src/Library/Calculator.cs +++ b/src/Library/Calculator.cs @@ -1,4 +1,4 @@ -// Copyright (c) COMPANY-PLACEHOLDER. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Library diff --git a/stylecop.json b/stylecop.json index 37918949..2453d57c 100644 --- a/stylecop.json +++ b/stylecop.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", "settings": { "documentationRules": { - "companyName": "COMPANY-PLACEHOLDER", + "companyName": "Microsoft Corporation", "copyrightText": "Copyright (c) {companyName}. All rights reserved.\nLicensed under the {licenseName} license. See {licenseFile} file in the project root for full license information.", "variables": { "licenseName": "MIT", diff --git a/test/Library.Tests/CalculatorTests.cs b/test/Library.Tests/CalculatorTests.cs index 44e89aaa..cc6c0ea3 100644 --- a/test/Library.Tests/CalculatorTests.cs +++ b/test/Library.Tests/CalculatorTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) COMPANY-PLACEHOLDER. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Library; From 3df3788623a3dd622095bdb7ae1f761bd6474971 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 25 Oct 2020 21:36:40 -0600 Subject: [PATCH 218/889] Avoid warnings in Expand-Template due to line endings --- Expand-Template.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index abd7fad0..b3eb5f4f 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -92,6 +92,8 @@ try { if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } + git config core.safecrlf false # Avoid warnings when adding files with mangled line endings + # Rename project directories and solution git mv Library.sln "$LibraryName.sln" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } @@ -190,6 +192,7 @@ try { } } finally { + git config --local --unset core.safecrlf Pop-Location } From 958ffedb97ea213d52b76e04af515e31b1342eba Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 25 Oct 2020 21:36:40 -0600 Subject: [PATCH 219/889] Avoid warnings in Expand-Template due to line endings --- Expand-Template.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index c6ae8cba..d665e56a 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -96,6 +96,8 @@ try { if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } + git config core.safecrlf false # Avoid warnings when adding files with mangled line endings + # Rename project directories and solution git mv Library.sln "$LibraryName.sln" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } @@ -204,6 +206,7 @@ try { } } finally { + git config --local --unset core.safecrlf Pop-Location } From 05b332401c7545ac7c669f59defdcf796d4925e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Nov 2020 06:14:20 -0700 Subject: [PATCH 220/889] Bump Microsoft.CodeAnalysis.FxCopAnalyzers from 3.3.0 to 3.3.1 (#76) Bumps [Microsoft.CodeAnalysis.FxCopAnalyzers](https://github.com/dotnet/roslyn-analyzers) from 3.3.0 to 3.3.1. - [Release notes](https://github.com/dotnet/roslyn-analyzers/releases) - [Changelog](https://github.com/dotnet/roslyn-analyzers/blob/master/PostReleaseActivities.md) - [Commits](https://github.com/dotnet/roslyn-analyzers/compare/v3.3.0...v3.3.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 7ced2673..642fb1d7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -23,7 +23,7 @@ - + From 9c16ae2061cf5dc70b79c9cfa94bac9e95a978c8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 2 Nov 2020 09:48:52 -0700 Subject: [PATCH 221/889] Publish test symbols on failures When investigating test run failures from Azure Pipelines, symbols from test binaries may be just as important as symbols from product binaries. So publish them as pipeline artifacts as well. Also index all these symbols even in PR builds, since PR builds may fail and investigations may be required. --- azure-pipelines/Get-SymbolFiles.ps1 | 67 ++++++++++++++++++++++ azure-pipelines/artifacts/symbols.ps1 | 54 +---------------- azure-pipelines/artifacts/test_symbols.ps1 | 12 ++++ azure-pipelines/dotnet.yml | 11 +++- 4 files changed, 90 insertions(+), 54 deletions(-) create mode 100644 azure-pipelines/Get-SymbolFiles.ps1 create mode 100644 azure-pipelines/artifacts/test_symbols.ps1 diff --git a/azure-pipelines/Get-SymbolFiles.ps1 b/azure-pipelines/Get-SymbolFiles.ps1 new file mode 100644 index 00000000..bba177f1 --- /dev/null +++ b/azure-pipelines/Get-SymbolFiles.ps1 @@ -0,0 +1,67 @@ +<# +.SYNOPSIS + Collect the list of PDBs built in this repo, after converting them from portable to Windows PDBs. +.PARAMETER Path + The root path to recursively search for PDBs. +.PARAMETER Tests + A switch indicating to find test-related PDBs instead of product-only PDBs. +#> +[CmdletBinding()] +param ( + [parameter(Mandatory=$true)] + [string]$Path, + [switch]$Tests +) + +$WindowsPdbSubDirName = "symstore" + +$ActivityName = "Collecting symbols from $Path" +Write-Progress -Activity $ActivityName -CurrentOperation "Discovery PDB files" +$PDBs = Get-ChildItem -rec "$Path\*.pdb" |? { $_.FullName -notmatch "\W$WindowsPdbSubDirName\W" } + +# Filter PDBs to product OR test related. +$testregex = "unittest|tests" +if ($Tests) { + $PDBs = $PDBs |? { $_.FullName -match $testregex } +} else { + $PDBs = $PDBs |? { $_.FullName -notmatch $testregex } +} + +Write-Progress -Activity $ActivityName -CurrentOperation "De-duplicating symbols" +$PDBsByHash = @{} +$i = 0 +$PDBs |% { + Write-Progress -Activity $ActivityName -CurrentOperation "De-duplicating symbols" -PercentComplete (100 * $i / $PDBs.Length) + $hash = Get-FileHash $_ + $i++ + Add-Member -InputObject $_ -MemberType NoteProperty -Name Hash -Value $hash.Hash + Write-Output $_ +} | Sort-Object CreationTime |% { + # De-dupe based on hash. Prefer the first match so we take the first built copy. + if (-not $PDBsByHash.ContainsKey($_.Hash)) { + $PDBsByHash.Add($_.Hash, $_.FullName) + Write-Output $_ + } +} |% { + # Collect the DLLs/EXEs as well. + $dllPath = "$($_.Directory)\$($_.BaseName).dll" + $exePath = "$($_.Directory)\$($_.BaseName).exe" + if (Test-Path $dllPath) { + $BinaryImagePath = $dllPath + } elseif (Test-Path $exePath) { + $BinaryImagePath = $exePath + } + + Write-Output $BinaryImagePath + + # Convert the PDB to legacy Windows PDBs + Write-Host "Converting PDB for $_" -ForegroundColor DarkGray + $WindowsPdbDir = "$($_.Directory.FullName)\$WindowsPdbSubDirName" + if (!(Test-Path $WindowsPdbDir)) { mkdir $WindowsPdbDir | Out-Null } + & "$PSScriptRoot\Convert-PDB.ps1" -DllPath $BinaryImagePath -PdbPath $_ -OutputPath "$WindowsPdbDir\$($_.BaseName).pdb" + if ($LASTEXITCODE -ne 0) { + Write-Warning "PDB conversion of `"$_`" failed." + } + + Write-Output "$WindowsPdbDir\$($_.BaseName).pdb" +} diff --git a/azure-pipelines/artifacts/symbols.ps1 b/azure-pipelines/artifacts/symbols.ps1 index 50491368..b3451ce1 100644 --- a/azure-pipelines/artifacts/symbols.ps1 +++ b/azure-pipelines/artifacts/symbols.ps1 @@ -1,55 +1,3 @@ -Function Get-SymbolFiles { - [CmdletBinding()] - param ( - [parameter(Mandatory=$true)] - [string]$Path - ) - - $WindowsPdbSubDirName = "symstore" - - $ActivityName = "Collecting symbols from $Path" - Write-Progress -Activity $ActivityName -CurrentOperation "Discovery PDB files" - $PDBs = Get-ChildItem -rec "$Path\*.pdb" |? { $_.FullName -notmatch "unittest|tests|\W$WindowsPdbSubDirName\W" } - Write-Progress -Activity $ActivityName -CurrentOperation "De-duplicating symbols" - $PDBsByHash = @{} - $i = 0 - $PDBs |% { - Write-Progress -Activity $ActivityName -CurrentOperation "De-duplicating symbols" -PercentComplete (100 * $i / $PDBs.Length) - $hash = Get-FileHash $_ - $i++ - Add-Member -InputObject $_ -MemberType NoteProperty -Name Hash -Value $hash.Hash - Write-Output $_ - } | Sort-Object CreationTime |% { - # De-dupe based on hash. Prefer the first match so we take the first built copy. - if (-not $PDBsByHash.ContainsKey($_.Hash)) { - $PDBsByHash.Add($_.Hash, $_.FullName) - Write-Output $_ - } - } |% { - # Collect the DLLs/EXEs as well. - $dllPath = "$($_.Directory)\$($_.BaseName).dll" - $exePath = "$($_.Directory)\$($_.BaseName).exe" - if (Test-Path $dllPath) { - $BinaryImagePath = $dllPath - } elseif (Test-Path $exePath) { - $BinaryImagePath = $exePath - } - - Write-Output $BinaryImagePath - - # Convert the PDB to legacy Windows PDBs - Write-Host "Converting PDB for $_" -ForegroundColor DarkGray - $WindowsPdbDir = "$($_.Directory.FullName)\$WindowsPdbSubDirName" - if (!(Test-Path $WindowsPdbDir)) { mkdir $WindowsPdbDir | Out-Null } - & "$PSScriptRoot\..\Convert-PDB.ps1" -DllPath $BinaryImagePath -PdbPath $_ -OutputPath "$WindowsPdbDir\$($_.BaseName).pdb" - if ($LASTEXITCODE -ne 0) { - Write-Warning "PDB conversion of `"$_`" failed." - } - - Write-Output "$WindowsPdbDir\$($_.BaseName).pdb" - } -} - # This doesn't work off Windows, nor do we need to convert symbols on multiple OS agents if ($IsMacOS -or $IsLinux) { return; @@ -57,7 +5,7 @@ if ($IsMacOS -or $IsLinux) { $BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin") if (!(Test-Path $BinPath)) { return } -$symbolfiles = Get-SymbolFiles -Path $BinPath | Get-Unique +$symbolfiles = & "$PSScriptRoot\..\Get-SymbolFiles.ps1" -Path $BinPath | Get-Unique @{ "$BinPath" = $SymbolFiles; diff --git a/azure-pipelines/artifacts/test_symbols.ps1 b/azure-pipelines/artifacts/test_symbols.ps1 new file mode 100644 index 00000000..d65ad0ae --- /dev/null +++ b/azure-pipelines/artifacts/test_symbols.ps1 @@ -0,0 +1,12 @@ +# This doesn't work off Windows, nor do we need to convert symbols on multiple OS agents +if ($IsMacOS -or $IsLinux) { + return; +} + +$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin") +if (!(Test-Path $BinPath)) { return } +$symbolfiles = & "$PSScriptRoot\..\Get-SymbolFiles.ps1" -Path $BinPath -Tests | Get-Unique + +@{ + "$BinPath" = $SymbolFiles; +} diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 8f4e950f..e664ecd3 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -47,7 +47,16 @@ steps: IndexSources: false SymbolServerType: TeamServices displayName: Publish symbols to symbol server - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Agent.OS'], 'Windows_NT')) + condition: eq(variables['Agent.OS'], 'Windows_NT') # Execute on failed test runs too. Windows-only till https://github.com/microsoft/azure-pipelines-tasks/issues/13821 is fixed. + +- task: PublishSymbols@2 + inputs: + SymbolsFolder: $(Build.ArtifactStagingDirectory)/test_symbols-$(Agent.JobName) + SearchPattern: '**/*.pdb' + IndexSources: false + SymbolServerType: TeamServices + displayName: Publish test symbols to symbol server + condition: and(failed(), eq(variables['Agent.OS'], 'Windows_NT')) # Execute on failed test runs only. - bash: bash <(curl -s https://codecov.io/bash) displayName: Publish code coverage results to codecov.io From 1ba201241f4ab86578fd26e6f0489aaa620268cc Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 2 Nov 2020 11:17:29 -0700 Subject: [PATCH 222/889] Remove macOS from Azure Pipeline runs --- azure-pipelines.yml | 8 ++++++++ azure-pipelines/build.yml | 4 ++++ azure-pipelines/publish-codecoverage.yml | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 22f8b553..bba62459 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,6 +10,12 @@ trigger: - .vscode/ - .github/ +parameters: +- name: includeMacOS + displayName: Build on macOS + type: boolean + default: false # macOS is often bogged down in Azure Pipelines + variables: TreatWarningsAsErrors: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true @@ -20,3 +26,5 @@ variables: jobs: - template: azure-pipelines/build.yml + parameters: + includeMacOS: ${{ parameters.includeMacOS }} diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 186438a1..b4561394 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -1,5 +1,6 @@ parameters: windowsPool: Hosted Windows 2019 with VS2019 + includeMacOS: jobs: - job: Windows @@ -26,6 +27,7 @@ jobs: - template: expand-template.yml - job: macOS + condition: ${{ parameters.includeMacOS }} pool: vmImage: macOS-10.15 steps: @@ -50,4 +52,6 @@ jobs: parameters: initArgs: -NoRestore - template: publish-codecoverage.yml + parameters: + includeMacOS: ${{ parameters.includeMacOS }} - template: publish-deployables.yml diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index 976f0781..0112aacf 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -1,3 +1,6 @@ +parameters: + includeMacOS: + steps: - download: current artifact: coverageResults-Windows @@ -11,6 +14,7 @@ steps: artifact: coverageResults-macOS displayName: Download macOS code coverage results continueOnError: true + condition: ${{ parameters.includeMacOS }} - powershell: | dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.2.2 --configfile azure-pipelines/justnugetorg.nuget.config Copy-Item -Recurse $(Pipeline.Workspace)/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj From f0f17b4981e70505e9bf44b9c30841ba62fabd8c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 2 Nov 2020 12:50:51 -0700 Subject: [PATCH 223/889] Use scale set agent pool for official builds --- azure-pipelines/official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 5515aa48..49bbf65b 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -38,7 +38,7 @@ stages: jobs: - template: build.yml parameters: - windowsPool: VSEng-MicroBuildVS2019 + windowsPool: VSEngSS-MicroBuild2019 - stage: symbol_archive displayName: Symbol archival From d4b9a6afcd2fd37fe66be60a2ad9888a194cf53f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 3 Nov 2020 10:05:53 -0700 Subject: [PATCH 224/889] Capture binlog for test runs --- azure-pipelines/dotnet.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index e664ecd3..5c498fc9 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -10,7 +10,7 @@ steps: displayName: dotnet test -f net472 inputs: command: test - arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" + arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net472.binlog" testRunTitle: net472-$(Agent.JobName) condition: succeededOrFailed() @@ -18,7 +18,7 @@ steps: displayName: dotnet test -f netcoreapp2.1 inputs: command: test - arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" + arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_netcoreapp2.1.binlog" testRunTitle: netcoreapp2.1-$(Agent.JobName) condition: succeededOrFailed() @@ -26,7 +26,7 @@ steps: displayName: dotnet test -f netcoreapp3.1 inputs: command: test - arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" + arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_netcoreapp3.1.binlog" testRunTitle: netcoreapp3.1-$(Agent.JobName) condition: succeededOrFailed() From 9cd3529dc29a092a0e32ce3bbcbf0fe48761ae80 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 4 Nov 2020 09:06:02 -0700 Subject: [PATCH 225/889] Add InsertPropsValues.ps1 variable This gets a VS insertion to participate in the newer PackageReference too. --- azure-pipelines/variables/InsertPropsValues.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 azure-pipelines/variables/InsertPropsValues.ps1 diff --git a/azure-pipelines/variables/InsertPropsValues.ps1 b/azure-pipelines/variables/InsertPropsValues.ps1 new file mode 100644 index 00000000..05df93b7 --- /dev/null +++ b/azure-pipelines/variables/InsertPropsValues.ps1 @@ -0,0 +1,14 @@ +$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin\Packages\$env:BUILDCONFIGURATION") + +$dirsToSearch = "$BinPath\NuGet\*.nupkg" |? { Test-Path $_ } +$icv=@() +if ($dirsToSearch) { + Get-ChildItem -Path $dirsToSearch |% { + if ($_.Name -match "^(.*)\.(\d+\.\d+\.\d+(?:-.*?)?)(?:\.symbols)?\.nupkg$") { + $id = $Matches[1] + $version = $Matches[2] + } + } +} + +Write-Output ([string]::join(',',$icv)) From f29f68a9dd73bef18349510da43de5c25a2aa580 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 6 Nov 2020 15:11:24 -0700 Subject: [PATCH 226/889] Use simpler task names --- azure-pipelines/microbuild.after.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 38f53b58..6e29912b 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -1,5 +1,5 @@ steps: -- task: ms-vseng.MicroBuildShipTasks.7c429315-71ba-4cb3-94bb-f829c95f7915.MicroBuildCodesignVerify@2 +- task: MicroBuildCodesignVerify@2 displayName: Verify Signed Files inputs: TargetFolders: | @@ -9,11 +9,11 @@ steps: condition: succeededOrFailed() displayName: MicroBuild Cleanup -- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 +- task: ComponentGovernanceComponentDetection@0 displayName: Component Detection condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) -- task: Ref12.ref12-analyze-task.ref12-analyze-task.Ref12Analyze@0 +- task: Ref12Analyze@0 displayName: Ref12 (Codex) Analyze inputs: codexoutputroot: $(Build.ArtifactStagingDirectory)\Codex From c234c68d0b45e5cc621db26063c199b51b4a45fd Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 11 Nov 2020 08:51:22 -0700 Subject: [PATCH 227/889] Update to .NET 5.0.100 SDK --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index a2e8ff9e..e6e7ee5c 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.402", + "version": "5.0.100", "rollForward": "patch", "allowPrerelease": false } From d8b3fc060bc43cc9e0371a62720e2b828c72f308 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 16 Nov 2020 09:48:54 -0700 Subject: [PATCH 228/889] Adapt to GitHub's new env and path operations Fixes #79 --- azure-pipelines/variables/_pipelines.ps1 | 2 +- tools/Set-EnvVars.ps1 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/variables/_pipelines.ps1 b/azure-pipelines/variables/_pipelines.ps1 index 55299550..867b7fc8 100644 --- a/azure-pipelines/variables/_pipelines.ps1 +++ b/azure-pipelines/variables/_pipelines.ps1 @@ -17,7 +17,7 @@ # and the second that works across jobs and stages but must be fully qualified when referenced. Write-Host "##vso[task.setvariable variable=$keyCaps;isOutput=true]$($_.Value)" } elseif ($env:GITHUB_ACTIONS) { - Write-Host "::set-env name=$keyCaps::$($_.Value)" + Add-Content -Path $env:GITHUB_ENV -Value "$keyCaps=$($_.Value)" } Set-Item -Path "env:$keyCaps" -Value $_.Value } diff --git a/tools/Set-EnvVars.ps1 b/tools/Set-EnvVars.ps1 index bde2e343..3f6f86ba 100644 --- a/tools/Set-EnvVars.ps1 +++ b/tools/Set-EnvVars.ps1 @@ -52,7 +52,7 @@ $Variables.GetEnumerator() |% { Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)" } if ($env:GITHUB_ACTIONS) { - Write-Host "::set-env name=$($_.Key)::$($_.Value)" + Add-Content -Path $env:GITHUB_ENV -Value "$($_.Key)=$($_.Value)" } if ($cmdInstructions) { @@ -79,7 +79,7 @@ if ($PrependPath) { Write-Host "##vso[task.prependpath]$_" } if ($env:GITHUB_ACTIONS) { - Write-Host "::add-path::$_" + Add-Content -Path $env:GITHUB_PATH -Value $_ } $CmdEnvScript += "SET PATH=$_$pathDelimiter%PATH%" From 759f9645c2ff5385c00f7c7e7a1613fba9628f8a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 17 Nov 2020 08:45:06 -0700 Subject: [PATCH 229/889] Add .NET 5.0 as a tested runtime --- Directory.Build.props | 2 +- azure-pipelines/dotnet.yml | 8 ++++++++ test/Directory.Build.props | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 642fb1d7..ae6f905b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -24,7 +24,7 @@ - + diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 5c498fc9..34db9a40 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -30,6 +30,14 @@ steps: testRunTitle: netcoreapp3.1-$(Agent.JobName) condition: succeededOrFailed() +- task: DotNetCoreCLI@2 + displayName: dotnet test -f net5.0 + inputs: + command: test + arguments: --no-build -c $(BuildConfiguration) -f net5.0 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net5.0.binlog" + testRunTitle: net5.0-$(Agent.JobName) + condition: succeededOrFailed() + - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true displayName: Update pipeline variables based on build outputs diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 2371a7ef..4803641a 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -2,7 +2,7 @@ - netcoreapp3.1;netcoreapp2.1;net472 + net5.0;netcoreapp3.1;netcoreapp2.1;net472 false true From 80928a35fc7d1499cadfd62f3e656ccb713a3c2f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 17 Nov 2020 08:46:15 -0700 Subject: [PATCH 230/889] Update package dependencies --- Directory.Build.props | 4 ++-- test/Library.Tests/Library.Tests.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 642fb1d7..db63a189 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -24,12 +24,12 @@ - + - + diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 3565372a..ee3b3ae6 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,7 +10,7 @@ - + From 14dc279ad8ce1a6d85706ddd8aadf7bed47decbe Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 1 Dec 2020 14:53:50 -0700 Subject: [PATCH 231/889] Add stock MSFT starter files --- CODE_OF_CONDUCT.md | 9 +++++++++ SECURITY.md | 41 +++++++++++++++++++++++++++++++++++++++++ SUPPORT.md | 25 +++++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 SECURITY.md create mode 100644 SUPPORT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..f9ba8cf6 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,9 @@ +# Microsoft Open Source Code of Conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). + +Resources: + +- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) +- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..f7b89984 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,41 @@ + + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd). + + \ No newline at end of file diff --git a/SUPPORT.md b/SUPPORT.md new file mode 100644 index 00000000..8b05616f --- /dev/null +++ b/SUPPORT.md @@ -0,0 +1,25 @@ +# TODO: The maintainer of this repo has not yet edited this file + +**REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project? + +- **No CSS support:** Fill out this template with information about how to file issues and get help. +- **Yes CSS support:** Fill out an intake form at [aka.ms/spot](https://aka.ms/spot). CSS will work with/help you to determine next steps. More details also available at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). +- **Not sure?** Fill out a SPOT intake as though the answer were "Yes". CSS will help you decide. + +*Then remove this first heading from this SUPPORT.MD file before publishing your repo.* + +# Support + +## How to file issues and get help + +This project uses GitHub Issues to track bugs and feature requests. Please search the existing +issues before filing new issues to avoid duplicates. For new issues, file your bug or +feature request as a new Issue. + +For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE +FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER +CHANNEL. WHERE WILL YOU HELP PEOPLE?**. + +## Microsoft Support Policy + +Support for this **PROJECT or PRODUCT** is limited to the resources listed above. From eda964053b115e4adc55a34c70058b8d8e68eff4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 9 Dec 2020 12:52:35 -0700 Subject: [PATCH 232/889] Update MicroBuild Insert task version --- azure-pipelines/vs-insertion.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 75c54f31..90645cb2 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -37,7 +37,7 @@ stages: packagesToPush: $(Pipeline.Workspace)/CI/VSInsertion-windows/*.nupkg publishVstsFeed: 97a41293-2972-4f48-8c0e-05493ae82010 allowPackageConflicts: true - - task: MicroBuildInsertVsPayload@3 + - task: MicroBuildInsertVsPayload@4 displayName: Insert VS Payload inputs: TeamName: $(TeamName) From ee54c45f8f038d108bfbd4a1273b0f5d80553cf9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 9 Dec 2020 13:08:36 -0700 Subject: [PATCH 233/889] Remove code to push to CI The feeds it was pushing to were obsolete anyway. --- azure-pipelines/official.yml | 1 - azure-pipelines/publish-deployables.yml | 10 ---------- azure-pipelines/variables/ci_feed.ps1 | 8 -------- 3 files changed, 19 deletions(-) delete mode 100644 azure-pipelines/variables/ci_feed.ps1 diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 5515aa48..e19311a6 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -31,7 +31,6 @@ stages: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release BuildPlatform: Any CPU - push_to_ci: true NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages SignTypeSelection: ${{ parameters.SignTypeSelection }} diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml index 9cb41fc6..5a981b26 100644 --- a/azure-pipelines/publish-deployables.yml +++ b/azure-pipelines/publish-deployables.yml @@ -7,13 +7,3 @@ steps: displayName: Use NuGet 5.x inputs: versionSpec: 5.x - -- task: NuGetCommand@2 - displayName: Push packages to CI feed - inputs: - command: push - packagesToPush: $(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg - nuGetFeedType: internal - publishVstsFeed: $(ci_feed) - allowPackageConflicts: true - condition: and(succeeded(), eq(variables['push_to_ci'], 'true'), ne(variables['ci_feed'], ''), ne(variables['Build.Reason'], 'PullRequest')) diff --git a/azure-pipelines/variables/ci_feed.ps1 b/azure-pipelines/variables/ci_feed.ps1 deleted file mode 100644 index 82bad79d..00000000 --- a/azure-pipelines/variables/ci_feed.ps1 +++ /dev/null @@ -1,8 +0,0 @@ -$signType = $env:SIGNTYPE -if (!$signType) { $signType = & "$PSScriptRoot/SignType.ps1" } - -if ($signType -eq 'Real') { - '09d8d03c-1ac8-456e-9274-4d2364527d99' # VSIDE-RealSigned-Release -} else { - 'da484c78-f942-44ef-b197-99e2a1bef53c' # VSIDE-TestSigned-Release -} From 9ecac8356a944264348485e22e2fbfd9ec41cbe9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 9 Dec 2020 13:13:46 -0700 Subject: [PATCH 234/889] Update team name --- azure-pipelines/variables/TeamName.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/variables/TeamName.ps1 b/azure-pipelines/variables/TeamName.ps1 index 871749a5..d3e73642 100644 --- a/azure-pipelines/variables/TeamName.ps1 +++ b/azure-pipelines/variables/TeamName.ps1 @@ -1 +1 @@ -'VS IDE' +'VS Core' From a6ae0b843a96eeed123234e9e6e6f6f6dce469c6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 9 Dec 2020 20:25:40 -0700 Subject: [PATCH 235/889] Bring back code to support CI feeds, but just remove our existing CI feed. --- azure-pipelines/official.yml | 1 + azure-pipelines/publish-deployables.yml | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index e19311a6..5515aa48 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -31,6 +31,7 @@ stages: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release BuildPlatform: Any CPU + push_to_ci: true NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages SignTypeSelection: ${{ parameters.SignTypeSelection }} diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml index 5a981b26..9cb41fc6 100644 --- a/azure-pipelines/publish-deployables.yml +++ b/azure-pipelines/publish-deployables.yml @@ -7,3 +7,13 @@ steps: displayName: Use NuGet 5.x inputs: versionSpec: 5.x + +- task: NuGetCommand@2 + displayName: Push packages to CI feed + inputs: + command: push + packagesToPush: $(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg + nuGetFeedType: internal + publishVstsFeed: $(ci_feed) + allowPackageConflicts: true + condition: and(succeeded(), eq(variables['push_to_ci'], 'true'), ne(variables['ci_feed'], ''), ne(variables['Build.Reason'], 'PullRequest')) From 3fa4f21b2326fb79aa47ceb8c7b5e2743ff7fb7d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 9 Dec 2020 21:04:18 -0700 Subject: [PATCH 236/889] Add missing includeMacOS switch to official builds --- azure-pipelines/official.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 5515aa48..82532aa5 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -22,6 +22,10 @@ parameters: type: string default: Test values: [ 'Test', 'Real' ] +- name: includeMacOS + displayName: Build on macOS + type: boolean + default: false # macOS is often bogged down in Azure Pipelines stages: @@ -39,6 +43,7 @@ stages: - template: build.yml parameters: windowsPool: VSEng-MicroBuildVS2019 + includeMacOS: ${{ parameters.includeMacOS }} - stage: symbol_archive displayName: Symbol archival From bb90bbb9fbe6b6c69e7ea5392a7d334bf6c8286a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 9 Dec 2020 21:24:59 -0700 Subject: [PATCH 237/889] Revert team name change It breaks symbol archival --- azure-pipelines/variables/TeamName.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/variables/TeamName.ps1 b/azure-pipelines/variables/TeamName.ps1 index d3e73642..5f2822c5 100644 --- a/azure-pipelines/variables/TeamName.ps1 +++ b/azure-pipelines/variables/TeamName.ps1 @@ -1 +1,2 @@ -'VS Core' +# This value is used to craft a \\cpvsbuild\drops path for symbol archival. +'VS IDE' From 1aaddcfd2d397004c01aacd549136e06b80350bf Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 11 Dec 2020 16:16:48 -0700 Subject: [PATCH 238/889] Update code analysis --- .editorconfig | 3 +++ Directory.Build.props | 3 ++- test/.editorconfig | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 15f0b0e6..3be52e30 100644 --- a/.editorconfig +++ b/.editorconfig @@ -165,5 +165,8 @@ csharp_prefer_braces = true:silent # SA1130: Use lambda syntax dotnet_diagnostic.SA1130.severity = silent +# CA1508: Avoid dead conditional code +dotnet_diagnostic.CA1508.severity = warning + [*.sln] indent_style = tab diff --git a/Directory.Build.props b/Directory.Build.props index ae6f905b..dedb50b8 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,6 +7,7 @@ $(RepoRootPath)bin\Packages\$(Configuration)\ 8.0 enable + latest true true @@ -23,7 +24,7 @@ - + diff --git a/test/.editorconfig b/test/.editorconfig index 2abae62d..19b19171 100644 --- a/test/.editorconfig +++ b/test/.editorconfig @@ -21,6 +21,12 @@ dotnet_diagnostic.VSTHRD111.severity = none # VSTHRD200: Use Async suffix for async methods dotnet_diagnostic.VSTHRD200.severity = silent +# CA1014: Mark assemblies with CLSCompliant +dotnet_diagnostic.CA1014.severity = none + +# CA1050: Declare types in namespaces +dotnet_diagnostic.CA1050.severity = none + # CA1303: Do not pass literals as localized parameters dotnet_diagnostic.CA1303.severity = none From 3ecde23ecfbd8983ee613dee60ed2c0bfe140608 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 11 Dec 2020 16:17:45 -0700 Subject: [PATCH 239/889] Update compiler toolset This applies the fix to https://github.com/dotnet/roslyn/issues/49882 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index dedb50b8..2253d3e5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -25,7 +25,7 @@ - + From 20e22606dc0c5bd2349b1c847ea619809bbe3946 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Dec 2020 16:34:12 -0700 Subject: [PATCH 240/889] Download pdb2pdb from pkgs.dev.azure.com instead of dotnet.myget.org --- azure-pipelines/Convert-PDB.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/Convert-PDB.ps1 b/azure-pipelines/Convert-PDB.ps1 index a3212213..cfdb2369 100644 --- a/azure-pipelines/Convert-PDB.ps1 +++ b/azure-pipelines/Convert-PDB.ps1 @@ -24,7 +24,7 @@ if (-not (Test-Path $pdb2pdbpath)) { if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null } $baseDir = (Resolve-Path $baseDir).Path # Normalize it - & (& $PSScriptRoot\Get-NuGetTool.ps1) install pdb2pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://dotnet.myget.org/F/symreader-converter/api/v3/index.json | Out-Null + & (& $PSScriptRoot\Get-NuGetTool.ps1) install pdb2pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/myget-legacy/nuget/v3/index.json | Out-Null } $args = $DllPath,'/out',$OutputPath,'/nowarn','0021' From 1e98c8f2c174806de3a82ca08b3834429a641bfc Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Dec 2020 17:19:13 -0700 Subject: [PATCH 241/889] Update source and pkg id for pdb2pdb tool --- azure-pipelines/Convert-PDB.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/Convert-PDB.ps1 b/azure-pipelines/Convert-PDB.ps1 index cfdb2369..e9ecebcd 100644 --- a/azure-pipelines/Convert-PDB.ps1 +++ b/azure-pipelines/Convert-PDB.ps1 @@ -18,13 +18,13 @@ [string]$OutputPath ) - $version = '1.1.0-beta1-64128-01' + $version = '1.1.0-beta2-20115-01' $baseDir = "$PSScriptRoot\..\obj\tools" - $pdb2pdbpath = "$baseDir\pdb2pdb.$version\tools\Pdb2Pdb.exe" + $pdb2pdbpath = "$baseDir\Microsoft.DiaSymReader.Pdb2Pdb.$version\tools\Pdb2Pdb.exe" if (-not (Test-Path $pdb2pdbpath)) { if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null } $baseDir = (Resolve-Path $baseDir).Path # Normalize it - & (& $PSScriptRoot\Get-NuGetTool.ps1) install pdb2pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/myget-legacy/nuget/v3/index.json | Out-Null + & (& $PSScriptRoot\Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null } $args = $DllPath,'/out',$OutputPath,'/nowarn','0021' From e48583cdb8b5fec1e8debd747952ac6275ff6285 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 17 Dec 2020 10:45:30 -0700 Subject: [PATCH 242/889] Update to .NET Core SDK 3.1.404 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index a2e8ff9e..daed8e94 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "3.1.402", + "version": "3.1.404", "rollForward": "patch", "allowPrerelease": false } From f29842186805f5522ff168e2b4c61337c42759fd Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 18 Dec 2020 17:52:49 -0700 Subject: [PATCH 243/889] Fix display name of symbol archival task --- azure-pipelines/official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 82532aa5..692d3deb 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -64,7 +64,7 @@ stages: artifact: symbols-Windows displayName: Download symbols-Windows artifact - task: MicroBuildArchiveSymbols@1 - displayName: Archive $(SymbolsFeatureName) on Symweb + displayName: Archive symbols to Symweb inputs: SymbolsFeatureName: $(SymbolsFeatureName) SymbolsSymwebProject: VS From e36ce89e39e21d9adf14ca5e7aa4a9a684ee2701 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Jan 2021 07:27:43 -0700 Subject: [PATCH 244/889] Bump Microsoft.NET.Test.Sdk from 16.8.0 to 16.8.3 (#85) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 16.8.0 to 16.8.3. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v16.8.0...v16.8.3) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index ee3b3ae6..aef334c2 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,7 +10,7 @@ - + From c8c97da661b70635c42b56d5c3e6111f62abc448 Mon Sep 17 00:00:00 2001 From: Julien Chomarat Date: Thu, 7 Jan 2021 11:06:16 +0100 Subject: [PATCH 245/889] Remove [*.cs] Remove the second [*.cs] because it is already declared at line 122 --- .editorconfig | 2 -- 1 file changed, 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index 15f0b0e6..4937e153 100644 --- a/.editorconfig +++ b/.editorconfig @@ -160,8 +160,6 @@ csharp_new_line_before_members_in_anonymous_types = true # Blocks are allowed csharp_prefer_braces = true:silent -[*.cs] - # SA1130: Use lambda syntax dotnet_diagnostic.SA1130.severity = silent From 3639f0321c4fb5bf4153f6c84c3e91cff68b244c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 15 Jan 2021 10:32:24 -0700 Subject: [PATCH 246/889] Bump version of codesign verify task --- azure-pipelines/microbuild.after.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 6e29912b..55fee5ec 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -1,5 +1,5 @@ steps: -- task: MicroBuildCodesignVerify@2 +- task: MicroBuildCodesignVerify@3 displayName: Verify Signed Files inputs: TargetFolders: | From e47af99c1a8ba0dd97b6370d5f1b214c39e2ef67 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 15 Jan 2021 10:36:00 -0700 Subject: [PATCH 247/889] Remove protocolVersion attribute from nuget.config This isn't necessary so long as the URL ends in `/index.json`. --- nuget.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuget.config b/nuget.config index c0173d1b..68f36551 100644 --- a/nuget.config +++ b/nuget.config @@ -6,6 +6,6 @@ - + From 15802d7d14fb2b3865b27e4099ce2fd05fdf9bb4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 15 Jan 2021 12:19:50 -0700 Subject: [PATCH 248/889] Clean up trailing line endings --- SUPPORT.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SUPPORT.md b/SUPPORT.md index 8b05616f..ecbe64c0 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -10,16 +10,16 @@ # Support -## How to file issues and get help +## How to file issues and get help -This project uses GitHub Issues to track bugs and feature requests. Please search the existing -issues before filing new issues to avoid duplicates. For new issues, file your bug or +This project uses GitHub Issues to track bugs and feature requests. Please search the existing +issues before filing new issues to avoid duplicates. For new issues, file your bug or feature request as a new Issue. -For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE +For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER CHANNEL. WHERE WILL YOU HELP PEOPLE?**. -## Microsoft Support Policy +## Microsoft Support Policy Support for this **PROJECT or PRODUCT** is limited to the resources listed above. From e7e6de897b7ec8f6a442fd5ab9008d1d8993f271 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Feb 2021 20:17:53 -0700 Subject: [PATCH 249/889] Bump coverlet.msbuild from 2.9.0 to 3.0.2 (#88) Bumps [coverlet.msbuild](https://github.com/coverlet-coverage/coverlet) from 2.9.0 to 3.0.2. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/commits) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index aef334c2..72782f19 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -9,7 +9,7 @@ - + From f52b382221eba041c184e3a70268d7799f52841d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 15 Jan 2021 12:19:50 -0700 Subject: [PATCH 250/889] Clean up trailing line endings --- azure-pipelines/official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 737df08a..f2336144 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -68,7 +68,7 @@ stages: inputs: SymbolsFeatureName: $(SymbolsFeatureName) SymbolsSymwebProject: VS - SymbolsUncPath: \\cpvsbuild\drops\$(TeamName)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildNumber)\Symbols.Archival + SymbolsUncPath: \\cpvsbuild\drops\$(TeamName)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildId)\Symbols.Archival SymbolsEmailContacts: vsidemicrobuild SymbolsAgentPath: $(Pipeline.Workspace)/symbols-Windows - task: MicroBuildCleanup@1 From 17ccfd1c617c6a3eaf6c95bedc5031404fb425a0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 11 Nov 2020 08:51:22 -0700 Subject: [PATCH 251/889] Update to .NET 5.0.102 SDK --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index e6e7ee5c..b95ee4da 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.100", + "version": "5.0.102", "rollForward": "patch", "allowPrerelease": false } From 72d343729e63bc2cb098aab63e63f3a6e96d5e4d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Feb 2021 17:11:22 -0700 Subject: [PATCH 252/889] Update compilers --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 2253d3e5..c67b24ac 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -25,7 +25,7 @@ - + From fba5eed179f121b5db92185215b15af7caa73266 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Feb 2021 17:33:40 -0700 Subject: [PATCH 253/889] Rename master branch to main --- .github/workflows/build.yml | 2 +- README.md | 4 ++-- azure-pipelines.yml | 2 +- version.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9f17c23..8567b4c9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: CI on: push: branches: - - master + - main - validate/* pull_request: diff --git a/README.md b/README.md index 5424ff0a..22d1091e 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ ![NuGet package](https://img.shields.io/badge/nuget-your--package--here-yellow.svg) -[![Azure Pipelines status](https://dev.azure.com/andrewarnott/OSS/_apis/build/status/AArnott.Library.Template?branchName=master)](https://dev.azure.com/andrewarnott/OSS/_build/latest?definitionId=29&branchName=master) +[![Azure Pipelines status](https://dev.azure.com/andrewarnott/OSS/_apis/build/status/AArnott.Library.Template?branchName=main)](https://dev.azure.com/andrewarnott/OSS/_build/latest?definitionId=29&branchName=main) ![GitHub Actions status](https://github.com/aarnott/Library.Template/workflows/CI/badge.svg) -[![codecov](https://codecov.io/gh/aarnott/library.template/branch/master/graph/badge.svg)](https://codecov.io/gh/aarnott/library.template) +[![codecov](https://codecov.io/gh/aarnott/library.template/branch/main/graph/badge.svg)](https://codecov.io/gh/aarnott/library.template) ## Features diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bba62459..2e4b2c15 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,7 +1,7 @@ trigger: branches: include: - - master + - main - 'validate/*' paths: exclude: diff --git a/version.json b/version.json index a13f567b..f0da4f6a 100644 --- a/version.json +++ b/version.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", "version": "0.1-beta", "publicReleaseRefSpec": [ - "^refs/heads/master$", + "^refs/heads/main$", "^refs/heads/v\\d+(?:\\.\\d+)?$" ] } From 7d993369c0977f77c28754360781ec67b3eeedf2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Feb 2021 18:25:04 -0700 Subject: [PATCH 254/889] Bump Microsoft.CodeAnalysis.NetAnalyzers from 5.0.1 to 5.0.3 (#89) Bumps [Microsoft.CodeAnalysis.NetAnalyzers](https://github.com/dotnet/roslyn-analyzers) from 5.0.1 to 5.0.3. - [Release notes](https://github.com/dotnet/roslyn-analyzers/releases) - [Changelog](https://github.com/dotnet/roslyn-analyzers/blob/master/PostReleaseActivities.md) - [Commits](https://github.com/dotnet/roslyn-analyzers/compare/5.0.1...5.0.3) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index ecc06606..bedac7bb 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -24,7 +24,7 @@ - + From 28f1b256e7915a8889c3868cc965907fbb508dc9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Feb 2021 18:17:22 -0700 Subject: [PATCH 255/889] Consume newer PDB conversion package that is signed --- azure-pipelines/Convert-PDB.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/Convert-PDB.ps1 b/azure-pipelines/Convert-PDB.ps1 index e9ecebcd..7a20305d 100644 --- a/azure-pipelines/Convert-PDB.ps1 +++ b/azure-pipelines/Convert-PDB.ps1 @@ -18,7 +18,7 @@ [string]$OutputPath ) - $version = '1.1.0-beta2-20115-01' + $version = '1.1.0-beta2-21101-01' $baseDir = "$PSScriptRoot\..\obj\tools" $pdb2pdbpath = "$baseDir\Microsoft.DiaSymReader.Pdb2Pdb.$version\tools\Pdb2Pdb.exe" if (-not (Test-Path $pdb2pdbpath)) { From b3f2ca32e4b9139125b5075a556965731ff5bf1a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Feb 2021 18:28:51 -0700 Subject: [PATCH 256/889] Update dotnet-reportgenerator-globaltool to 4.8.5 --- azure-pipelines/publish-codecoverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index 0112aacf..d83eb64a 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -16,7 +16,7 @@ steps: continueOnError: true condition: ${{ parameters.includeMacOS }} - powershell: | - dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.2.2 --configfile azure-pipelines/justnugetorg.nuget.config + dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.8.5 --configfile azure-pipelines/justnugetorg.nuget.config Copy-Item -Recurse $(Pipeline.Workspace)/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj Write-Host "Substituting {reporoot} with $(System.DefaultWorkingDirectory)" $reports = Get-ChildItem -Recurse "$(Pipeline.Workspace)/coverage.*.cobertura.xml" From 18b5902d5ea27b3d71aed9f231e79e142ea57c8c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Feb 2021 20:58:50 -0700 Subject: [PATCH 257/889] Propagate failure to install .NET SDK --- tools/Install-DotNetSdk.ps1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index ec66c949..06710ee3 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -149,10 +149,16 @@ if (-not (Test-Path $DotNetInstallScriptPath)) { } $anythingInstalled = $false +$global:LASTEXITCODE = 0 if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { $anythingInstalled = $true Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } } else { Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches -DryRun" } @@ -163,6 +169,11 @@ $runtimeVersions | Get-Unique |% { if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { $anythingInstalled = $true Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } } else { Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches -DryRun" } From 5355f205cefddc0b46291cd02ca7e96f9df072d2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Feb 2021 21:06:04 -0700 Subject: [PATCH 258/889] Use pinned dotnet installer script This unblocks builds by working around https://github.com/dotnet/install-scripts/issues/136 --- tools/Install-DotNetSdk.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 06710ee3..83ddec87 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -134,10 +134,10 @@ if ($DotNetInstallDir) { } if ($IsMacOS -or $IsLinux) { - $DownloadUri = "https://dot.net/v1/dotnet-install.sh" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/1ebb108764c092e7a314ff3fe1388f582cbcf89a/src/dotnet-install.sh" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" } else { - $DownloadUri = "https://dot.net/v1/dotnet-install.ps1" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/1ebb108764c092e7a314ff3fe1388f582cbcf89a/src/dotnet-install.ps1" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1" } From ecc46dc8f71c838d66ca1948fd70336d1c2f2e49 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 1 Feb 2021 16:13:29 -0700 Subject: [PATCH 259/889] Consume new Microbuild package IDs --- Directory.Build.props | 4 ++-- test/Directory.Build.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index ce25ce63..4d0eff73 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -19,11 +19,11 @@ true snupkg - 2.0.61 + 2.0.65 - + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 8edee731..0f7ca578 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -8,6 +8,6 @@ - + From e4eaa925a2327ec9d23a17fb08cec013121b1352 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 5 Feb 2021 17:33:22 -0700 Subject: [PATCH 260/889] Adjust for main as default branch --- azure-pipelines/microbuild.after.yml | 2 +- azure-pipelines/official.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 55fee5ec..853b6117 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -23,7 +23,7 @@ steps: /repoName:$(Build.Repository.Name) /additionalCodexArguments:-bld /additionalCodexArguments:$(Build.ArtifactStagingDirectory)/build_logs - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'), ne(variables['Build.Reason'], 'PullRequest')) + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables['Build.Reason'], 'PullRequest')) continueOnError: true - template: secure-development-tools.yml diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index f2336144..b1cddc15 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -1,7 +1,7 @@ trigger: branches: include: - - master + - main - microbuild - 'validate/*' paths: From 2152fb59ab19d37691ff3fe9ac0df58cf433d921 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 5 Feb 2021 19:53:57 -0700 Subject: [PATCH 261/889] Update LangVersion to 9 Also update StyleCop. --- Directory.Build.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index bedac7bb..0281d8ab 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,7 +5,7 @@ $(RepoRootPath)obj\$(MSBuildProjectName)\ $(RepoRootPath)bin\$(MSBuildProjectName)\ $(RepoRootPath)bin\Packages\$(Configuration)\ - 8.0 + 9.0 enable latest true @@ -30,7 +30,7 @@ - + From a64ebcc0e9965c8b5119c79807f5b47bcfd8e96e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 8 Feb 2021 08:29:48 -0700 Subject: [PATCH 262/889] Update .NET installer script This may help with curl failures, as described in https://github.com/dotnet/install-scripts/issues/139 --- tools/Install-DotNetSdk.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 83ddec87..132c374e 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -134,10 +134,10 @@ if ($DotNetInstallDir) { } if ($IsMacOS -or $IsLinux) { - $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/1ebb108764c092e7a314ff3fe1388f582cbcf89a/src/dotnet-install.sh" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/7a9d5dcab92cf131fc2d8977052f8c2c2d540e22/src/dotnet-install.sh" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" } else { - $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/1ebb108764c092e7a314ff3fe1388f582cbcf89a/src/dotnet-install.ps1" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/7a9d5dcab92cf131fc2d8977052f8c2c2d540e22/src/dotnet-install.ps1" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1" } From 0cfb17c6eb4955b5c96830af3ee364b24b8944e8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Feb 2021 17:41:12 -0700 Subject: [PATCH 263/889] Secure nuget packages to require signatures by known parties --- azure-pipelines/official.yml | 3 +++ nuget.config | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index b1cddc15..d00f13df 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -27,6 +27,9 @@ parameters: type: boolean default: false # macOS is often bogged down in Azure Pipelines +variables: + NugetSecurityAnalysisWarningLevel: none # nuget.config requires signed packages by trusted owners + stages: - stage: Build diff --git a/nuget.config b/nuget.config index 57d03218..90f832a9 100644 --- a/nuget.config +++ b/nuget.config @@ -1,7 +1,8 @@ - + + @@ -13,4 +14,13 @@ + + + Microsoft;xunit;manuel.roemer;sharwell;jamesnk;aarnott;MarcoRossignoli;Thecentury + + + + + + From 791accaddbc87f2a06675d7620c849bc0a15a605 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 18 Feb 2021 15:55:28 -0700 Subject: [PATCH 264/889] Embed PDBs for all local builds --- Directory.Build.props | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index 0281d8ab..836dd521 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -10,6 +10,9 @@ latest true + + embedded + true $(MSBuildThisFileDirectory)\strongname.snk From c463b89ca7a0edd3c8024420f3559b024126f8c7 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 Feb 2021 10:20:37 -0700 Subject: [PATCH 265/889] Produce ref assembly for better incremental build Referencing projects don't need to recompile if the public API of a referenced project does not change. --- Directory.Build.props | 1 + 1 file changed, 1 insertion(+) diff --git a/Directory.Build.props b/Directory.Build.props index 836dd521..081e4cfa 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,6 +9,7 @@ enable latest true + true embedded From af7742d884fdbed4e517da5bb9c62365746f5d19 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 24 Feb 2021 09:51:59 -0700 Subject: [PATCH 266/889] Use `dotnet build` for official builds --- azure-pipelines/dotnet.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 51d35eed..958154a0 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -1,20 +1,9 @@ steps: -# We use VSBuild instead of "dotnet build" on Windows where MicroBuild tasks have to run (since they don't support MSBuild Core yet). -- task: VSBuild@1 - displayName: Build Visual Studio solution - inputs: - msbuildArgs: /t:build,pack /m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/msbuild.binlog" - platform: Any CPU - configuration: $(BuildConfiguration) - condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - - script: dotnet build --no-restore -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" displayName: dotnet build - condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) - script: dotnet pack --no-build -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/pack.binlog" displayName: dotnet pack - condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) - task: DotNetCoreCLI@2 displayName: dotnet test -f net472 From c24318f044150c84e25c12d3240dddcfb9b509d8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 24 Feb 2021 09:52:16 -0700 Subject: [PATCH 267/889] Update to .NET SDK 5.0.103 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index b95ee4da..24c50bd3 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.102", + "version": "5.0.103", "rollForward": "patch", "allowPrerelease": false } From fb488e6cd9acbf391f24db08cdbb51f2d0826113 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 24 Feb 2021 09:52:51 -0700 Subject: [PATCH 268/889] Sort PackageReference items --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 72782f19..8da18927 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -11,8 +11,8 @@ - + From 1a1917e0cdf8fb1afac30641c52b2866f334f58f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 24 Feb 2021 09:57:51 -0700 Subject: [PATCH 269/889] Remove dead build authoring --- azure-pipelines/build.yml | 1 - azure-pipelines/publish-deployables.yml | 19 ------------------- 2 files changed, 20 deletions(-) delete mode 100644 azure-pipelines/publish-deployables.yml diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 764820fd..51e1fe31 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -65,4 +65,3 @@ jobs: - template: publish-codecoverage.yml parameters: includeMacOS: ${{ parameters.includeMacOS }} - - template: publish-deployables.yml diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml deleted file mode 100644 index 9cb41fc6..00000000 --- a/azure-pipelines/publish-deployables.yml +++ /dev/null @@ -1,19 +0,0 @@ -steps: -- download: current - displayName: Download deployables - artifact: deployables-Windows - -- task: NuGetToolInstaller@1 - displayName: Use NuGet 5.x - inputs: - versionSpec: 5.x - -- task: NuGetCommand@2 - displayName: Push packages to CI feed - inputs: - command: push - packagesToPush: $(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg - nuGetFeedType: internal - publishVstsFeed: $(ci_feed) - allowPackageConflicts: true - condition: and(succeeded(), eq(variables['push_to_ci'], 'true'), ne(variables['ci_feed'], ''), ne(variables['Build.Reason'], 'PullRequest')) From a568829bc239d746133f05200936a1074627a9ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Mar 2021 09:19:46 -0700 Subject: [PATCH 270/889] Bump Microsoft.NET.Test.Sdk from 16.8.3 to 16.9.1 (#95) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 16.8.3 to 16.9.1. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v16.8.3...v16.9.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 8da18927..b1728e23 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,7 +10,7 @@ - + From bf34bea3b0d8cb04c617fa82a2b4bbd487e6ebaa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Mar 2021 16:42:18 +0000 Subject: [PATCH 271/889] Bump coverlet.msbuild from 3.0.2 to 3.0.3 (#94) --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index b1728e23..5a37213f 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -9,7 +9,7 @@ - + From 1c04816f75df76aefb8cfdb9f61865de2104ff92 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Apr 2021 10:09:48 -0600 Subject: [PATCH 272/889] Bump Microsoft.Net.Compilers.Toolset from 3.9.0-3.final to 3.9.0 (#96) Bumps [Microsoft.Net.Compilers.Toolset](https://github.com/dotnet/roslyn) from 3.9.0-3.final to 3.9.0. - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/main/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits/v3.9.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 081e4cfa..df9e2a69 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -29,7 +29,7 @@ - + From 1685f22a5954a7ffd5b83ab4a85769551a27dc5c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 10 Apr 2021 06:51:29 -0600 Subject: [PATCH 273/889] Bump .NET SDK to 5.0.201 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 24c50bd3..e8e7c67e 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.103", + "version": "5.0.201", "rollForward": "patch", "allowPrerelease": false } From 98156ca3cad1a3095df9b061df4adaa4fe8bbc62 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 27 Apr 2021 08:35:25 -0600 Subject: [PATCH 274/889] Fix local pack builds Local dev boxes were failing to build the `pack` target because symbols are now embedded into the assembly in that configuration and thus there were no pdb files to include in the snupkg file. --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index df9e2a69..ad5589bf 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -23,7 +23,7 @@ MIT true true - true + true snupkg From 00cc0d4cdc0cade1e1ef311b63ed36c5f9293fb0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 27 Apr 2021 08:35:42 -0600 Subject: [PATCH 275/889] Bump .NET SDK to 5.0.202 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index e8e7c67e..728ab674 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.201", + "version": "5.0.202", "rollForward": "patch", "allowPrerelease": false } From 70e32877551294b242d2cabb89ffb955944ffcb0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 27 Apr 2021 08:18:59 -0600 Subject: [PATCH 276/889] Fix InsertPropsValues.ps1 --- azure-pipelines/variables/InsertPropsValues.ps1 | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/azure-pipelines/variables/InsertPropsValues.ps1 b/azure-pipelines/variables/InsertPropsValues.ps1 index 05df93b7..8d1e70a1 100644 --- a/azure-pipelines/variables/InsertPropsValues.ps1 +++ b/azure-pipelines/variables/InsertPropsValues.ps1 @@ -1,14 +1,2 @@ -$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin\Packages\$env:BUILDCONFIGURATION") - -$dirsToSearch = "$BinPath\NuGet\*.nupkg" |? { Test-Path $_ } -$icv=@() -if ($dirsToSearch) { - Get-ChildItem -Path $dirsToSearch |% { - if ($_.Name -match "^(.*)\.(\d+\.\d+\.\d+(?:-.*?)?)(?:\.symbols)?\.nupkg$") { - $id = $Matches[1] - $version = $Matches[2] - } - } -} - -Write-Output ([string]::join(',',$icv)) +# These values are commonly the same. +& "$PSScriptRoot/InsertConfigValues.ps1" From ca33a6cabf6125d561f8e80466840181d8494592 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 May 2021 18:28:42 -0600 Subject: [PATCH 277/889] Bump Microsoft.NET.Test.Sdk from 16.9.1 to 16.9.4 (#98) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 16.9.1 to 16.9.4. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v16.9.1...v16.9.4) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 5a37213f..2b8eff73 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,7 +10,7 @@ - + From aba19025767fed9e84f867e3a1efc1e6a3051e92 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 May 2021 18:28:55 -0600 Subject: [PATCH 278/889] Bump Nerdbank.GitVersioning from 3.3.37 to 3.4.194 (#97) Bumps [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning) from 3.3.37 to 3.4.194. - [Release notes](https://github.com/dotnet/Nerdbank.GitVersioning/releases) - [Commits](https://github.com/dotnet/Nerdbank.GitVersioning/compare/v3.3.37...v3.4.194) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index ad5589bf..1dc06021 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -32,7 +32,7 @@ - + From 4e2e5d5bd2d226055a91980eda9ad522602d4fa2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 3 May 2021 09:23:38 -0600 Subject: [PATCH 279/889] Trust new Microsoft/nuget certificates --- nuget.config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nuget.config b/nuget.config index 90f832a9..d9f432e1 100644 --- a/nuget.config +++ b/nuget.config @@ -18,9 +18,11 @@ Microsoft;xunit;manuel.roemer;sharwell;jamesnk;aarnott;MarcoRossignoli;Thecentury + + From 679db2a7343675e138cb42469f227fe335668ed5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 12 May 2021 07:55:17 -0600 Subject: [PATCH 280/889] Handle 4-integer package versions in InsertConfigValues.ps1 --- azure-pipelines/variables/InsertConfigValues.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/variables/InsertConfigValues.ps1 b/azure-pipelines/variables/InsertConfigValues.ps1 index 1455a5b7..eaf00327 100644 --- a/azure-pipelines/variables/InsertConfigValues.ps1 +++ b/azure-pipelines/variables/InsertConfigValues.ps1 @@ -3,7 +3,7 @@ $BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin\Packages\$env: $icv=@() if (Test-Path "$BinPath") { Get-ChildItem -Path "$BinPath\*.nupkg" -rec |% { - if ($_.Name -match "^(.*)\.(\d+\.\d+\.\d+(?:-.*?)?)(?:\.symbols)?\.nupkg$") { + if ($_.Name -match "^(.*?)\.(\d+\.\d+\.\d+(?:\.\d+)?(?:-.*?)?)(?:\.symbols)?\.nupkg$") { $id = $Matches[1] $version = $Matches[2] $icv += "$id=$version" From d3d35b668d08a2852bdd224c4f695d8b8e677605 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 15 May 2021 17:45:08 -0600 Subject: [PATCH 281/889] Add support for windowsdesktop runtimes to Install-DotNetSdk.ps1 script --- tools/Install-DotNetSdk.ps1 | 44 ++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 132c374e..3afca0ee 100755 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -31,17 +31,25 @@ $sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1 # Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them. $runtimeVersions = @() +$windowsDesktopRuntimeVersions = @() Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$PSScriptRoot\..\Directory.Build.props" -Recurse |% { $projXml = [xml](Get-Content -Path $_) - $targetFrameworks = $projXml.Project.PropertyGroup.TargetFramework - if (!$targetFrameworks) { - $targetFrameworks = $projXml.Project.PropertyGroup.TargetFrameworks - if ($targetFrameworks) { - $targetFrameworks = $targetFrameworks -Split ';' + $pg = $projXml.Project.PropertyGroup + if ($pg) { + $targetFrameworks = $pg.TargetFramework + if (!$targetFrameworks) { + $targetFrameworks = $pg.TargetFrameworks + if ($targetFrameworks) { + $targetFrameworks = $targetFrameworks -Split ';' + } } } $targetFrameworks |? { $_ -match 'netcoreapp(\d+\.\d+)' } |% { - $runtimeVersions += $Matches[1] + $v = $Matches[1] + $runtimeVersions += $v + if ($v -ge '3.0' -and -not ($IsMacOS -or $IsLinux)) { + $windowsDesktopRuntimeVersions += $v + } } } @@ -163,19 +171,35 @@ if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches -DryRun" } -$switches += '-Runtime','dotnet' +$dotnetRuntimeSwitches = $switches + '-Runtime','dotnet' -$runtimeVersions | Get-Unique |% { +$runtimeVersions | Sort-Object -Unique |% { if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { $anythingInstalled = $true - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches" + Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $dotnetRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $dotnetRuntimeSwitches -DryRun" + } +} + +$windowsDesktopRuntimeSwitches = $switches + '-Runtime','windowsdesktop' + +$windowsDesktopRuntimeVersions | Sort-Object -Unique |% { + if ($PSCmdlet.ShouldProcess(".NET Core WindowsDesktop runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $windowsDesktopRuntimeSwitches" if ($LASTEXITCODE -ne 0) { Write-Error ".NET SDK installation failure: $LASTEXITCODE" exit $LASTEXITCODE } } else { - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $switches -DryRun" + Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $windowsDesktopRuntimeSwitches -DryRun" } } From f62b3815de957cae7e1f99376215fbec4fab84f0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 29 May 2021 09:21:55 -0600 Subject: [PATCH 282/889] Unpack xml doc files with nupkg for better Intellisense When using devcontainer for development, the xml files were not getting unpacked due to an environment variable being set in the docker container. This reverts that. Workaround for https://github.com/dotnet/dotnet-docker/issues/2790 --- .devcontainer/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c551ecf2..40e736b3 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -6,3 +6,8 @@ FROM mcr.microsoft.com/dotnet/core/sdk:3.1-bionic #RUN echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | tee /etc/apt/sources.list.d/mono-official-stable.list #RUN apt-get update #RUN DEBIAN_FRONTEND=noninteractive apt-get install -y mono-devel + +# Clear the NUGET_XMLDOC_MODE env var so xml api doc files get unpacked, allowing a rich experience in Intellisense. +# See https://github.com/dotnet/dotnet-docker/issues/2790 for a discussion on this, where the prioritized use case +# was *not* devcontainers, sadly. +ENV NUGET_XMLDOC_MODE= From 8644f535701be9be5f1f6b92fb5f10c566272394 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 29 May 2021 09:28:27 -0600 Subject: [PATCH 283/889] Update devcontainer base image to match global.json This leads to faster devcontainer creation times because init.ps1 can skip the SDK installation step. --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 40e736b3..4e770766 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/core/sdk:3.1-bionic +FROM mcr.microsoft.com/dotnet/sdk:5.0.202-focal # Installing mono makes `dotnet test` work without errors even for net472. # But installing it takes a long time, so it's excluded by default. From ee7f2ebc84a391f77229dce0d76878940b0b4c59 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 29 May 2021 09:48:29 -0600 Subject: [PATCH 284/889] Add powershell extension to devcontainer.json --- .devcontainer/devcontainer.json | 3 ++- .editorconfig | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 99630282..f4e3b31a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,6 +14,7 @@ "davidanson.vscode-markdownlint", "dotjoshjohnson.xml", "ms-vscode-remote.remote-containers", - "ms-azuretools.vscode-docker" + "ms-azuretools.vscode-docker", + "ms-vscode.powershell" ] } diff --git a/.editorconfig b/.editorconfig index 01feb97f..3f5b80ac 100644 --- a/.editorconfig +++ b/.editorconfig @@ -30,6 +30,7 @@ indent_size = 2 # JSON files [*.json] indent_size = 2 +indent_style = space # Dotnet code style settings: [*.{cs,vb}] From 7a23e0daa9c0179205aed56bab82e5dd5df75d24 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 29 May 2021 19:05:50 -0600 Subject: [PATCH 285/889] Fixes the Install-DotNetSdk.ps1 script when the path to the repo contains spaces (#100) --- tools/Install-DotNetSdk.ps1 | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) mode change 100755 => 100644 tools/Install-DotNetSdk.ps1 diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 old mode 100755 new mode 100644 index 3afca0ee..91399997 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -136,16 +136,16 @@ if ($InstallLocality -eq 'machine') { Write-Host "Installing .NET Core SDK and runtimes to $DotNetInstallDir" -ForegroundColor Blue if ($DotNetInstallDir) { - $switches += '-InstallDir',$DotNetInstallDir + $switches += '-InstallDir',"`"$DotNetInstallDir`"" $envVars['DOTNET_MULTILEVEL_LOOKUP'] = '0' $envVars['DOTNET_ROOT'] = $DotNetInstallDir } if ($IsMacOS -or $IsLinux) { - $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/7a9d5dcab92cf131fc2d8977052f8c2c2d540e22/src/dotnet-install.sh" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/49d5da7f7d313aa65d24fe95cc29767faef553fd/src/dotnet-install.sh" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" } else { - $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/7a9d5dcab92cf131fc2d8977052f8c2c2d540e22/src/dotnet-install.ps1" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/49d5da7f7d313aa65d24fe95cc29767faef553fd/src/dotnet-install.ps1" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1" } @@ -156,19 +156,24 @@ if (-not (Test-Path $DotNetInstallScriptPath)) { } } +# In case the script we invoke is in a directory with spaces, wrap it with single quotes. +# In case the path includes single quotes, escape them. +$DotNetInstallScriptPathExpression = $DotNetInstallScriptPath.Replace("'", "''") +$DotNetInstallScriptPathExpression = "& '$DotNetInstallScriptPathExpression'" + $anythingInstalled = $false $global:LASTEXITCODE = 0 if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { $anythingInstalled = $true - Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion $switches" if ($LASTEXITCODE -ne 0) { Write-Error ".NET SDK installation failure: $LASTEXITCODE" exit $LASTEXITCODE } } else { - Invoke-Expression -Command "$DotNetInstallScriptPath -Version $sdkVersion $switches -DryRun" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion $switches -DryRun" } $dotnetRuntimeSwitches = $switches + '-Runtime','dotnet' @@ -176,14 +181,14 @@ $dotnetRuntimeSwitches = $switches + '-Runtime','dotnet' $runtimeVersions | Sort-Object -Unique |% { if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { $anythingInstalled = $true - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $dotnetRuntimeSwitches" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $dotnetRuntimeSwitches" if ($LASTEXITCODE -ne 0) { Write-Error ".NET SDK installation failure: $LASTEXITCODE" exit $LASTEXITCODE } } else { - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $dotnetRuntimeSwitches -DryRun" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $dotnetRuntimeSwitches -DryRun" } } @@ -192,14 +197,14 @@ $windowsDesktopRuntimeSwitches = $switches + '-Runtime','windowsdesktop' $windowsDesktopRuntimeVersions | Sort-Object -Unique |% { if ($PSCmdlet.ShouldProcess(".NET Core WindowsDesktop runtime $_", "Install")) { $anythingInstalled = $true - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $windowsDesktopRuntimeSwitches" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $windowsDesktopRuntimeSwitches" if ($LASTEXITCODE -ne 0) { Write-Error ".NET SDK installation failure: $LASTEXITCODE" exit $LASTEXITCODE } } else { - Invoke-Expression -Command "$DotNetInstallScriptPath -Channel $_ $windowsDesktopRuntimeSwitches -DryRun" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $windowsDesktopRuntimeSwitches -DryRun" } } From 30c95ce6bfce68ed827ec86eace746cca6f3af8d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Jun 2021 07:05:02 -0600 Subject: [PATCH 286/889] Bump Microsoft.NET.Test.Sdk from 16.9.4 to 16.10.0 (#101) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 16.9.4 to 16.10.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v16.9.4...v16.10.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 2b8eff73..38e325ac 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,7 +10,7 @@ - + From 7c90eadbe31ccbf681c4f61a8002d93cef712ba5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Jun 2021 13:20:30 +0000 Subject: [PATCH 287/889] Bump Nerdbank.GitVersioning from 3.4.194 to 3.4.205 (#103) --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 1dc06021..3282b795 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -32,7 +32,7 @@ - + From fc1faae5f71bb2f7e4fa9cafef565617756b78d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Jun 2021 13:31:36 +0000 Subject: [PATCH 288/889] Bump Microsoft.NETFramework.ReferenceAssemblies from 1.0.0 to 1.0.2 (#102) --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 3282b795..d375bb2b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -30,7 +30,7 @@ - + From 2f9ae16d7de3980d88b3ca5af327f2f24bc0b483 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 15 Jun 2021 15:57:41 -0600 Subject: [PATCH 289/889] Update StyleCop.Analyzers to 1.2.0-beta.333 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index d375bb2b..7ea3c86b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -34,7 +34,7 @@ - + From 29e05c03fb75ff4f5b6422edc171cad77b13c860 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 21 Jun 2021 08:32:15 -0600 Subject: [PATCH 290/889] Run IDExxxx analyzers in the build This helps the repo stay clean so users don't see a bunch of warnings in the error list when they open the solution from a team branch. --- Directory.Build.props | 1 + 1 file changed, 1 insertion(+) diff --git a/Directory.Build.props b/Directory.Build.props index 7ea3c86b..bcc5a80d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -8,6 +8,7 @@ 9.0 enable latest + true true true From ce744862270a6515fae669bf84e7495e134b61d6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 21 Jun 2021 08:33:56 -0600 Subject: [PATCH 291/889] Update Nerdbank.GitVersioning to 3.4.216 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index bcc5a80d..bb311c67 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -33,7 +33,7 @@ - + From 68f4b7f1e1e0034f226f37722724a64d7af6723e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 21 Jun 2021 08:35:32 -0600 Subject: [PATCH 292/889] Update Microsoft.Net.Compilers.Toolset to 3.10.0 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index bb311c67..88b2e583 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -30,7 +30,7 @@ - + From 936cffbc91ed3972ceb562d37eb0275f6c0172e3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 21 Jun 2021 19:09:04 -0600 Subject: [PATCH 293/889] Workaround for microbuild plugin dependency bug --- init.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init.ps1 b/init.ps1 index ca696265..c3c5b5e5 100755 --- a/init.ps1 +++ b/init.ps1 @@ -121,6 +121,11 @@ try { $EnvVars['LocLanguages'] = "JPN" } + # This is a workaround for https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1283978 + if ($Signing -or $Setup -or $OptProf -or $Localization) { + & $InstallNuGetPkgScriptPath MicroBuild.Core.Sentinel -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + } + & "$PSScriptRoot/tools/Set-EnvVars.ps1" -Variables $EnvVars | Out-Null } catch { From e7fab6db055c5173fa1cf105e48094283923175c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 28 Jun 2021 06:59:28 -0600 Subject: [PATCH 294/889] Update Ubuntu agent on AzP to 20.04 --- azure-pipelines/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index b4561394..cd39a76a 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -18,7 +18,7 @@ jobs: - job: Linux pool: - vmImage: Ubuntu 18.04 + vmImage: Ubuntu 20.04 steps: - checkout: self clean: true @@ -43,7 +43,7 @@ jobs: - Linux - macOS pool: - vmImage: Ubuntu 18.04 + vmImage: Ubuntu 20.04 condition: succeededOrFailed() steps: - checkout: self From f1f2fce207a492f4a29ac292aa986dfca87db13d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 28 Jun 2021 08:40:45 -0600 Subject: [PATCH 295/889] Remove unused `BuildPlatform` build variable --- azure-pipelines/official.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index d00f13df..fb2ff576 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -37,7 +37,6 @@ stages: TreatWarningsAsErrors: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release - BuildPlatform: Any CPU push_to_ci: true NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages SignTypeSelection: ${{ parameters.SignTypeSelection }} From 671330c8bfdf3804d5db8932085863454d8c466a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 28 Jun 2021 12:07:48 -0600 Subject: [PATCH 296/889] Only update config/props values on inserted packages --- azure-pipelines/artifacts/VSInsertion.ps1 | 2 +- azure-pipelines/variables/InsertConfigValues.ps1 | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/azure-pipelines/artifacts/VSInsertion.ps1 b/azure-pipelines/artifacts/VSInsertion.ps1 index 9c9c4250..88cab0f8 100644 --- a/azure-pipelines/artifacts/VSInsertion.ps1 +++ b/azure-pipelines/artifacts/VSInsertion.ps1 @@ -8,7 +8,7 @@ if (!$BuildConfiguration) { $PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration/NuGet" -if (!(Test-Path $PackagesRoot)) { return } +if (!(Test-Path $PackagesRoot)) { return @{} } @{ "$PackagesRoot" = (Get-ChildItem $PackagesRoot -Recurse) diff --git a/azure-pipelines/variables/InsertConfigValues.ps1 b/azure-pipelines/variables/InsertConfigValues.ps1 index eaf00327..ddc472eb 100644 --- a/azure-pipelines/variables/InsertConfigValues.ps1 +++ b/azure-pipelines/variables/InsertConfigValues.ps1 @@ -1,9 +1,9 @@ -$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin\Packages\$env:BUILDCONFIGURATION") +$InsertedPkgs = (& "$PSScriptRoot\..\artifacts\VSInsertion.ps1") $icv=@() -if (Test-Path "$BinPath") { - Get-ChildItem -Path "$BinPath\*.nupkg" -rec |% { - if ($_.Name -match "^(.*?)\.(\d+\.\d+\.\d+(?:\.\d+)?(?:-.*?)?)(?:\.symbols)?\.nupkg$") { +foreach ($kvp in $InsertedPkgs.GetEnumerator()) { + $kvp.Value |% { + if ($_.Name -match "^(.*)\.(\d+\.\d+\.\d+(?:-.*?)?)(?:\.symbols)?\.nupkg$") { $id = $Matches[1] $version = $Matches[2] $icv += "$id=$version" From d3b2f39ccc2ed8078da4d86302ac39ee2d007d52 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 28 Jun 2021 13:28:24 -0600 Subject: [PATCH 297/889] Use NuGetAuthenticate in AzP instead of hand installation This works around microsoft/artifacts-credprovider#244 --- azure-pipelines/install-dependencies.yml | 7 ++++++- init.ps1 | 10 +++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 7563bc1f..4f848b09 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -3,9 +3,14 @@ parameters: steps: +- task: NuGetAuthenticate@0 + displayName: Authenticate NuGet feeds + inputs: + forceReinstallCredentialProvider: true + - powershell: | $AccessToken = '$(System.AccessToken)' # Avoid specifying the access token directly on the init.ps1 command line to avoid it showing up in errors - .\init.ps1 -AccessToken $AccessToken ${{ parameters['initArgs'] }} -UpgradePrerequisites + .\init.ps1 -AccessToken $AccessToken ${{ parameters['initArgs'] }} -UpgradePrerequisites -NoNuGetCredProvider dotnet --info # Print mono version if it is present. diff --git a/init.ps1 b/init.ps1 index e5aad5bf..4cf910f2 100755 --- a/init.ps1 +++ b/init.ps1 @@ -20,6 +20,9 @@ Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. .PARAMETER NoPrerequisites Skips the installation of prerequisite software (e.g. SDKs, tools). +.PARAMETER NoNuGetCredProvider + Skips the installation of the NuGet credential provider. Useful in pipelines with the `NuGetAuthenticate` task, as a workaround for https://github.com/microsoft/artifacts-credprovider/issues/244. + This switch is ignored and installation is skipped when -NoPrerequisites is specified. .PARAMETER UpgradePrerequisites Takes time to install prerequisites even if they are already present in case they need to be upgraded. No effect if -NoPrerequisites is specified. @@ -35,6 +38,8 @@ Param ( [Parameter()] [switch]$NoPrerequisites, [Parameter()] + [switch]$NoNuGetCredProvider, + [Parameter()] [switch]$UpgradePrerequisites, [Parameter()] [switch]$NoRestore, @@ -45,7 +50,10 @@ Param ( $EnvVars = @{} if (!$NoPrerequisites) { - & "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken -Force:$UpgradePrerequisites + if (!$NoNuGetCredProvider) { + & "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken -Force:$UpgradePrerequisites + } + & "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality if ($LASTEXITCODE -eq 3010) { Exit 3010 From 505f36a697ae0736f029b6e9baab9b54fdd611bb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 30 Jun 2021 18:26:45 -0600 Subject: [PATCH 298/889] Update .NET SDK --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 728ab674..34eb419f 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.202", + "version": "5.0.301", "rollForward": "patch", "allowPrerelease": false } From c0e8f4210567af6799ebd6343ae59dd6e547558e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 1 Jul 2021 06:50:34 -0600 Subject: [PATCH 299/889] Use batched CI --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2e4b2c15..a1435d91 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,4 +1,5 @@ trigger: + batch: true branches: include: - main From 5459e34d9f59e153637e2c8b49fa36a39265a5ef Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 1 Jul 2021 06:50:50 -0600 Subject: [PATCH 300/889] Use batched CI --- azure-pipelines/official.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index fb2ff576..d0199759 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -1,4 +1,5 @@ trigger: + batch: true branches: include: - main From 3230021112457742dbc0a6c05f5088c19fe25156 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Jul 2021 07:19:49 -0600 Subject: [PATCH 301/889] Bump Nerdbank.GitVersioning from 3.4.216 to 3.4.220 (#106) Bumps [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning) from 3.4.216 to 3.4.220. - [Release notes](https://github.com/dotnet/Nerdbank.GitVersioning/releases) - [Commits](https://github.com/dotnet/Nerdbank.GitVersioning/compare/v3.4.216...v3.4.220) --- updated-dependencies: - dependency-name: Nerdbank.GitVersioning dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 88b2e583..d439a72c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -33,7 +33,7 @@ - + From 3a49199ce9cc05805877e6a0822e5b9e9f153804 Mon Sep 17 00:00:00 2001 From: Steve Bush Date: Sun, 25 Jul 2021 11:11:45 -0700 Subject: [PATCH 302/889] Add support for TargetFrameworks of the form netXX Add support for TargetFrameworks of the form netXX to Dotnet SDK installer script --- tools/Install-DotNetSdk.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 91399997..00772a9e 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -51,6 +51,15 @@ Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$P $windowsDesktopRuntimeVersions += $v } } + + # Add target frameworks of the form: netXX + $targetFrameworks |? { $_ -match 'net(\d+\.\d+)' } |% { + $v = $Matches[1] + $runtimeVersions += $v + if (-not ($IsMacOS -or $IsLinux)) { + $windowsDesktopRuntimeVersions += $v + } + } } Function Get-FileFromWeb([Uri]$Uri, $OutDir) { From fd43c77b00bc00d5fddf485f994a34f07313df15 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 25 Jul 2021 21:29:11 -0600 Subject: [PATCH 303/889] Update coverlet.msbuild and .NET SDK --- global.json | 2 +- test/Library.Tests/Library.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 34eb419f..d28f85bf 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.301", + "version": "5.0.302", "rollForward": "patch", "allowPrerelease": false } diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 38e325ac..660f9fb5 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -9,7 +9,7 @@ - + From 46334e874dd86736272896a33892183fdc447cf8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 28 Jul 2021 13:23:59 -0600 Subject: [PATCH 304/889] Update microbuild feed URL to the newer format --- init.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.ps1 b/init.ps1 index 3454b80a..825ce9fd 100755 --- a/init.ps1 +++ b/init.ps1 @@ -104,7 +104,7 @@ try { $InstallNuGetPkgScriptPath = ".\azure-pipelines\Install-NuGetPackage.ps1" $nugetVerbosity = 'quiet' if ($Verbose) { $nugetVerbosity = 'normal' } - $MicroBuildPackageSource = 'https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json' + $MicroBuildPackageSource = 'https://pkgs.dev.azure.com/devdiv/_packaging/MicroBuildToolset%40Local/nuget/v3/index.json' if ($Signing) { Write-Host "Installing MicroBuild signing plugin" -ForegroundColor $HeaderColor & $InstallNuGetPkgScriptPath MicroBuild.Plugins.Signing -source $MicroBuildPackageSource -Verbosity $nugetVerbosity From 70495e7db031ec433689a191f7ef6c7d31ad2ca1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 28 Jul 2021 14:38:35 -0600 Subject: [PATCH 305/889] Remove obsolete task parameter --- azure-pipelines/microbuild.before.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index 206c1879..96cd3254 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -2,5 +2,4 @@ steps: - task: MicroBuildSigningPlugin@3 inputs: signType: $(SignType) - zipSources: false displayName: Install MicroBuild Signing Plugin From 998b4dbed1cf203d8c423b13d9c5133b77f16232 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Aug 2021 07:20:04 -0600 Subject: [PATCH 306/889] Bump Nerdbank.GitVersioning from 3.4.220 to 3.4.231 (#110) Bumps [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning) from 3.4.220 to 3.4.231. - [Release notes](https://github.com/dotnet/Nerdbank.GitVersioning/releases) - [Commits](https://github.com/dotnet/Nerdbank.GitVersioning/compare/v3.4.220...v3.4.231) --- updated-dependencies: - dependency-name: Nerdbank.GitVersioning dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index d439a72c..12555245 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -33,7 +33,7 @@ - + From b1f3bdc6a226ee9385eb414ffcf2173cede3b313 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 6 Aug 2021 10:06:18 -0600 Subject: [PATCH 307/889] Enable Component Governance to PR builds (#111) It actually does something useful, and will soon be mandated. --- azure-pipelines/microbuild.after.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 853b6117..8559b27a 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -11,7 +11,6 @@ steps: - task: ComponentGovernanceComponentDetection@0 displayName: Component Detection - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - task: Ref12Analyze@0 displayName: Ref12 (Codex) Analyze From 9ce97e7830e218640dd01862305ac8b36d71aedc Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 6 Aug 2021 10:11:41 -0600 Subject: [PATCH 308/889] Remove workaround for microbuild plugin bug The bug is now fixed. --- init.ps1 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/init.ps1 b/init.ps1 index 825ce9fd..fef2cb09 100755 --- a/init.ps1 +++ b/init.ps1 @@ -129,11 +129,6 @@ try { $EnvVars['LocLanguages'] = "JPN" } - # This is a workaround for https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1283978 - if ($Signing -or $Setup -or $OptProf -or $Localization) { - & $InstallNuGetPkgScriptPath MicroBuild.Core.Sentinel -source $MicroBuildPackageSource -Verbosity $nugetVerbosity - } - & "$PSScriptRoot/tools/Set-EnvVars.ps1" -Variables $EnvVars | Out-Null } catch { From 1808050a987440698578162df0f4f077c86feb18 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 23 Aug 2021 08:51:43 -0600 Subject: [PATCH 309/889] Drop netcoreapp2.1 as a target It is no longer in its LTS lifecycle. --- azure-pipelines/dotnet.yml | 8 -------- test/Directory.Build.props | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 34db9a40..50ba58f1 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -14,14 +14,6 @@ steps: testRunTitle: net472-$(Agent.JobName) condition: succeededOrFailed() -- task: DotNetCoreCLI@2 - displayName: dotnet test -f netcoreapp2.1 - inputs: - command: test - arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_netcoreapp2.1.binlog" - testRunTitle: netcoreapp2.1-$(Agent.JobName) - condition: succeededOrFailed() - - task: DotNetCoreCLI@2 displayName: dotnet test -f netcoreapp3.1 inputs: diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 4803641a..1b45d716 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -2,7 +2,7 @@ - net5.0;netcoreapp3.1;netcoreapp2.1;net472 + net5.0;netcoreapp3.1;net472 false true From 10ed82d6504eb858dfca86b69d0b732896556e9c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 23 Aug 2021 09:11:57 -0600 Subject: [PATCH 310/889] Suppress SA1401 (private fields) in tests --- test/.editorconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/.editorconfig b/test/.editorconfig index 19b19171..8aa791be 100644 --- a/test/.editorconfig +++ b/test/.editorconfig @@ -47,3 +47,6 @@ dotnet_diagnostic.CA1816.severity = silent # CA2007: Consider calling ConfigureAwait on the awaited task dotnet_diagnostic.CA2007.severity = none + +# SA1401: Fields should be private +dotnet_diagnostic.SA1401.severity = silent From f90f4949877855b010afdff5626dd238390ceb9d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 23 Aug 2021 11:40:33 -0600 Subject: [PATCH 311/889] Touch-up on code style --- .editorconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 3f5b80ac..0689e4e0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -129,7 +129,7 @@ csharp_indent_switch_labels = true csharp_indent_labels = flush_left # Prefer "var" everywhere -csharp_style_var_for_built_in_types = true:suggestion +csharp_style_var_for_built_in_types = false csharp_style_var_when_type_is_apparent = true:suggestion csharp_style_var_elsewhere = false:warning @@ -167,5 +167,8 @@ dotnet_diagnostic.SA1130.severity = silent # CA1508: Avoid dead conditional code dotnet_diagnostic.CA1508.severity = warning +# IDE1006: Naming Styles - StyleCop handles these for us +dotnet_diagnostic.IDE1006.severity = none + [*.sln] indent_style = tab From 9cd3507c973ea9662b69928f0490e1e00ea447b9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Sep 2021 11:48:29 -0600 Subject: [PATCH 312/889] Bump Microsoft.NET.Test.Sdk from 16.10.0 to 16.11.0 (#114) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 16.10.0 to 16.11.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v16.10.0...v16.11.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 660f9fb5..c66b7aac 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,7 +10,7 @@ - + From ad83aa039c3868874a928c92aa886726a7623d2d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Sep 2021 11:48:43 -0600 Subject: [PATCH 313/889] Bump Microsoft.Net.Compilers.Toolset from 3.10.0 to 3.11.0 (#113) Bumps [Microsoft.Net.Compilers.Toolset](https://github.com/dotnet/roslyn) from 3.10.0 to 3.11.0. - [Release notes](https://github.com/dotnet/roslyn/releases) - [Changelog](https://github.com/dotnet/roslyn/blob/main/docs/Breaking%20API%20Changes.md) - [Commits](https://github.com/dotnet/roslyn/commits) --- updated-dependencies: - dependency-name: Microsoft.Net.Compilers.Toolset dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 12555245..c732a3a9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -30,7 +30,7 @@ - + From 9ac560c10f1a1e4f6397519d66956f0f8bfddc3b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 1 Sep 2021 22:36:19 -0600 Subject: [PATCH 314/889] Fix SDK installation on ARM64 --- tools/Install-DotNetSdk.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 00772a9e..67c66c1e 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -29,6 +29,9 @@ $DotNetInstallScriptRoot = Resolve-Path $DotNetInstallScriptRoot # Look up actual required .NET Core SDK version from global.json $sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1" +$arch = 'x64' +if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { $arch = 'ARM64' } + # Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them. $runtimeVersions = @() $windowsDesktopRuntimeVersions = @() @@ -51,7 +54,7 @@ Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$P $windowsDesktopRuntimeVersions += $v } } - + # Add target frameworks of the form: netXX $targetFrameworks |? { $_ -match 'net(\d+\.\d+)' } |% { $v = $Matches[1] @@ -86,7 +89,7 @@ Function Get-InstallerExe($Version, [switch]$Runtime) { $Version = $versionInfo[-1] } - Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/dotnet-$($sdkOrRuntime.ToLowerInvariant())-$Version-win-x64.exe" -OutDir "$DotNetInstallScriptRoot" + Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/dotnet-$($sdkOrRuntime.ToLowerInvariant())-$Version-win-$arch.exe" -OutDir "$DotNetInstallScriptRoot" } Function Install-DotNet($Version, [switch]$Runtime) { @@ -103,7 +106,7 @@ Function Install-DotNet($Version, [switch]$Runtime) { } $switches = @( - '-Architecture','x64' + '-Architecture',$arch ) $envVars = @{ # For locally installed dotnet, skip first time experience which takes a long time From 7e6aa52248c2b3bc5d466d39ec8518830e2b8991 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 8 Sep 2021 09:35:36 -0600 Subject: [PATCH 315/889] Switch to the VSEngSS-MicroBuild2019-1ES pool --- azure-pipelines/official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index d0199759..38ea7124 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -45,7 +45,7 @@ stages: jobs: - template: build.yml parameters: - windowsPool: VSEngSS-MicroBuild2019 + windowsPool: VSEngSS-MicroBuild2019-1ES includeMacOS: ${{ parameters.includeMacOS }} - stage: symbol_archive From cb6afb9d96ef72482684e0fcd4db5f5d75166920 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 8 Sep 2021 15:53:31 -0600 Subject: [PATCH 316/889] Update Microbuild version --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 7744e2b9..91ea7ecc 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -24,7 +24,7 @@ true snupkg - 2.0.65 + 2.0.66 From c70330018b2f9c772ef886819baf47537214d84e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 8 Sep 2021 15:55:41 -0600 Subject: [PATCH 317/889] Update StyleCop.Analyzers version --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index c732a3a9..277c9cde 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -35,7 +35,7 @@ - + From b2453ab34a09cfb47c3d34e8cf912af611a5283e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 8 Sep 2021 21:07:23 -0600 Subject: [PATCH 318/889] Fix position of runsettings in .editorconfig --- .editorconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index 0689e4e0..6015ff48 100644 --- a/.editorconfig +++ b/.editorconfig @@ -20,11 +20,11 @@ insert_final_newline = true trim_trailing_whitespace = true # Xml project files -[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,runsettings}] +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] indent_size = 2 # Xml config files -[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] +[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct,runsettings}] indent_size = 2 # JSON files From eba9acb28b6c66b40a14d7759365b20a9d89df0f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 9 Sep 2021 20:49:50 -0600 Subject: [PATCH 319/889] Update .NET SDK to 5.0.400 --- .devcontainer/Dockerfile | 2 +- global.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 4e770766..88949946 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0.202-focal +FROM mcr.microsoft.com/dotnet/sdk:5.0.400-focal # Installing mono makes `dotnet test` work without errors even for net472. # But installing it takes a long time, so it's excluded by default. diff --git a/global.json b/global.json index d28f85bf..9f36eab1 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.302", + "version": "5.0.400", "rollForward": "patch", "allowPrerelease": false } From e94bf29eed1dc1ba106f263e2e5ac1c27aa0c096 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 13 Sep 2021 08:59:25 -0600 Subject: [PATCH 320/889] Build on ubuntu 20.04 in Github workflows This matches what we were already doing on Azure Pipelines. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8567b4c9..1b3b6b13 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: fail-fast: false matrix: os: - - ubuntu-18.04 + - ubuntu-20.04 - macos-latest - windows-latest From 9c06ecb7ee50f4fef66dd82ff1bbe9949e3e2d31 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 13 Sep 2021 09:00:17 -0600 Subject: [PATCH 321/889] Publish variables, symbols and deployables from non-Windows agents too --- .github/workflows/build.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b3b6b13..b8499b90 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,9 +61,8 @@ jobs: - name: Upload variables uses: actions/upload-artifact@v1 with: - name: variables + name: variables-${{ runner.os }} path: obj/_artifacts/variables - if: runner.os == 'Windows' continue-on-error: true - name: Upload build_logs if: always() @@ -89,16 +88,15 @@ jobs: - name: Upload symbols uses: actions/upload-artifact@v1 with: - name: symbols + name: symbols-${{ runner.os }} path: obj/_artifacts/symbols - if: runner.os == 'Windows' continue-on-error: true - name: Upload deployables uses: actions/upload-artifact@v1 with: - name: deployables + name: deployables-${{ runner.os }} path: obj/_artifacts/deployables - if: always() && runner.os == 'Windows' + if: always() - name: Publish code coverage results to codecov.io run: bash <(curl -s https://codecov.io/bash) shell: bash From 4854ca17b0473bc9627bd457bcfcc03cfdf7e59c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 13 Sep 2021 09:30:47 -0600 Subject: [PATCH 322/889] Fix up symbol collection off-Windows --- azure-pipelines/Convert-PDB.ps1 | 12 +++++++++--- azure-pipelines/Get-SymbolFiles.ps1 | 26 ++++++++++++++------------ azure-pipelines/artifacts/symbols.ps1 | 10 ++-------- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/azure-pipelines/Convert-PDB.ps1 b/azure-pipelines/Convert-PDB.ps1 index 7a20305d..2d394e72 100644 --- a/azure-pipelines/Convert-PDB.ps1 +++ b/azure-pipelines/Convert-PDB.ps1 @@ -18,13 +18,19 @@ [string]$OutputPath ) + if ($IsMacOS -or $IsLinux) { + Write-Error "This script only works on Windows" + return + } + $version = '1.1.0-beta2-21101-01' - $baseDir = "$PSScriptRoot\..\obj\tools" - $pdb2pdbpath = "$baseDir\Microsoft.DiaSymReader.Pdb2Pdb.$version\tools\Pdb2Pdb.exe" + $baseDir = "$PSScriptRoot/../obj/tools" + $pdb2pdbpath = "$baseDir/Microsoft.DiaSymReader.Pdb2Pdb.$version/tools/Pdb2Pdb.exe" if (-not (Test-Path $pdb2pdbpath)) { if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null } $baseDir = (Resolve-Path $baseDir).Path # Normalize it - & (& $PSScriptRoot\Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null + Write-Verbose "& (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null" + & (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null } $args = $DllPath,'/out',$OutputPath,'/nowarn','0021' diff --git a/azure-pipelines/Get-SymbolFiles.ps1 b/azure-pipelines/Get-SymbolFiles.ps1 index bba177f1..45afe7c2 100644 --- a/azure-pipelines/Get-SymbolFiles.ps1 +++ b/azure-pipelines/Get-SymbolFiles.ps1 @@ -17,7 +17,7 @@ $WindowsPdbSubDirName = "symstore" $ActivityName = "Collecting symbols from $Path" Write-Progress -Activity $ActivityName -CurrentOperation "Discovery PDB files" -$PDBs = Get-ChildItem -rec "$Path\*.pdb" |? { $_.FullName -notmatch "\W$WindowsPdbSubDirName\W" } +$PDBs = Get-ChildItem -rec "$Path/*.pdb" |? { $_.FullName -notmatch "\W$WindowsPdbSubDirName\W" } # Filter PDBs to product OR test related. $testregex = "unittest|tests" @@ -44,8 +44,8 @@ $PDBs |% { } } |% { # Collect the DLLs/EXEs as well. - $dllPath = "$($_.Directory)\$($_.BaseName).dll" - $exePath = "$($_.Directory)\$($_.BaseName).exe" + $dllPath = "$($_.Directory)/$($_.BaseName).dll" + $exePath = "$($_.Directory)/$($_.BaseName).exe" if (Test-Path $dllPath) { $BinaryImagePath = $dllPath } elseif (Test-Path $exePath) { @@ -54,14 +54,16 @@ $PDBs |% { Write-Output $BinaryImagePath - # Convert the PDB to legacy Windows PDBs - Write-Host "Converting PDB for $_" -ForegroundColor DarkGray - $WindowsPdbDir = "$($_.Directory.FullName)\$WindowsPdbSubDirName" - if (!(Test-Path $WindowsPdbDir)) { mkdir $WindowsPdbDir | Out-Null } - & "$PSScriptRoot\Convert-PDB.ps1" -DllPath $BinaryImagePath -PdbPath $_ -OutputPath "$WindowsPdbDir\$($_.BaseName).pdb" - if ($LASTEXITCODE -ne 0) { - Write-Warning "PDB conversion of `"$_`" failed." - } + if (-not ($IsMacOS -or $IsLinux)) { + # Convert the PDB to legacy Windows PDBs + Write-Host "Converting PDB for $_" -ForegroundColor DarkGray + $WindowsPdbDir = "$($_.Directory.FullName)\$WindowsPdbSubDirName" + if (!(Test-Path $WindowsPdbDir)) { mkdir $WindowsPdbDir | Out-Null } + & "$PSScriptRoot\Convert-PDB.ps1" -DllPath $BinaryImagePath -PdbPath $_ -OutputPath "$WindowsPdbDir\$($_.BaseName).pdb" + if ($LASTEXITCODE -ne 0) { + Write-Warning "PDB conversion of `"$_`" failed." + } - Write-Output "$WindowsPdbDir\$($_.BaseName).pdb" + Write-Output "$WindowsPdbDir\$($_.BaseName).pdb" + } } diff --git a/azure-pipelines/artifacts/symbols.ps1 b/azure-pipelines/artifacts/symbols.ps1 index b3451ce1..8704571e 100644 --- a/azure-pipelines/artifacts/symbols.ps1 +++ b/azure-pipelines/artifacts/symbols.ps1 @@ -1,11 +1,5 @@ -# This doesn't work off Windows, nor do we need to convert symbols on multiple OS agents -if ($IsMacOS -or $IsLinux) { - return; -} - -$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin") -if (!(Test-Path $BinPath)) { return } -$symbolfiles = & "$PSScriptRoot\..\Get-SymbolFiles.ps1" -Path $BinPath | Get-Unique +$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot/../../bin") +$symbolfiles = & "$PSScriptRoot/../Get-SymbolFiles.ps1" -Path $BinPath | Get-Unique @{ "$BinPath" = $SymbolFiles; From 4438c0718d81c15796eaa4cadd96352ed436825b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 14 Sep 2021 14:27:58 -0600 Subject: [PATCH 323/889] Update to latest dotnet-install script --- tools/Install-DotNetSdk.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 67c66c1e..73dae25f 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -154,10 +154,10 @@ if ($DotNetInstallDir) { } if ($IsMacOS -or $IsLinux) { - $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/49d5da7f7d313aa65d24fe95cc29767faef553fd/src/dotnet-install.sh" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/781752509a890ca7520f1182e8bae71f9a53d754/src/dotnet-install.sh" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" } else { - $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/49d5da7f7d313aa65d24fe95cc29767faef553fd/src/dotnet-install.ps1" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/781752509a890ca7520f1182e8bae71f9a53d754/src/dotnet-install.ps1" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1" } From f220004889a1ac02ac55cafcc84b737be04f4ad1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 15 Sep 2021 07:14:15 -0600 Subject: [PATCH 324/889] Capture dumps from test hangs on Mac/Linux --- .github/workflows/Linux.runsettings | 15 ++++++++++++++- .github/workflows/macOS.runsettings | 15 ++++++++++++++- azure-pipelines/Darwin.runsettings | 15 ++++++++++++++- azure-pipelines/Linux.runsettings | 15 ++++++++++++++- azure-pipelines/artifacts/testResults.ps1 | 2 +- 5 files changed, 57 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Linux.runsettings b/.github/workflows/Linux.runsettings index b444e819..5e2244a0 100644 --- a/.github/workflows/Linux.runsettings +++ b/.github/workflows/Linux.runsettings @@ -1 +1,14 @@ - + + + + + + + + + %GITHUB_WORKSPACE% + + + + + diff --git a/.github/workflows/macOS.runsettings b/.github/workflows/macOS.runsettings index b444e819..5e2244a0 100644 --- a/.github/workflows/macOS.runsettings +++ b/.github/workflows/macOS.runsettings @@ -1 +1,14 @@ - + + + + + + + + + %GITHUB_WORKSPACE% + + + + + diff --git a/azure-pipelines/Darwin.runsettings b/azure-pipelines/Darwin.runsettings index b444e819..0b43ecb0 100644 --- a/azure-pipelines/Darwin.runsettings +++ b/azure-pipelines/Darwin.runsettings @@ -1 +1,14 @@ - + + + + + + + + + %BUILD_ARTIFACTSTAGINGDIRECTORY% + + + + + diff --git a/azure-pipelines/Linux.runsettings b/azure-pipelines/Linux.runsettings index b444e819..0b43ecb0 100644 --- a/azure-pipelines/Linux.runsettings +++ b/azure-pipelines/Linux.runsettings @@ -1 +1,14 @@ - + + + + + + + + + %BUILD_ARTIFACTSTAGINGDIRECTORY% + + + + + diff --git a/azure-pipelines/artifacts/testResults.ps1 b/azure-pipelines/artifacts/testResults.ps1 index 1e4c4c4e..7895ddca 100644 --- a/azure-pipelines/artifacts/testResults.ps1 +++ b/azure-pipelines/artifacts/testResults.ps1 @@ -2,7 +2,7 @@ if ($env:AGENT_TEMPDIRECTORY) { # The DotNetCoreCLI uses an alternate location to publish these files $guidRegex = '^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$' @{ - $env:AGENT_TEMPDIRECTORY = (Get-ChildItem $env:AGENT_TEMPDIRECTORY -Directory |? { $_.Name -match $guidRegex } |% { Get-ChildItem "$($_.FullName)\testhost*.dmp","$($_.FullName)\Sequence_*.xml" -Recurse }); + $env:AGENT_TEMPDIRECTORY = (Get-ChildItem $env:AGENT_TEMPDIRECTORY -Directory |? { $_.Name -match $guidRegex } |% { Get-ChildItem "$($_.FullName)\dotnet*.dmp","$($_.FullName)\testhost*.dmp","$($_.FullName)\Sequence_*.xml" -Recurse }); } } else { $testRoot = Resolve-Path "$PSScriptRoot\..\..\test" From da2dbc0e905c0b6045c7f51875848fa50cad9b7e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 15 Sep 2021 07:56:31 -0600 Subject: [PATCH 325/889] Remove ResultsDirectory tag --- .github/workflows/Linux.runsettings | 2 -- .github/workflows/Windows.runsettings | 2 -- .github/workflows/macOS.runsettings | 2 -- azure-pipelines/Darwin.runsettings | 2 -- azure-pipelines/Linux.runsettings | 2 -- azure-pipelines/Windows_NT.runsettings | 2 -- 6 files changed, 12 deletions(-) diff --git a/.github/workflows/Linux.runsettings b/.github/workflows/Linux.runsettings index 5e2244a0..db20611f 100644 --- a/.github/workflows/Linux.runsettings +++ b/.github/workflows/Linux.runsettings @@ -5,8 +5,6 @@ - - %GITHUB_WORKSPACE% diff --git a/.github/workflows/Windows.runsettings b/.github/workflows/Windows.runsettings index 5e2244a0..db20611f 100644 --- a/.github/workflows/Windows.runsettings +++ b/.github/workflows/Windows.runsettings @@ -5,8 +5,6 @@ - - %GITHUB_WORKSPACE% diff --git a/.github/workflows/macOS.runsettings b/.github/workflows/macOS.runsettings index 5e2244a0..db20611f 100644 --- a/.github/workflows/macOS.runsettings +++ b/.github/workflows/macOS.runsettings @@ -5,8 +5,6 @@ - - %GITHUB_WORKSPACE% diff --git a/azure-pipelines/Darwin.runsettings b/azure-pipelines/Darwin.runsettings index 0b43ecb0..db20611f 100644 --- a/azure-pipelines/Darwin.runsettings +++ b/azure-pipelines/Darwin.runsettings @@ -5,8 +5,6 @@ - - %BUILD_ARTIFACTSTAGINGDIRECTORY% diff --git a/azure-pipelines/Linux.runsettings b/azure-pipelines/Linux.runsettings index 0b43ecb0..db20611f 100644 --- a/azure-pipelines/Linux.runsettings +++ b/azure-pipelines/Linux.runsettings @@ -5,8 +5,6 @@ - - %BUILD_ARTIFACTSTAGINGDIRECTORY% diff --git a/azure-pipelines/Windows_NT.runsettings b/azure-pipelines/Windows_NT.runsettings index 0b43ecb0..db20611f 100644 --- a/azure-pipelines/Windows_NT.runsettings +++ b/azure-pipelines/Windows_NT.runsettings @@ -5,8 +5,6 @@ - - %BUILD_ARTIFACTSTAGINGDIRECTORY% From ecbaf97d74980f7455d3426f0138611992acc256 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 15 Sep 2021 08:32:30 -0600 Subject: [PATCH 326/889] Update SDK to 5.0.401 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 9f36eab1..3057bb45 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "5.0.400", + "version": "5.0.401", "rollForward": "patch", "allowPrerelease": false } From 04544dcde313bc25a6ed33f196816d48210fade1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 23 Sep 2021 14:31:02 -0600 Subject: [PATCH 327/889] Update Nerdbank.GitVersioning to 3.5.37-alpha This gets `msbuild -graph -isolate` working. Note when using `dotnet build` the `-graph -isolate` switches must be combined with `--no-restore` to workaround https://github.com/dotnet/msbuild/issues/6856. --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 277c9cde..0df35e99 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -33,7 +33,7 @@ - + From f6bc832d634d56f1107a29f747159c06c32eb892 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 23 Sep 2021 15:30:05 -0600 Subject: [PATCH 328/889] Optimize the build for just one version applied everywhere --- Directory.Build.props | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index 0df35e99..9184728d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -12,6 +12,9 @@ true true + + $(MSBuildThisFileDirectory) + embedded From 934d5f208f748fcdaf99e628c36c127246af99e6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 23 Sep 2021 15:36:27 -0600 Subject: [PATCH 329/889] Add a collection for prepended paths --- init.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.ps1 b/init.ps1 index 4cf910f2..cb86c6ca 100755 --- a/init.ps1 +++ b/init.ps1 @@ -48,6 +48,7 @@ Param ( ) $EnvVars = @{} +$PrependPath = @() if (!$NoPrerequisites) { if (!$NoNuGetCredProvider) { @@ -82,7 +83,7 @@ try { } } - & "$PSScriptRoot/tools/Set-EnvVars.ps1" -Variables $EnvVars | Out-Null + & "$PSScriptRoot/tools/Set-EnvVars.ps1" -Variables $EnvVars -PrependPath $PrependPath | Out-Null } catch { Write-Error $error[0] From 62687e5afd6515409d332ee7cbbba5e38ea45885 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 23 Sep 2021 16:56:28 -0600 Subject: [PATCH 330/889] Stabilize package restore in the face of outside influences --- nuget.config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nuget.config b/nuget.config index 68f36551..22f7b809 100644 --- a/nuget.config +++ b/nuget.config @@ -8,4 +8,8 @@ + + + + From ccae4b2e7701f9d7236c035f33fc0d702b80271e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 3 Oct 2021 14:01:00 -0600 Subject: [PATCH 331/889] Place obj folders in the same hierarchy as the source appears in the repo This avoids inadvertent obj dir collisions when the project name matches, which tends to happen when using dirs.proj. --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 9184728d..3b53649a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ Debug $(MSBuildThisFileDirectory) - $(RepoRootPath)obj\$(MSBuildProjectName)\ + $(RepoRootPath)obj\$([MSBuild]::MakeRelative($(RepoRootPath), $(MSBuildProjectDirectory)))\ $(RepoRootPath)bin\$(MSBuildProjectName)\ $(RepoRootPath)bin\Packages\$(Configuration)\ 9.0 From 26afcd2276a2b0df4157d1594c260fd264a6adcd Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 3 Oct 2021 14:01:13 -0600 Subject: [PATCH 332/889] Calculate the version just once for the whole repo --- Directory.Build.props | 1 + 1 file changed, 1 insertion(+) diff --git a/Directory.Build.props b/Directory.Build.props index 3b53649a..8a8effea 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,6 +11,7 @@ true true true + $(RepoRootPath) $(MSBuildThisFileDirectory) From 392da69055086b58b6296379aa6c502a5b2ba947 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 3 Oct 2021 14:01:33 -0600 Subject: [PATCH 333/889] Opt into the WPF nuget fix in .NET 5 SDK --- Directory.Build.props | 1 + 1 file changed, 1 insertion(+) diff --git a/Directory.Build.props b/Directory.Build.props index 8a8effea..6e481b01 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,6 +11,7 @@ true true true + true $(RepoRootPath) From 341aba5d8f66353b57161a25248ddd3f1c172190 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 6 Oct 2021 11:36:13 -0600 Subject: [PATCH 334/889] Use public hosted pool for VS insertions We only need VSEng-ReleasePool for symbol archival. --- azure-pipelines/vs-insertion.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 90645cb2..6aef7889 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -17,7 +17,8 @@ stages: displayName: VS insertion jobs: - deployment: insertion - pool: VSEng-ReleasePool + pool: + vmImage: windows-latest environment: No-Approval strategy: runOnce: From 8094b0aac7e7ef8cb7b1c3b3cfd64455b0986973 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 8 Oct 2021 17:55:07 -0600 Subject: [PATCH 335/889] Set indent size for msbuildproj files --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 6015ff48..c561b381 100644 --- a/.editorconfig +++ b/.editorconfig @@ -20,7 +20,7 @@ insert_final_newline = true trim_trailing_whitespace = true # Xml project files -[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,msbuildproj}] indent_size = 2 # Xml config files From 6cd48ff31414e2004ebb579d6a9e3e2ab4d422df Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 11 Oct 2021 15:07:39 -0600 Subject: [PATCH 336/889] Move TargetFramework properties into projects They cause more confusion and issues being imported than its worth. --- src/Directory.Build.props | 4 ---- src/Library/Library.csproj | 4 +++- test/Directory.Build.props | 1 - test/Library.Tests/Library.Tests.csproj | 1 + 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 165d2ddd..77d94765 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,7 +1,3 @@ - - - netstandard2.0 - diff --git a/src/Library/Library.csproj b/src/Library/Library.csproj index 61718a1f..4641dbd6 100644 --- a/src/Library/Library.csproj +++ b/src/Library/Library.csproj @@ -1,3 +1,5 @@ - + + netstandard2.0 + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 1b45d716..449a06e4 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -2,7 +2,6 @@ - net5.0;netcoreapp3.1;net472 false true diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index c66b7aac..9a0a5820 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -1,6 +1,7 @@ + net5.0;netcoreapp3.1;net472 From 295a5328208e65883c9a3add6fdfdba3bd14b34a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 26 Oct 2021 06:24:16 -0600 Subject: [PATCH 337/889] Include README in nupkg --- src/Library/Library.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Library/Library.csproj b/src/Library/Library.csproj index 4641dbd6..a7547da1 100644 --- a/src/Library/Library.csproj +++ b/src/Library/Library.csproj @@ -1,5 +1,9 @@ netstandard2.0 + README.md + + + From d3cb4c585962ff32716f4e6c22a3ebe905a6e8a4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 26 Oct 2021 06:38:13 -0600 Subject: [PATCH 338/889] Revert "Include README in nupkg" This reverts commit 295a5328208e65883c9a3add6fdfdba3bd14b34a. This is due to https://github.com/NuGet/Home/issues/10791. We can reapply the readme after switching to .NET SDK 6.0. --- src/Library/Library.csproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Library/Library.csproj b/src/Library/Library.csproj index a7547da1..4641dbd6 100644 --- a/src/Library/Library.csproj +++ b/src/Library/Library.csproj @@ -1,9 +1,5 @@ netstandard2.0 - README.md - - - From 2174046dee68180b06a3de37420161cfa4566dbb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 26 Oct 2021 06:38:42 -0600 Subject: [PATCH 339/889] Reapply "Include README in nupkg" This reverts commit d3cb4c585962ff32716f4e6c22a3ebe905a6e8a4. --- src/Library/Library.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Library/Library.csproj b/src/Library/Library.csproj index 4641dbd6..a7547da1 100644 --- a/src/Library/Library.csproj +++ b/src/Library/Library.csproj @@ -1,5 +1,9 @@ netstandard2.0 + README.md + + + From 5fa2a94852e82ada595c6d3a7c112670d9590493 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 26 Oct 2021 06:51:05 -0600 Subject: [PATCH 340/889] Update to .NET 6 SDK --- Directory.Build.props | 3 +-- global.json | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 6e481b01..fac9c677 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -34,8 +34,7 @@ - - + diff --git a/global.json b/global.json index 3057bb45..973759e1 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "5.0.401", + "version": "6.0.100-rc.2.21505.57", "rollForward": "patch", - "allowPrerelease": false + "allowPrerelease": true } } From 346548ac0da1ae678c32af3b0381df4c34277a0b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 26 Oct 2021 07:31:30 -0600 Subject: [PATCH 341/889] Search for .NET 5+ runtime requirements --- tools/Install-DotNetSdk.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 73dae25f..42789930 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -47,7 +47,7 @@ Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$P } } } - $targetFrameworks |? { $_ -match 'netcoreapp(\d+\.\d+)' } |% { + $targetFrameworks |? { $_ -match 'net(?:coreapp)?(\d+\.\d+)' } |% { $v = $Matches[1] $runtimeVersions += $v if ($v -ge '3.0' -and -not ($IsMacOS -or $IsLinux)) { From ef76eb2d0d8cc2d90ce4eee2cd07d485b18ecedf Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 26 Oct 2021 08:20:31 -0600 Subject: [PATCH 342/889] Use C# 10 syntax --- Directory.Build.props | 4 ++-- src/Library/Calculator.cs | 39 ++++++++++++++++++--------------------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index fac9c677..38102b59 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,8 +5,9 @@ $(RepoRootPath)obj\$([MSBuild]::MakeRelative($(RepoRootPath), $(MSBuildProjectDirectory)))\ $(RepoRootPath)bin\$(MSBuildProjectName)\ $(RepoRootPath)bin\Packages\$(Configuration)\ - 9.0 + 10.0 enable + enable latest true true @@ -34,7 +35,6 @@ - diff --git a/src/Library/Calculator.cs b/src/Library/Calculator.cs index 9156a1a3..706c341d 100644 --- a/src/Library/Calculator.cs +++ b/src/Library/Calculator.cs @@ -1,29 +1,26 @@ // Copyright (c) COMPANY-PLACEHOLDER. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -namespace Library -{ - using System; +namespace Library; +/// +/// My first class. +/// +public static class Calculator +{ /// - /// My first class. + /// Adds two integers. /// - public static class Calculator - { - /// - /// Adds two integers. - /// - /// The first integer. - /// The second integer. - /// The sum of the two integers. - public static int Add(int a, int b) => a + b; + /// The first integer. + /// The second integer. + /// The sum of the two integers. + public static int Add(int a, int b) => a + b; - /// - /// Subtracts one integer from another. - /// - /// The original integer. - /// The integer to subtract. - /// The difference between the two integers. - public static int Subtract(int a, int b) => a - b; - } + /// + /// Subtracts one integer from another. + /// + /// The original integer. + /// The integer to subtract. + /// The difference between the two integers. + public static int Subtract(int a, int b) => a - b; } From 2cc62417f55390b6ef18b69c51fe3b1ec7dc1082 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 26 Oct 2021 08:22:53 -0600 Subject: [PATCH 343/889] Remove WPF workaround that isn't necessary with the .NET 6 SDK --- Directory.Build.props | 1 - 1 file changed, 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 38102b59..38d8582d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -12,7 +12,6 @@ true true true - true $(RepoRootPath) From 8a53e8b57038869eb0b5d7cfc4a08650b4ca56e7 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 28 Oct 2021 07:13:05 -0600 Subject: [PATCH 344/889] Archive symbols on VSEng-ReleasePool-1ES --- azure-pipelines/official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 38ea7124..fc696565 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -53,7 +53,7 @@ stages: condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) jobs: - job: archive - pool: VSEng-ReleasePool + pool: VSEng-ReleasePool-1ES steps: - download: current artifact: Variables-Windows From a280dfc4ad77431e75a359b37c27886cf3a3afe7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Nov 2021 13:00:43 +0000 Subject: [PATCH 345/889] Bump Microsoft.NET.Test.Sdk from 16.11.0 to 17.0.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 16.11.0 to 17.0.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v16.11.0...v17.0.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 9a0a5820..ebd5df8f 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -11,7 +11,7 @@ - + From ab053bb6cc903ac4a48ba198f126b5e021905e33 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 2 Nov 2021 06:13:29 -0600 Subject: [PATCH 346/889] Disable default, redundant NB.GV behavior We already call `nbgv cloud` in the cloud builds, so there is no need to set certain pipeline variables with every project. In fact given a couple bugs that have come into NB.GV lately around issues on [AzP](https://github.com/dotnet/Nerdbank.GitVersioning/pull/675) or [GitHub Actions](https://github.com/dotnet/Nerdbank.GitVersioning/issues/683) around setting pipeline variables, this should improve build reliability. --- version.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/version.json b/version.json index f0da4f6a..39add986 100644 --- a/version.json +++ b/version.json @@ -4,5 +4,8 @@ "publicReleaseRefSpec": [ "^refs/heads/main$", "^refs/heads/v\\d+(?:\\.\\d+)?$" - ] + ], + "cloudBuild": { + "setVersionVariables": false + } } From 16d30af64f26f62e547805ebcb002b1efd3f7a6d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 2 Nov 2021 10:29:57 -0600 Subject: [PATCH 347/889] Log artifact warnings in more cases We were not warning when *groups* would be defined by an artifact collector even if all those groups were empty. --- azure-pipelines/artifacts/_all.ps1 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1 index efd6bdb3..db10c5ff 100755 --- a/azure-pipelines/artifacts/_all.ps1 +++ b/azure-pipelines/artifacts/_all.ps1 @@ -25,10 +25,9 @@ Function EnsureTrailingSlash($path) { Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% { $ArtifactName = $_.BaseName + $totalFileCount = 0 $fileGroups = & $_ - if (!$fileGroups -or $fileGroups.Count -eq 0) { - Write-Warning "No files found for the `"$ArtifactName`" artifact." - } else { + if ($fileGroups) { $fileGroups.GetEnumerator() | % { $BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key.ToString()), [UriKind]::Absolute) $_.Value | % { @@ -46,7 +45,12 @@ Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% { Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath) Write-Output $artifact + $totalFileCount += 1 } } } + + if ($totalFileCount -eq 0) { + Write-Warning "No files found for the `"$ArtifactName`" artifact." + } } From cbf38a43293df070b8dc0cf8f365e2b237f4bd22 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 8 Nov 2021 12:31:26 -0700 Subject: [PATCH 348/889] Use .NET SDK 6.0.100 GA --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 973759e1..e2af429b 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "6.0.100-rc.2.21505.57", + "version": "6.0.100", "rollForward": "patch", - "allowPrerelease": true + "allowPrerelease": false } } From 4582d85ab68fe930a4b2016a7351322a0e6672db Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 12 Nov 2021 08:25:49 -0700 Subject: [PATCH 349/889] Collect coverage in non-multitargeting environments --- azure-pipelines/artifacts/coverageResults.ps1 | 4 ++-- azure-pipelines/publish-codecoverage.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/artifacts/coverageResults.ps1 b/azure-pipelines/artifacts/coverageResults.ps1 index addbf85c..8fdb3f72 100644 --- a/azure-pipelines/artifacts/coverageResults.ps1 +++ b/azure-pipelines/artifacts/coverageResults.ps1 @@ -3,7 +3,7 @@ $RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") # Prepare code coverage reports for merging on another machine if ($env:SYSTEM_DEFAULTWORKINGDIRECTORY) { Write-Host "Substituting $env:SYSTEM_DEFAULTWORKINGDIRECTORY with `"{reporoot}`"" - $reports = Get-ChildItem "$RepoRoot/bin/coverage.*.cobertura.xml" -Recurse + $reports = Get-ChildItem "$RepoRoot/bin/coverage.*cobertura.xml" -Recurse $reports |% { $content = Get-Content -Path $_ |% { $_ -Replace [regex]::Escape($env:SYSTEM_DEFAULTWORKINGDIRECTORY), "{reporoot}" } Set-Content -Path $_ -Value $content -Encoding UTF8 @@ -16,7 +16,7 @@ if (!((Test-Path $RepoRoot\bin) -and (Test-Path $RepoRoot\obj))) { return } @{ $RepoRoot = ( - @(Get-ChildItem "$RepoRoot\bin\coverage.*.cobertura.xml" -Recurse) + + @(Get-ChildItem "$RepoRoot\bin\coverage.*cobertura.xml" -Recurse) + (Get-ChildItem "$RepoRoot\obj\*.cs" -Recurse) ); } diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index d83eb64a..3667b976 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -19,7 +19,7 @@ steps: dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.8.5 --configfile azure-pipelines/justnugetorg.nuget.config Copy-Item -Recurse $(Pipeline.Workspace)/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj Write-Host "Substituting {reporoot} with $(System.DefaultWorkingDirectory)" - $reports = Get-ChildItem -Recurse "$(Pipeline.Workspace)/coverage.*.cobertura.xml" + $reports = Get-ChildItem -Recurse "$(Pipeline.Workspace)/coverage.*cobertura.xml" $reports |% { $content = Get-Content -Path $_ |% { $_.Replace("{reporoot}", "$(System.DefaultWorkingDirectory)") } Set-Content -Path $_ -Value $content -Encoding UTF8 From 920947343737b964b1f84a4359529286bb9b869f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 18 Nov 2021 21:43:01 -0700 Subject: [PATCH 350/889] Touch-ups --- .devcontainer/Dockerfile | 2 +- .vscode/settings.json | 12 ++++++------ Directory.Build.props | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 88949946..c47acfaa 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0.400-focal +FROM mcr.microsoft.com/dotnet/sdk:6.0.100-focal # Installing mono makes `dotnet test` work without errors even for net472. # But installing it takes a long time, so it's excluded by default. diff --git a/.vscode/settings.json b/.vscode/settings.json index 00aaed88..3ae1371c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,8 @@ { - "files.trimTrailingWhitespace": true, - "files.insertFinalNewline": true, - "files.trimFinalNewlines": true, - "omnisharp.enableEditorConfigSupport": true, - "omnisharp.enableImportCompletion": true, - "omnisharp.enableRoslynAnalyzers": true + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "omnisharp.enableEditorConfigSupport": true, + "omnisharp.enableImportCompletion": true, + "omnisharp.enableRoslynAnalyzers": true } diff --git a/Directory.Build.props b/Directory.Build.props index 38d8582d..0ce1cbb7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -12,7 +12,6 @@ true true true - $(RepoRootPath) $(MSBuildThisFileDirectory) From 686e55d0f99445c0db83bdbe45d14722a5597651 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 Nov 2021 12:41:18 -0700 Subject: [PATCH 351/889] Add Apply-Template.ps1 script to automate template updates --- Apply-Template.ps1 | 27 +++++++++++++++++++++++++++ Expand-Template.ps1 | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 Apply-Template.ps1 diff --git a/Apply-Template.ps1 b/Apply-Template.ps1 new file mode 100644 index 00000000..544b7a7c --- /dev/null +++ b/Apply-Template.ps1 @@ -0,0 +1,27 @@ +#!/usr/bin/env pwsh + +<# +.SYNOPSIS +Applies the template to another repo in a semi-destructive way. +Always apply to a clean working copy so that undesired updates can be easily reverted. +.PARAMETER Path +The path to the root of the repo to be updated with the latest version of this template. +#> + +[CmdletBinding(SupportsShouldProcess, ConfirmImpact='Medium')] +Param( + [Parameter(Mandatory=$true)] + [ValidateScript({Test-Path $_})] + [string]$Path +) + +Write-Host "Updating $Path" +robocopy /mir $PSScriptRoot/azure-pipelines $Path/azure-pipelines +robocopy /mir $PSScriptRoot/.devcontainer $Path/.devcontainer +robocopy /mir $PSScriptRoot/.github $Path/.github +robocopy /mir $PSScriptRoot/.vscode $Path/.vscode +robocopy /mir $PSScriptRoot/tools $Path/tools +robocopy $PSScriptRoot $Path Directory.Build.* global.json init.* azure-pipelines.yml .gitignore .gitattributes .editorconfig +robocopy $PSScriptRoot/src $Path/src Directory.Build.* .editorconfig +robocopy $PSScriptRoot/test $Path/test Directory.Build.* .editorconfig +Remove-Item $Path/azure-pipelines/expand-template.yml diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index d665e56a..9e4d4973 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -180,7 +180,7 @@ try { Replace-Placeholders -Path "azure-pipelines.yml" -Replacements $YmlReplacements # Self destruct - git rm Expand-Template.* + git rm Expand-Template.* Apply-Template.ps1 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } git rm :/azure-pipelines/expand-template.yml if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } From c89a91562b6aeabbc18e6647165230d04a386d04 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 Nov 2021 12:44:29 -0700 Subject: [PATCH 352/889] Suppress microbuild nonshipping dependency --- test/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Directory.Build.props b/test/Directory.Build.props index ef88f73a..6ada957d 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -7,6 +7,6 @@ - + From 861b1285548438f448bed6bc6ac63161095cfbb4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 Nov 2021 15:50:41 -0700 Subject: [PATCH 353/889] Build on Microbuild 2022 agents --- azure-pipelines/official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index fc696565..b6791c67 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -45,7 +45,7 @@ stages: jobs: - template: build.yml parameters: - windowsPool: VSEngSS-MicroBuild2019-1ES + windowsPool: VSEngSS-MicroBuild2022-1ES includeMacOS: ${{ parameters.includeMacOS }} - stage: symbol_archive From 805c87a603471d8cb6af194e727304ae05d1579b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 Nov 2021 15:49:51 -0700 Subject: [PATCH 354/889] Build on VS 2022 agents --- azure-pipelines/build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index cd39a76a..a1f5e786 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -1,6 +1,9 @@ parameters: - windowsPool: Hosted Windows 2019 with VS2019 - includeMacOS: +- name: windowsPool + type: object + default: + vmImage: windows-2022 +- name: includeMacOS jobs: - job: Windows From 4fb29c86e9d117361e15454ba5d82a2f4e39259b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 Nov 2021 16:27:20 -0700 Subject: [PATCH 355/889] Update Microsoft.SourceLink.GitHub package version --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 0ce1cbb7..2e771602 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -34,7 +34,7 @@ - + From decffacc230f5a45d6cef669d0c81a08ce63353d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 22 Nov 2021 15:49:28 -0700 Subject: [PATCH 356/889] Define TeamEmail variable --- azure-pipelines/variables/TeamEmail.ps1 | 1 + 1 file changed, 1 insertion(+) create mode 100644 azure-pipelines/variables/TeamEmail.ps1 diff --git a/azure-pipelines/variables/TeamEmail.ps1 b/azure-pipelines/variables/TeamEmail.ps1 new file mode 100644 index 00000000..7cf66982 --- /dev/null +++ b/azure-pipelines/variables/TeamEmail.ps1 @@ -0,0 +1 @@ +'vsidemicrobuild@microsoft.com' From 2eb1688704d5de2990fd51407b2ec64ac41019d3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 22 Nov 2021 15:48:47 -0700 Subject: [PATCH 357/889] Collect diagnostic test logs --- azure-pipelines/artifacts/testResults.ps1 | 20 +++++++++++++------- azure-pipelines/dotnet.yml | 6 +++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/azure-pipelines/artifacts/testResults.ps1 b/azure-pipelines/artifacts/testResults.ps1 index 7895ddca..862155da 100644 --- a/azure-pipelines/artifacts/testResults.ps1 +++ b/azure-pipelines/artifacts/testResults.ps1 @@ -1,12 +1,18 @@ +$result = @{} + if ($env:AGENT_TEMPDIRECTORY) { # The DotNetCoreCLI uses an alternate location to publish these files $guidRegex = '^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$' - @{ - $env:AGENT_TEMPDIRECTORY = (Get-ChildItem $env:AGENT_TEMPDIRECTORY -Directory |? { $_.Name -match $guidRegex } |% { Get-ChildItem "$($_.FullName)\dotnet*.dmp","$($_.FullName)\testhost*.dmp","$($_.FullName)\Sequence_*.xml" -Recurse }); - } -} else { + $result[$env:AGENT_TEMPDIRECTORY] = (Get-ChildItem $env:AGENT_TEMPDIRECTORY -Directory |? { $_.Name -match $guidRegex } |% { Get-ChildItem "$($_.FullName)\dotnet*.dmp","$($_.FullName)\testhost*.dmp","$($_.FullName)\Sequence_*.xml" -Recurse }); +} +else { $testRoot = Resolve-Path "$PSScriptRoot\..\..\test" - @{ - $testRoot = (Get-ChildItem "$testRoot\TestResults" -Recurse -Directory | Get-ChildItem -Recurse -File); - } + $result[$testRoot] = (Get-ChildItem "$testRoot\TestResults" -Recurse -Directory | Get-ChildItem -Recurse -File) +} + +$testlogsPath = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\test_logs" +if (Test-Path $testlogsPath) { + $result[$testlogsPath] = Get-ChildItem "$testlogsPath\*"; } + +$result diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 50ba58f1..70cd23ee 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -10,7 +10,7 @@ steps: displayName: dotnet test -f net472 inputs: command: test - arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net472.binlog" + arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net472.binlog" --diag "$(Build.ArtifactStagingDirectory)/test_logs/net472.txt" testRunTitle: net472-$(Agent.JobName) condition: succeededOrFailed() @@ -18,7 +18,7 @@ steps: displayName: dotnet test -f netcoreapp3.1 inputs: command: test - arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_netcoreapp3.1.binlog" + arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_netcoreapp3.1.binlog" --diag "$(Build.ArtifactStagingDirectory)/test_logs/netcoreapp3.1.txt" testRunTitle: netcoreapp3.1-$(Agent.JobName) condition: succeededOrFailed() @@ -26,7 +26,7 @@ steps: displayName: dotnet test -f net5.0 inputs: command: test - arguments: --no-build -c $(BuildConfiguration) -f net5.0 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net5.0.binlog" + arguments: --no-build -c $(BuildConfiguration) -f net5.0 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net5.0.binlog" --diag "$(Build.ArtifactStagingDirectory)/test_logs/net5.0.txt" testRunTitle: net5.0-$(Agent.JobName) condition: succeededOrFailed() From df52bbc7da6d37808c1e0095bea0ba3e1905697d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 22 Nov 2021 15:49:06 -0700 Subject: [PATCH 358/889] Remove CA1508, which has too many false positives --- .editorconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index c561b381..0d75b34a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -164,9 +164,6 @@ csharp_prefer_braces = true:silent # SA1130: Use lambda syntax dotnet_diagnostic.SA1130.severity = silent -# CA1508: Avoid dead conditional code -dotnet_diagnostic.CA1508.severity = warning - # IDE1006: Naming Styles - StyleCop handles these for us dotnet_diagnostic.IDE1006.severity = none From c5db1efad8a160ec9869b4e1cf0b72b07b59526f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 25 Nov 2021 22:26:34 -0700 Subject: [PATCH 359/889] Fix ARM detection on Linux The `$env:PROCESSOR_ARCHITECTURE` environment variable simply isn't set on linux. --- tools/Install-DotNetSdk.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 42789930..f5a300a4 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -29,8 +29,7 @@ $DotNetInstallScriptRoot = Resolve-Path $DotNetInstallScriptRoot # Look up actual required .NET Core SDK version from global.json $sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1" -$arch = 'x64' -if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { $arch = 'ARM64' } +$arch = [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture # Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them. $runtimeVersions = @() From c9ed75c04a722207de4f79a2cb17f558b8ae4641 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 29 Nov 2021 16:17:37 -0700 Subject: [PATCH 360/889] Format whitespace in init.ps1 --- init.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/init.ps1 b/init.ps1 index cb86c6ca..774ead58 100755 --- a/init.ps1 +++ b/init.ps1 @@ -31,10 +31,10 @@ .PARAMETER AccessToken An optional access token for authenticating to Azure Artifacts authenticated feeds. #> -[CmdletBinding(SupportsShouldProcess=$true)] +[CmdletBinding(SupportsShouldProcess = $true)] Param ( - [ValidateSet('repo','user','machine')] - [string]$InstallLocality='user', + [ValidateSet('repo', 'user', 'machine')] + [string]$InstallLocality = 'user', [Parameter()] [switch]$NoPrerequisites, [Parameter()] @@ -68,8 +68,8 @@ if (!$NoPrerequisites) { } # Workaround nuget credential provider bug that causes very unreliable package restores on Azure Pipelines -$env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20 -$env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 +$env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS = 20 +$env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS = 20 Push-Location $PSScriptRoot try { From b75b239dfc8258e7c5d8c60ea9b4bc338392293f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 1 Dec 2021 11:57:57 -0700 Subject: [PATCH 361/889] Suppress powershell interpreting of AzP macros --- azure-pipelines/publish-codecoverage.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index 3667b976..a0862be3 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -18,10 +18,10 @@ steps: - powershell: | dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.8.5 --configfile azure-pipelines/justnugetorg.nuget.config Copy-Item -Recurse $(Pipeline.Workspace)/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj - Write-Host "Substituting {reporoot} with $(System.DefaultWorkingDirectory)" - $reports = Get-ChildItem -Recurse "$(Pipeline.Workspace)/coverage.*cobertura.xml" + Write-Host 'Substituting {reporoot} with $(System.DefaultWorkingDirectory)' + $reports = Get-ChildItem -Recurse '$(Pipeline.Workspace)/coverage.*cobertura.xml' $reports |% { - $content = Get-Content -Path $_ |% { $_.Replace("{reporoot}", "$(System.DefaultWorkingDirectory)") } + $content = Get-Content -Path $_ |% { $_.Replace('{reporoot}', '$(System.DefaultWorkingDirectory)') } Set-Content -Path $_ -Value $content -Encoding UTF8 } $Inputs = [string]::join(';', ($reports |% { Resolve-Path -relative $_ })) From e1fafe9b84943d228456c3595a547c2d62a8acc0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 2 Dec 2021 10:55:44 -0700 Subject: [PATCH 362/889] Secure p/invoke native library loads --- src/AssemblyInfo.cs | 6 ++++++ src/Directory.Build.targets | 4 ++++ 2 files changed, 10 insertions(+) create mode 100644 src/AssemblyInfo.cs diff --git a/src/AssemblyInfo.cs b/src/AssemblyInfo.cs new file mode 100644 index 00000000..81feda27 --- /dev/null +++ b/src/AssemblyInfo.cs @@ -0,0 +1,6 @@ +// Copyright (c) COMPANY-PLACEHOLDER. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Runtime.InteropServices; + +[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.SafeDirectories)] diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index e7edee55..566ab4fc 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,3 +1,7 @@ + + + + From ca5dc779b4abe27cc6aca34a1498af6fa0a3eca9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 2 Dec 2021 13:05:54 -0700 Subject: [PATCH 363/889] Generate NOTICE file and include in nuget packages --- Directory.Build.props | 4 ++++ azure-pipelines/microbuild.after.yml | 3 --- azure-pipelines/microbuild.before.yml | 9 +++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 70ab3c7b..ee246587 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -41,6 +41,10 @@ + + + + diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 8559b27a..70f07eaa 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -9,9 +9,6 @@ steps: condition: succeededOrFailed() displayName: MicroBuild Cleanup -- task: ComponentGovernanceComponentDetection@0 - displayName: Component Detection - - task: Ref12Analyze@0 displayName: Ref12 (Codex) Analyze inputs: diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index 96cd3254..ab930694 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -1,4 +1,13 @@ steps: +- task: ComponentGovernanceComponentDetection@0 + displayName: Component Detection + +- task: notice@0 + displayName: Generate NOTICE file + inputs: + outputfile: $(System.DefaultWorkingDirectory)/obj/NOTICE + outputformat: text + - task: MicroBuildSigningPlugin@3 inputs: signType: $(SignType) From 099d36f7c4fe6b82e091833675e52ede3617b7ca Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 2 Dec 2021 13:12:48 -0700 Subject: [PATCH 364/889] Fix PoliCheck to actually break builds on failures --- azure-pipelines/PoliCheckExclusions.xml | 10 ++++++++++ azure-pipelines/secure-development-tools.yml | 16 +++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 azure-pipelines/PoliCheckExclusions.xml diff --git a/azure-pipelines/PoliCheckExclusions.xml b/azure-pipelines/PoliCheckExclusions.xml new file mode 100644 index 00000000..5ae16710 --- /dev/null +++ b/azure-pipelines/PoliCheckExclusions.xml @@ -0,0 +1,10 @@ + + + NODE_MODULES|.STORE + + + + + + + diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index 941d5b0c..ca05939e 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -1,11 +1,17 @@ steps: - ### Check for checked in credentials. - task: CredScan@3 - displayName: 'Run CredScan' + displayName: Run CredScan - ### Run PoliCheck to check for disallowed terms. targetType: F indicates we're searching files and folders. -- task: PoliCheck@1 - displayName: 'Run PoliCheck' +- task: PoliCheck@2 + displayName: Run PoliCheck inputs: targetType: F + targetArgument: $(System.DefaultWorkingDirectory) + optionsUEPATH: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml + +- task: PostAnalysis@2 + displayName: Break on compliance issues + inputs: + GdnBreakAllTools: true + GdnBreakGdnToolBinSkimSeverity: Warning From a53b29ece9260d9d844cc4e90bd2ad84bcdf05cb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 2 Dec 2021 13:18:59 -0700 Subject: [PATCH 365/889] Add SDT task reporting --- azure-pipelines/secure-development-tools.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index ca05939e..56d26279 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -10,6 +10,20 @@ steps: targetArgument: $(System.DefaultWorkingDirectory) optionsUEPATH: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml +- task: SdtReport@2 + displayName: Create Security Analysis Report + inputs: + GdnExportAllTools: true + +- task: PublishSecurityAnalysisLogs@3 + displayName: Publish Code Analysis Logs + inputs: + ArtifactName: CodeAnalysisLogs + ArtifactType: Container + PublishProcessedResults: true + AllTools: true + ToolLogsNotFoundAction: Standard + - task: PostAnalysis@2 displayName: Break on compliance issues inputs: From 848f9799a8d6b890195c9bc231766e4466349402 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 2 Dec 2021 13:19:14 -0700 Subject: [PATCH 366/889] Add BinSkim to SDT tasks --- azure-pipelines/Get-SymbolFiles.ps1 | 10 ++++++++-- azure-pipelines/secure-development-tools.yml | 7 +++++++ azure-pipelines/variables/BinSkimTargets.ps1 | 4 ++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 azure-pipelines/variables/BinSkimTargets.ps1 diff --git a/azure-pipelines/Get-SymbolFiles.ps1 b/azure-pipelines/Get-SymbolFiles.ps1 index 45afe7c2..8793e19c 100644 --- a/azure-pipelines/Get-SymbolFiles.ps1 +++ b/azure-pipelines/Get-SymbolFiles.ps1 @@ -5,12 +5,16 @@ The root path to recursively search for PDBs. .PARAMETER Tests A switch indicating to find test-related PDBs instead of product-only PDBs. +.PARAMETER ConvertToWindowsPDBs + A switch to convert and return paths to Windows PDBs instead of portable PDBs. + Ignored on non-Windows agents. #> [CmdletBinding()] param ( [parameter(Mandatory=$true)] [string]$Path, - [switch]$Tests + [switch]$Tests, + [switch]$ConvertToWindowsPDBs=$true ) $WindowsPdbSubDirName = "symstore" @@ -54,7 +58,7 @@ $PDBs |% { Write-Output $BinaryImagePath - if (-not ($IsMacOS -or $IsLinux)) { + if ($ConvertToWindowsPDBs -and -not ($IsMacOS -or $IsLinux)) { # Convert the PDB to legacy Windows PDBs Write-Host "Converting PDB for $_" -ForegroundColor DarkGray $WindowsPdbDir = "$($_.Directory.FullName)\$WindowsPdbSubDirName" @@ -65,5 +69,7 @@ $PDBs |% { } Write-Output "$WindowsPdbDir\$($_.BaseName).pdb" + } else { + Write-Output $_.FullName } } diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index 56d26279..0ac9b324 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -10,6 +10,13 @@ steps: targetArgument: $(System.DefaultWorkingDirectory) optionsUEPATH: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml +- task: BinSkim@3 + displayName: Run BinSkim + inputs: + InputType: Basic + Function: analyze + AnalyzeTarget: $(BinSkimTargets) + - task: SdtReport@2 displayName: Create Security Analysis Report inputs: diff --git a/azure-pipelines/variables/BinSkimTargets.ps1 b/azure-pipelines/variables/BinSkimTargets.ps1 new file mode 100644 index 00000000..5c0dd24e --- /dev/null +++ b/azure-pipelines/variables/BinSkimTargets.ps1 @@ -0,0 +1,4 @@ +$Path = "$PSScriptRoot\..\..\bin" +if (Test-Path $Path) { + [string]::join(';', (& "$PSScriptRoot\..\Get-SymbolFiles.ps1" -ConvertToWindowsPDBs:$false -Path $Path)) +} From 1be4fa9788b5295754319602b6524de64f865a42 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 2 Dec 2021 16:50:33 -0700 Subject: [PATCH 367/889] Fix regression in platform detection in Windows Powershell --- tools/Install-DotNetSdk.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index f5a300a4..3c82ee2b 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -30,6 +30,10 @@ $DotNetInstallScriptRoot = Resolve-Path $DotNetInstallScriptRoot $sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1" $arch = [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture +if (!$arch) { # Windows Powershell leaves this blank + $arch = 'x64' + if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { $arch = 'ARM64' } +} # Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them. $runtimeVersions = @() From 81634e306fd8a561434c42687ee7f3f84b4a0067 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 3 Dec 2021 06:40:03 -0700 Subject: [PATCH 368/889] Set basic version build variables in pipeline --- azure-pipelines/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index a1f5e786..796be61d 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -13,7 +13,7 @@ jobs: clean: true - template: install-dependencies.yml - - powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud' + - powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud -c' displayName: Set build number - template: dotnet.yml From 02a6d80f2ca20040fc1d3624e461c2f40b5773d0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 2 Dec 2021 13:27:49 -0700 Subject: [PATCH 369/889] Add APIScan SDT task --- azure-pipelines/build.yml | 9 +++++ azure-pipelines/falsepositives.gdnsuppress | 12 +++++++ azure-pipelines/microbuild.after.yml | 6 ++++ azure-pipelines/official.yml | 5 +++ azure-pipelines/secure-development-tools.yml | 35 ++++++++++++++++++++ 5 files changed, 67 insertions(+) create mode 100644 azure-pipelines/falsepositives.gdnsuppress diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 58cb9716..8523ab85 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -4,10 +4,17 @@ parameters: default: vmImage: windows-2022 - name: includeMacOS +- name: EnableAPIScan + type: boolean + default: false jobs: - job: Windows pool: ${{ parameters.windowsPool }} + variables: + - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + # https://dev.azure.com/devdiv/DevDiv/_wiki/wikis/DevDiv.wiki/25351/APIScan-step-by-step-guide-to-setting-up-a-Pipeline + - group: VSCloudServices-APIScan steps: - checkout: self clean: true @@ -27,6 +34,8 @@ jobs: - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - template: microbuild.after.yml + parameters: + EnableAPIScan: ${{ parameters.EnableAPIScan }} - template: expand-template.yml diff --git a/azure-pipelines/falsepositives.gdnsuppress b/azure-pipelines/falsepositives.gdnsuppress new file mode 100644 index 00000000..1248172b --- /dev/null +++ b/azure-pipelines/falsepositives.gdnsuppress @@ -0,0 +1,12 @@ +{ + "version": "latest", + "suppressionSets": { + "falsepositives": { + "name": "falsepositives", + "createdDate": "2021-12-03 00:23:08Z", + "lastUpdatedDate": "2021-12-03 00:23:08Z" + } + }, + "results": { + } +} diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 70f07eaa..6f107833 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -1,3 +1,7 @@ +parameters: +- name: EnableAPIScan + type: boolean + steps: - task: MicroBuildCodesignVerify@3 displayName: Verify Signed Files @@ -23,3 +27,5 @@ steps: continueOnError: true - template: secure-development-tools.yml + parameters: + EnableAPIScan: ${{ parameters.EnableAPIScan }} diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index b6791c67..bac667b6 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -27,6 +27,10 @@ parameters: displayName: Build on macOS type: boolean default: false # macOS is often bogged down in Azure Pipelines +- name: EnableAPIScan + displayName: Run APIScan + type: boolean + default: true variables: NugetSecurityAnalysisWarningLevel: none # nuget.config requires signed packages by trusted owners @@ -45,6 +49,7 @@ stages: jobs: - template: build.yml parameters: + EnableAPIScan: ${{ parameters.EnableAPIScan }} windowsPool: VSEngSS-MicroBuild2022-1ES includeMacOS: ${{ parameters.includeMacOS }} diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index 0ac9b324..e6b4d624 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -1,3 +1,7 @@ +parameters: +- name: EnableAPIScan + type: boolean + steps: - task: CredScan@3 @@ -17,6 +21,27 @@ steps: Function: analyze AnalyzeTarget: $(BinSkimTargets) +- task: CopyFiles@2 + displayName: Collect APIScan inputs + inputs: + SourceFolder: $(Build.ArtifactStagingDirectory)/Symbols-$(Agent.JobName) + # Exclude any patterns from the Contents (e.g. `!**/git2*`) that we have symbols for but do not need to run APIScan on. + Contents: | + ** + TargetFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs + +- task: APIScan@2 + displayName: Run APIScan + inputs: + softwareFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs + softwareName: $(SymbolsFeatureName) + softwareVersionNum: $(GitBuildVersion) + isLargeApp: false + toolVersion: Latest + condition: and(succeeded(), ${{ parameters.EnableAPIScan }}, ne(variables.ApiScanClientId, '')) + env: + AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) + - task: SdtReport@2 displayName: Create Security Analysis Report inputs: @@ -36,3 +61,13 @@ steps: inputs: GdnBreakAllTools: true GdnBreakGdnToolBinSkimSeverity: Warning + GdnBreakSuppressionFiles: $(System.DefaultWorkingDirectory)/azure-pipelines/falsepositives.gdnsuppress + GdnBreakSuppressionSets: falsepositives + GdnBreakOutputSuppressionFile: $(Build.ArtifactStagingDirectory)/guardian_failures_as_suppressions/ + GdnBreakOutputSuppressionSet: falsepositives + +# This is useful when false positives appear so we can copy some of the output into the suppressions file. +- publish: $(Build.ArtifactStagingDirectory)/guardian_failures_as_suppressions + artifact: guardian_failures_as_suppressions + displayName: Publish Guardian failures + condition: failed() From e4ef595f167a6848292a1c121bee85c7ae1cae09 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 3 Dec 2021 08:06:54 -0700 Subject: [PATCH 370/889] Patch AssemblyInfo.cs --- Apply-Template.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apply-Template.ps1 b/Apply-Template.ps1 index 544b7a7c..0d3f3d8e 100644 --- a/Apply-Template.ps1 +++ b/Apply-Template.ps1 @@ -22,6 +22,6 @@ robocopy /mir $PSScriptRoot/.github $Path/.github robocopy /mir $PSScriptRoot/.vscode $Path/.vscode robocopy /mir $PSScriptRoot/tools $Path/tools robocopy $PSScriptRoot $Path Directory.Build.* global.json init.* azure-pipelines.yml .gitignore .gitattributes .editorconfig -robocopy $PSScriptRoot/src $Path/src Directory.Build.* .editorconfig +robocopy $PSScriptRoot/src $Path/src Directory.Build.* .editorconfig AssemblyInfo.cs robocopy $PSScriptRoot/test $Path/test Directory.Build.* .editorconfig Remove-Item $Path/azure-pipelines/expand-template.yml From 7d02faa9b0662aa263dbd2cf068e473b2e911c8e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 3 Dec 2021 08:07:31 -0700 Subject: [PATCH 371/889] Skip copying APIScan inputs when APIScan is disabled --- azure-pipelines/secure-development-tools.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index e6b4d624..21eab9d3 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -29,6 +29,7 @@ steps: Contents: | ** TargetFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs + condition: and(succeeded(), ${{ parameters.EnableAPIScan }}, ne(variables.ApiScanClientId, '')) - task: APIScan@2 displayName: Run APIScan From 52d37aebaa5b7f119810d2fba3977006f99ef289 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 3 Dec 2021 08:15:02 -0700 Subject: [PATCH 372/889] Update Nerdbank.GitVersioning --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 2e771602..3b2b143b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -35,7 +35,7 @@ - + From c2b0252db640401aa5b1cf62f44d30e4298bff46 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 3 Dec 2021 11:48:23 -0700 Subject: [PATCH 373/889] Reduce frequency of changing version given to APIScan --- azure-pipelines/build.yml | 2 +- azure-pipelines/secure-development-tools.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 8523ab85..27ba5b5b 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -24,7 +24,7 @@ jobs: - template: install-dependencies.yml - - powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud -c' + - powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud -ca' displayName: Set build number - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index 21eab9d3..99925c13 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -36,7 +36,7 @@ steps: inputs: softwareFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs softwareName: $(SymbolsFeatureName) - softwareVersionNum: $(GitBuildVersion) + softwareVersionNum: $(NBGV_MajorMinorVersion) isLargeApp: false toolVersion: Latest condition: and(succeeded(), ${{ parameters.EnableAPIScan }}, ne(variables.ApiScanClientId, '')) From 4f87de906bc58b5b6a505c4eadbd7ff6068ac60a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 6 Jan 2022 12:39:52 -0700 Subject: [PATCH 374/889] Bump BinSkim to v4 --- azure-pipelines/secure-development-tools.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index 99925c13..c5ebf04e 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -14,12 +14,13 @@ steps: targetArgument: $(System.DefaultWorkingDirectory) optionsUEPATH: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml -- task: BinSkim@3 +- task: BinSkim@4 displayName: Run BinSkim inputs: InputType: Basic Function: analyze - AnalyzeTarget: $(BinSkimTargets) + TargetPattern: guardianGlob + AnalyzeTargetGlob: $(BinSkimTargets) - task: CopyFiles@2 displayName: Collect APIScan inputs From c31f6ad1e0ffaf45e333da288419a9e17529f2b0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 13 Jan 2022 08:26:38 -0700 Subject: [PATCH 375/889] Fix Expand-Template to replace tokens in AssemblyInfo.cs --- Expand-Template.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 9e4d4973..d203d85f 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -145,6 +145,9 @@ try { 'Library'=$LibraryName 'COMPANY-PLACEHOLDER'=$Author } + Replace-Placeholders -Path "src/AssemblyInfo.cs" -Replacements @{ + 'COMPANY-PLACEHOLDER'=$Author + } Replace-Placeholders -Path "LICENSE" -Replacements @{ 'COMPANY-PLACEHOLDER'=$Author } From 6cf12a28d7447b8921e2854937ee09d1a10b8bbb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 13 Jan 2022 08:09:07 -0700 Subject: [PATCH 376/889] Enable publishing of artifacts in multiple passes When an artifact is not ready yet, but other artifacts are and must be prepared, we can now run `artifacts/_pipelines.ps1` multiple times in the pipeline. To opt out of an earlier pass, the artifact script need only produce 0 files. After an artifact script returns some files, that artifact will be published and will not be published again. This is similar to `variables/_pipelines.ps1` behavior, which we already run twice. --- azure-pipelines/artifacts/_all.ps1 | 84 ++++++++++++++---------- azure-pipelines/artifacts/_pipelines.ps1 | 5 ++ azure-pipelines/artifacts/_stage_all.ps1 | 2 +- 3 files changed, 55 insertions(+), 36 deletions(-) diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1 index db10c5ff..afe42be3 100755 --- a/azure-pipelines/artifacts/_all.ps1 +++ b/azure-pipelines/artifacts/_all.ps1 @@ -1,18 +1,24 @@ #!/usr/bin/env pwsh -# This script returns all the artifacts that should be collected after a build. -# -# Each powershell artifact is expressed as an object with these properties: -# Source - the full path to the source file -# ArtifactName - the name of the artifact to upload to -# ContainerFolder - the relative path within the artifact in which the file should appear -# -# Each artifact aggregating .ps1 script should return a hashtable: -# Key = path to the directory from which relative paths within the artifact should be calculated -# Value = an array of paths (absolute or relative to the BaseDirectory) to files to include in the artifact. -# FileInfo objects are also allowed. - -$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") +<# +.SYNOPSIS + This script returns all the artifacts that should be collected after a build. + Each powershell artifact is expressed as an object with these properties: + Source - the full path to the source file + ArtifactName - the name of the artifact to upload to + ContainerFolder - the relative path within the artifact in which the file should appear + Each artifact aggregating .ps1 script should return a hashtable: + Key = path to the directory from which relative paths within the artifact should be calculated + Value = an array of paths (absolute or relative to the BaseDirectory) to files to include in the artifact. + FileInfo objects are also allowed. +.PARAMETER Force + Executes artifact scripts even if they have already been uploaded. +#> + +param ( + [string]$ArtifactNameSuffix, + [switch]$Force +) Function EnsureTrailingSlash($path) { if ($path.length -gt 0 -and !$path.EndsWith('\') -and !$path.EndsWith('/')) { @@ -22,35 +28,43 @@ Function EnsureTrailingSlash($path) { $path.Replace('\', [IO.Path]::DirectorySeparatorChar) } -Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% { - $ArtifactName = $_.BaseName +Function Test-ArtifactUploaded($artifactName) { + $varName = "ARTIFACTUPLOADED_$($artifactName.ToUpper())" + Test-Path "env:$varName" +} - $totalFileCount = 0 - $fileGroups = & $_ - if ($fileGroups) { - $fileGroups.GetEnumerator() | % { - $BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key.ToString()), [UriKind]::Absolute) - $_.Value | % { - if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) { - $_ = $_.FullName - } +Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse | % { + $ArtifactName = $_.BaseName + if ($Force -or !(Test-ArtifactUploaded($ArtifactName + $ArtifactNameSuffix))) { + $totalFileCount = 0 + $fileGroups = & $_ + if ($fileGroups) { + $fileGroups.GetEnumerator() | % { + $BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key.ToString()), [UriKind]::Absolute) + $_.Value | ? { $_ } | % { + if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) { + $_ = $_.FullName + } - $artifact = New-Object -TypeName PSObject - Add-Member -InputObject $artifact -MemberType NoteProperty -Name ArtifactName -Value $ArtifactName + $artifact = New-Object -TypeName PSObject + Add-Member -InputObject $artifact -MemberType NoteProperty -Name ArtifactName -Value $ArtifactName - $SourceFullPath = New-Object Uri ($BaseDirectory, $_) - Add-Member -InputObject $artifact -MemberType NoteProperty -Name Source -Value $SourceFullPath.LocalPath + $SourceFullPath = New-Object Uri ($BaseDirectory, $_) + Add-Member -InputObject $artifact -MemberType NoteProperty -Name Source -Value $SourceFullPath.LocalPath - $RelativePath = [Uri]::UnescapeDataString($BaseDirectory.MakeRelative($SourceFullPath)) - Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath) + $RelativePath = [Uri]::UnescapeDataString($BaseDirectory.MakeRelative($SourceFullPath)) + Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath) - Write-Output $artifact - $totalFileCount += 1 + Write-Output $artifact + $totalFileCount += 1 + } } } - } - if ($totalFileCount -eq 0) { - Write-Warning "No files found for the `"$ArtifactName`" artifact." + if ($totalFileCount -eq 0) { + Write-Warning "No files found for the `"$ArtifactName`" artifact." + } + } else { + Write-Host "Skipping $ArtifactName because it has already been uploaded." -ForegroundColor DarkGray } } diff --git a/azure-pipelines/artifacts/_pipelines.ps1 b/azure-pipelines/artifacts/_pipelines.ps1 index 5bca7c6c..73a3af0a 100644 --- a/azure-pipelines/artifacts/_pipelines.ps1 +++ b/azure-pipelines/artifacts/_pipelines.ps1 @@ -7,4 +7,9 @@ param ( & "$PSScriptRoot/_stage_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix |% { Write-Host "##vso[artifact.upload containerfolder=$($_.Name);artifactname=$($_.Name);]$($_.Path)" + + # Set a variable which will out-live this script so that a subsequent attempt to collect and upload artifacts + # will skip this one from a check in the _all.ps1 script. + $varName = "ARTIFACTUPLOADED_$($_.Name.ToUpper())" + Write-Host "##vso[task.setvariable variable=$varName]true" } diff --git a/azure-pipelines/artifacts/_stage_all.ps1 b/azure-pipelines/artifacts/_stage_all.ps1 index 4e6a6dbe..4788a3f5 100644 --- a/azure-pipelines/artifacts/_stage_all.ps1 +++ b/azure-pipelines/artifacts/_stage_all.ps1 @@ -38,7 +38,7 @@ function Create-SymbolicLink { } # Stage all artifacts -$Artifacts = & "$PSScriptRoot\_all.ps1" +$Artifacts = & "$PSScriptRoot\_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix $Artifacts |% { $DestinationFolder = (Join-Path (Join-Path $ArtifactStagingFolder "$($_.ArtifactName)$ArtifactNameSuffix") $_.ContainerFolder).TrimEnd('\') $Name = "$(Split-Path $_.Source -Leaf)" From 6235412ac9f7bb02c49be49821f329fc30d7499f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 13 Jan 2022 11:21:05 -0700 Subject: [PATCH 377/889] Build SBOM manifest as part of build --- Expand-Template.ps1 | 3 +++ azure-pipelines/artifacts/VSInsertion.ps1 | 3 +++ azure-pipelines/build.yml | 5 +++++ azure-pipelines/microbuild.after.yml | 9 +++++++++ azure-pipelines/official.yml | 1 + 5 files changed, 21 insertions(+) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 8d4c2f4b..5705e722 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -155,6 +155,9 @@ try { $YmlReplacements['(codecov_token: ).*(#.*)'] = "#`$1`$2" } Replace-Placeholders -Path "azure-pipelines.yml" -Replacements $YmlReplacements + Replace-Placeholders -Path "azure-pipelines/microbuild.after.yml" -Replacements @{ + 'Library' = $LibraryName; + } Replace-Placeholders -Path "azure-pipelines/variables/InsertVersionsValues.ps1" -Replacements @{ 'LibraryName' = $LibraryName; diff --git a/azure-pipelines/artifacts/VSInsertion.ps1 b/azure-pipelines/artifacts/VSInsertion.ps1 index 88cab0f8..80e621e7 100644 --- a/azure-pipelines/artifacts/VSInsertion.ps1 +++ b/azure-pipelines/artifacts/VSInsertion.ps1 @@ -8,6 +8,9 @@ if (!$BuildConfiguration) { $PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration/NuGet" +# This artifact is not ready if we're running on the devdiv AzDO account and we don't have an SBOM yet. +if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9' -and -not (Test-Path $PackagesRoot/_manifest)) { return @{} } + if (!(Test-Path $PackagesRoot)) { return @{} } @{ diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 27ba5b5b..1d003eb1 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -36,6 +36,11 @@ jobs: - template: microbuild.after.yml parameters: EnableAPIScan: ${{ parameters.EnableAPIScan }} + # Repeat this step to scoop up any artifacts that would only be collected after running microbuild.after.yml + - powershell: azure-pipelines/artifacts/_pipelines.ps1 -ArtifactNameSuffix "-$(Agent.JobName)" + failOnStderr: true + displayName: Publish artifacts + condition: succeededOrFailed() - template: expand-template.yml diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 6f107833..e889a464 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -13,6 +13,15 @@ steps: condition: succeededOrFailed() displayName: MicroBuild Cleanup +- task: ManifestGeneratorTask@0 + displayName: Software Bill of Materials generation + inputs: + BuildDropPath: $(System.DefaultWorkingDirectory)/bin/Library/$(BuildConfiguration) + BuildComponentPath: $(System.DefaultWorkingDirectory)/obj/src/Library + +- powershell: Copy-Item -Recurse "$(System.DefaultWorkingDirectory)/bin/Library/$(BuildConfiguration)/_manifest" "$(System.DefaultWorkingDirectory)/bin/Packages/$(BuildConfiguration)/NuGet" + displayName: Publish Software Bill of Materials + - task: Ref12Analyze@0 displayName: Ref12 (Codex) Analyze inputs: diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index bac667b6..3fca0999 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -45,6 +45,7 @@ stages: push_to_ci: true NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages SignTypeSelection: ${{ parameters.SignTypeSelection }} + Packaging.EnableSBOMSigning: true jobs: - template: build.yml From d581062a43eafc81b1320c18656d2d1eb9519ca2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 13 Jan 2022 16:06:27 -0700 Subject: [PATCH 378/889] Retain inserted builds for two years --- azure-pipelines/vs-insertion.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 6aef7889..9f09b8ef 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -49,3 +49,12 @@ stages: AutoCompleteMergeStrategy: Squash - task: MicroBuildCleanup@1 displayName: Send Telemetry + - powershell: | + $contentType = 'application/json'; + $headers = @{ Authorization = 'Bearer $(System.AccessToken)' }; + $rawRequest = @{ daysValid = 365 * 2; definitionId = $(resources.pipeline.CI.pipelineID); ownerId = 'User:$(Build.RequestedForId)'; protectPipeline = $false; runId = $(resources.pipeline.CI.runId) }; + $request = ConvertTo-Json @($rawRequest); + Write-Host $request + $uri = "$(System.CollectionUri)$(System.TeamProject)/_apis/build/retention/leases?api-version=6.0-preview.1"; + Invoke-RestMethod -uri $uri -method POST -Headers $headers -ContentType $contentType -Body $request; + displayName: Retain inserted builds From d2aa6efa1e59faa9a36e6eec093ced72fe62e8b1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 21 Jan 2022 08:01:13 -0700 Subject: [PATCH 379/889] Fix symbol archival step Symbol archival was failing when InsertConfigValues.ps1 was running from a downloaded artifact, but it is only designed to run within the repo. It failed within the repo because VSInsertion.ps1 started returning an empty set of files due to the recent SBOM change in 6235412: Build SBOM manifest as part of build The fix is to give the scripts a way to communicate that the SBOM is not relevant so that InsertConfigValues can still run when required. --- azure-pipelines/artifacts/VSInsertion.ps1 | 10 +++++++++- azure-pipelines/release-deployment-prep.yml | 2 +- azure-pipelines/variables/InsertConfigValues.ps1 | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/artifacts/VSInsertion.ps1 b/azure-pipelines/artifacts/VSInsertion.ps1 index 80e621e7..4c56deab 100644 --- a/azure-pipelines/artifacts/VSInsertion.ps1 +++ b/azure-pipelines/artifacts/VSInsertion.ps1 @@ -1,5 +1,13 @@ # This artifact captures everything needed to insert into VS (NuGet packages, insertion metadata, etc.) +<# +.PARAMETER SbomNotRequired + Indicates that returning the artifacts available is preferable to nothing at all when the SBOM has not yet been generated. +#> +Param ( + [switch]$SbomNotRequired +) + $RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") $BuildConfiguration = $env:BUILDCONFIGURATION if (!$BuildConfiguration) { @@ -9,7 +17,7 @@ if (!$BuildConfiguration) { $PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration/NuGet" # This artifact is not ready if we're running on the devdiv AzDO account and we don't have an SBOM yet. -if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9' -and -not (Test-Path $PackagesRoot/_manifest)) { return @{} } +if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9' -and -not (Test-Path $PackagesRoot/_manifest) -and -not $SbomNotRequired) { return @{} } if (!(Test-Path $PackagesRoot)) { return @{} } diff --git a/azure-pipelines/release-deployment-prep.yml b/azure-pipelines/release-deployment-prep.yml index 6dee28e5..059fd1d0 100644 --- a/azure-pipelines/release-deployment-prep.yml +++ b/azure-pipelines/release-deployment-prep.yml @@ -3,7 +3,7 @@ steps: artifact: Variables-Windows displayName: Download Variables-Windows artifact - task: PowerShell@2 - displayName: Set VSTS variables based on artifacts + displayName: Set pipeline variables based on artifacts inputs: targetType: filePath filePath: $(Pipeline.Workspace)/CI/Variables-Windows/_pipelines.ps1 diff --git a/azure-pipelines/variables/InsertConfigValues.ps1 b/azure-pipelines/variables/InsertConfigValues.ps1 index ddc472eb..efed018c 100644 --- a/azure-pipelines/variables/InsertConfigValues.ps1 +++ b/azure-pipelines/variables/InsertConfigValues.ps1 @@ -1,4 +1,4 @@ -$InsertedPkgs = (& "$PSScriptRoot\..\artifacts\VSInsertion.ps1") +$InsertedPkgs = (& "$PSScriptRoot\..\artifacts\VSInsertion.ps1" -SbomNotRequired) $icv=@() foreach ($kvp in $InsertedPkgs.GetEnumerator()) { From c01e120589f2d9642b78335c219f65540aad7adb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Feb 2022 08:24:29 -0700 Subject: [PATCH 380/889] Bump coverlet.msbuild from 3.1.0 to 3.1.1 (#134) Bumps [coverlet.msbuild](https://github.com/coverlet-coverage/coverlet) from 3.1.0 to 3.1.1. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/commits) --- updated-dependencies: - dependency-name: coverlet.msbuild dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index ebd5df8f..b3fc51f0 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,7 +10,7 @@ - + From 88988319bebd9cdd5390de9f79e1000d34a24e88 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 1 Feb 2022 10:20:25 -0700 Subject: [PATCH 381/889] Update StyleCop.Analyzers Switch to the .Unstable package ID so that dependabot will help us keep it current even though it seems to be ever-unstable lately. --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 3b2b143b..f913d080 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -37,7 +37,7 @@ - + From ad7449bd60ea86c89861957843a7293d3b4a8e56 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 1 Feb 2022 10:52:26 -0700 Subject: [PATCH 382/889] Update sample test, which was sporting dead code --- test/Library.Tests/CalculatorTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/CalculatorTests.cs b/test/Library.Tests/CalculatorTests.cs index 44e89aaa..042e7d94 100644 --- a/test/Library.Tests/CalculatorTests.cs +++ b/test/Library.Tests/CalculatorTests.cs @@ -14,7 +14,7 @@ public CalculatorTests() public void AddOrSubtract() { // This tests aggregation of code coverage across test runs. -#if NETCOREAPP2_1 +#if NETCOREAPP3_1 Assert.Equal(3, Calculator.Add(1, 2)); #else Assert.Equal(-1, Calculator.Subtract(1, 2)); From 8ef6d0681b469e121d77080262383498fb22f96c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 2 Feb 2022 20:47:23 -0700 Subject: [PATCH 383/889] Update Nerdbank.GitVersioning --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index f913d080..e6f1f4ad 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -35,7 +35,7 @@ - + From ae5e025248ae617c174e42fe5d934b07890f34e3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 2 Feb 2022 20:50:26 -0700 Subject: [PATCH 384/889] Add explanatory comment for using unstable stylecop id --- Directory.Build.props | 1 + 1 file changed, 1 insertion(+) diff --git a/Directory.Build.props b/Directory.Build.props index e6f1f4ad..a8f35b37 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -37,6 +37,7 @@ + From d043d36952bfd1e79428ca0657a98ff38b7813a2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 2 Feb 2022 21:50:53 -0700 Subject: [PATCH 385/889] Update MicroBuild version --- Directory.Build.props | 2 +- init.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 65219a6f..aef458c1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -28,7 +28,7 @@ true snupkg - 2.0.66 + 2.0.68 diff --git a/init.ps1 b/init.ps1 index 043d4551..0a7e1cbd 100755 --- a/init.ps1 +++ b/init.ps1 @@ -114,7 +114,7 @@ try { if ($Setup) { Write-Host "Installing MicroBuild SwixBuild plugin..." -ForegroundColor $HeaderColor - & $InstallNuGetPkgScriptPath MicroBuild.Plugins.SwixBuild -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + & $InstallNuGetPkgScriptPath Microsoft.VisualStudioEng.MicroBuild.Plugins.SwixBuild -source $MicroBuildPackageSource -Verbosity $nugetVerbosity } if ($OptProf) { From dcf939351c44b76905308cb5dbc85bb385e48f92 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Feb 2022 09:33:45 -0700 Subject: [PATCH 386/889] Capture netcoreapp3.1 TFM test crash dump naming pattern on linux --- azure-pipelines/artifacts/testResults.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/artifacts/testResults.ps1 b/azure-pipelines/artifacts/testResults.ps1 index 862155da..2f894c97 100644 --- a/azure-pipelines/artifacts/testResults.ps1 +++ b/azure-pipelines/artifacts/testResults.ps1 @@ -3,7 +3,9 @@ $result = @{} if ($env:AGENT_TEMPDIRECTORY) { # The DotNetCoreCLI uses an alternate location to publish these files $guidRegex = '^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$' - $result[$env:AGENT_TEMPDIRECTORY] = (Get-ChildItem $env:AGENT_TEMPDIRECTORY -Directory |? { $_.Name -match $guidRegex } |% { Get-ChildItem "$($_.FullName)\dotnet*.dmp","$($_.FullName)\testhost*.dmp","$($_.FullName)\Sequence_*.xml" -Recurse }); + $result[$env:AGENT_TEMPDIRECTORY] = (Get-ChildItem $env:AGENT_TEMPDIRECTORY -Directory |? { $_.Name -match $guidRegex } |% { + Get-ChildItem "$($_.FullName)\dotnet*.dmp","$($_.FullName)\*_crashdump.dmp","$($_.FullName)\testhost*.dmp","$($_.FullName)\Sequence_*.xml" -Recurse + }); } else { $testRoot = Resolve-Path "$PSScriptRoot\..\..\test" From 4a85ff84c82c79b9d800eadaa3a99c83b0e5ce3d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Feb 2022 09:12:58 -0700 Subject: [PATCH 387/889] Replace runsettings files with switches --- .github/workflows/Linux.runsettings | 12 ------------ .github/workflows/Windows.runsettings | 12 ------------ .github/workflows/build.yml | 2 +- .github/workflows/macOS.runsettings | 12 ------------ azure-pipelines/Darwin.runsettings | 12 ------------ azure-pipelines/Linux.runsettings | 12 ------------ azure-pipelines/Windows_NT.runsettings | 12 ------------ azure-pipelines/dotnet.yml | 6 +++--- 8 files changed, 4 insertions(+), 76 deletions(-) delete mode 100644 .github/workflows/Linux.runsettings delete mode 100644 .github/workflows/Windows.runsettings delete mode 100644 .github/workflows/macOS.runsettings delete mode 100644 azure-pipelines/Darwin.runsettings delete mode 100644 azure-pipelines/Linux.runsettings delete mode 100644 azure-pipelines/Windows_NT.runsettings diff --git a/.github/workflows/Linux.runsettings b/.github/workflows/Linux.runsettings deleted file mode 100644 index db20611f..00000000 --- a/.github/workflows/Linux.runsettings +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/.github/workflows/Windows.runsettings b/.github/workflows/Windows.runsettings deleted file mode 100644 index db20611f..00000000 --- a/.github/workflows/Windows.runsettings +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8499b90..ba968ab8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: - name: pack run: dotnet pack --no-build -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/pack.binlog" - name: test - run: dotnet test --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --logger trx --settings "${{ github.workspace }}/.github/workflows/${{ runner.os }}.runsettings" + run: dotnet test --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --logger trx --blame-hang-timeout 30s --blame-crash" - name: Update pipeline variables based on build outputs run: azure-pipelines/variables/_pipelines.ps1 shell: pwsh diff --git a/.github/workflows/macOS.runsettings b/.github/workflows/macOS.runsettings deleted file mode 100644 index db20611f..00000000 --- a/.github/workflows/macOS.runsettings +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/azure-pipelines/Darwin.runsettings b/azure-pipelines/Darwin.runsettings deleted file mode 100644 index db20611f..00000000 --- a/azure-pipelines/Darwin.runsettings +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/azure-pipelines/Linux.runsettings b/azure-pipelines/Linux.runsettings deleted file mode 100644 index db20611f..00000000 --- a/azure-pipelines/Linux.runsettings +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/azure-pipelines/Windows_NT.runsettings b/azure-pipelines/Windows_NT.runsettings deleted file mode 100644 index db20611f..00000000 --- a/azure-pipelines/Windows_NT.runsettings +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 70cd23ee..506eb645 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -10,7 +10,7 @@ steps: displayName: dotnet test -f net472 inputs: command: test - arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net472.binlog" --diag "$(Build.ArtifactStagingDirectory)/test_logs/net472.txt" + arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --blame-hang-timeout 30s --blame-crash /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net472.binlog" --diag "$(Build.ArtifactStagingDirectory)/test_logs/net472.txt;TraceLevel=info" testRunTitle: net472-$(Agent.JobName) condition: succeededOrFailed() @@ -18,7 +18,7 @@ steps: displayName: dotnet test -f netcoreapp3.1 inputs: command: test - arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_netcoreapp3.1.binlog" --diag "$(Build.ArtifactStagingDirectory)/test_logs/netcoreapp3.1.txt" + arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --blame-hang-timeout 30s --blame-crash /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_netcoreapp3.1.binlog" --diag "$(Build.ArtifactStagingDirectory)/test_logs/netcoreapp3.1.txt;TraceLevel=info" testRunTitle: netcoreapp3.1-$(Agent.JobName) condition: succeededOrFailed() @@ -26,7 +26,7 @@ steps: displayName: dotnet test -f net5.0 inputs: command: test - arguments: --no-build -c $(BuildConfiguration) -f net5.0 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings" /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net5.0.binlog" --diag "$(Build.ArtifactStagingDirectory)/test_logs/net5.0.txt" + arguments: --no-build -c $(BuildConfiguration) -f net5.0 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --blame-hang-timeout 30s --blame-crash /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net5.0.binlog" --diag "$(Build.ArtifactStagingDirectory)/test_logs/net5.0.txt;TraceLevel=info" testRunTitle: net5.0-$(Agent.JobName) condition: succeededOrFailed() From 9fb050e9d04dc1eb1a0257c239fc557637d74efc Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Feb 2022 12:32:40 -0700 Subject: [PATCH 388/889] Fix GitHub workflow file syntax error (#137) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba968ab8..3be17746 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: - name: pack run: dotnet pack --no-build -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/pack.binlog" - name: test - run: dotnet test --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --logger trx --blame-hang-timeout 30s --blame-crash" + run: dotnet test --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --logger trx --blame-hang-timeout 30s --blame-crash - name: Update pipeline variables based on build outputs run: azure-pipelines/variables/_pipelines.ps1 shell: pwsh From da8eef4ed65b12c824b3b2782a4c503fe1b68a4c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Feb 2022 12:39:56 -0700 Subject: [PATCH 389/889] Build and pack in one step --- .github/workflows/build.yml | 4 +--- azure-pipelines/dotnet.yml | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3be17746..574cf524 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,9 +39,7 @@ jobs: run: azure-pipelines/variables/_pipelines.ps1 shell: pwsh - name: build - run: dotnet build --no-restore -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/build.binlog" - - name: pack - run: dotnet pack --no-build -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/pack.binlog" + run: dotnet build -t:build,pack --no-restore -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/build.binlog" - name: test run: dotnet test --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --logger trx --blame-hang-timeout 30s --blame-crash - name: Update pipeline variables based on build outputs diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 506eb645..d7469c64 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -1,11 +1,8 @@ steps: -- script: dotnet build --no-restore -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" +- script: dotnet build -t:build,pack --no-restore -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" displayName: dotnet build -- script: dotnet pack --no-build -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/pack.binlog" - displayName: dotnet pack - - task: DotNetCoreCLI@2 displayName: dotnet test -f net472 inputs: From 1699ddf88159c2fc54a8488592df939fb3708398 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Feb 2022 09:59:54 -0700 Subject: [PATCH 390/889] Replace several `DotNetCoreCLI` task with one `dotnet test` task Closes #136 --- .../Get-ArtifactsStagingDirectory.ps1 | 13 +++++++ azure-pipelines/artifacts/_stage_all.ps1 | 9 +---- azure-pipelines/dotnet-test-cloud.ps1 | 37 +++++++++++++++++++ azure-pipelines/dotnet.yml | 25 +------------ 4 files changed, 53 insertions(+), 31 deletions(-) create mode 100644 azure-pipelines/Get-ArtifactsStagingDirectory.ps1 create mode 100644 azure-pipelines/dotnet-test-cloud.ps1 diff --git a/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 b/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 new file mode 100644 index 00000000..d96b1610 --- /dev/null +++ b/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 @@ -0,0 +1,13 @@ +Param( + [switch]$CleanIfLocal +) +if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { + $ArtifactStagingFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY +} else { + $ArtifactStagingFolder = Join-Path (Resolve-Path $PSScriptRoot/..) (Join-Path obj _artifacts) + if ($CleanIfLocal -and (Test-Path $ArtifactStagingFolder)) { + Remove-Item $ArtifactStagingFolder -Recurse -Force + } +} + +$ArtifactStagingFolder diff --git a/azure-pipelines/artifacts/_stage_all.ps1 b/azure-pipelines/artifacts/_stage_all.ps1 index 4788a3f5..af398a2e 100644 --- a/azure-pipelines/artifacts/_stage_all.ps1 +++ b/azure-pipelines/artifacts/_stage_all.ps1 @@ -7,14 +7,7 @@ param ( ) $RepoRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot (Join-Path .. ..))) -if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { - $ArtifactStagingFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY -} else { - $ArtifactStagingFolder = Join-Path $RepoRoot (Join-Path obj _artifacts) - if (Test-Path $ArtifactStagingFolder) { - Remove-Item $ArtifactStagingFolder -Recurse -Force - } -} +$ArtifactStagingFolder = & "$PSScriptRoot/../Get-ArtifactsStagingDirectory.ps1" -CleanIfLocal function Create-SymbolicLink { param ( diff --git a/azure-pipelines/dotnet-test-cloud.ps1 b/azure-pipelines/dotnet-test-cloud.ps1 new file mode 100644 index 00000000..c8642453 --- /dev/null +++ b/azure-pipelines/dotnet-test-cloud.ps1 @@ -0,0 +1,37 @@ +Param( + [string]$Configuration='Debug', + [string]$Agent='Local', + [switch]$PublishResults +) + +$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot '..') +$ArtifactStagingFolder = & "$PSScriptRoot/Get-ArtifactsStagingDirectory.ps1" + +dotnet test $RepoRoot ` + --no-build ` + -c $Configuration ` + --filter "TestCategory!=FailsInCloudTest" ` + -p:CollectCoverage=true ` + --blame-hang-timeout 30s ` + --blame-crash ` + -bl:"$ArtifactStagingFolder/build_logs/test.binlog" ` + --diag "$ArtifactStagingFolder/test_logs/diag.log;TraceLevel=info" ` + --logger trx + +$unknownCounter = 0 +Get-ChildItem -Recurse -Path $RepoRoot\test\*.trx |% { + Copy-Item $_ -Destination $ArtifactStagingFolder/test_logs/ + + if ($PublishResults) { + $x = [xml](Get-Content -Path $_) + $storage = $x.TestRun.TestDefinitions.GetElementsByTagName('UnitTest')[0].storage -replace '\\','/' + if ($storage -match '/(?[^/]+)/(?[^/]+)\.dll$') { + $runTitle = "$($matches.lib) ($($matches.tfm), $Agent)" + } else { + $unknownCounter += 1; + $runTitle = "unknown$unknownCounter ($Agent)"; + } + + Write-Host "##vso[results.publish type=VSTest;runTitle=$runTitle;publishRunAttachments=true;resultFiles=$_;failTaskOnFailedTests=true;testRunSystem=VSTS - PTR;]" + } +} diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index d7469c64..2d2d7027 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -3,29 +3,8 @@ steps: - script: dotnet build -t:build,pack --no-restore -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" displayName: dotnet build -- task: DotNetCoreCLI@2 - displayName: dotnet test -f net472 - inputs: - command: test - arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --blame-hang-timeout 30s --blame-crash /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net472.binlog" --diag "$(Build.ArtifactStagingDirectory)/test_logs/net472.txt;TraceLevel=info" - testRunTitle: net472-$(Agent.JobName) - condition: succeededOrFailed() - -- task: DotNetCoreCLI@2 - displayName: dotnet test -f netcoreapp3.1 - inputs: - command: test - arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --blame-hang-timeout 30s --blame-crash /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_netcoreapp3.1.binlog" --diag "$(Build.ArtifactStagingDirectory)/test_logs/netcoreapp3.1.txt;TraceLevel=info" - testRunTitle: netcoreapp3.1-$(Agent.JobName) - condition: succeededOrFailed() - -- task: DotNetCoreCLI@2 - displayName: dotnet test -f net5.0 - inputs: - command: test - arguments: --no-build -c $(BuildConfiguration) -f net5.0 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --blame-hang-timeout 30s --blame-crash /bl:"$(Build.ArtifactStagingDirectory)/build_logs/test_net5.0.binlog" --diag "$(Build.ArtifactStagingDirectory)/test_logs/net5.0.txt;TraceLevel=info" - testRunTitle: net5.0-$(Agent.JobName) - condition: succeededOrFailed() +- powershell: azure-pipelines/dotnet-test-cloud.ps1 -Configuration $(BuildConfiguration) -Agent $(Agent.JobName) -PublishResults + displayName: dotnet test - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true From 04f05d67b81aacbdfd9cd5c89c57425a55f2a727 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Feb 2022 13:29:25 -0700 Subject: [PATCH 391/889] Drop redundant build verbosity switch --- azure-pipelines/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 2d2d7027..86b7eb82 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -1,6 +1,6 @@ steps: -- script: dotnet build -t:build,pack --no-restore -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" +- script: dotnet build -t:build,pack --no-restore -c $(BuildConfiguration) /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" displayName: dotnet build - powershell: azure-pipelines/dotnet-test-cloud.ps1 -Configuration $(BuildConfiguration) -Agent $(Agent.JobName) -PublishResults From 849e4b8e01691f784a9a74385a225ec82c5e8068 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Feb 2022 15:25:48 -0700 Subject: [PATCH 392/889] Simplify Join-Path expressions --- azure-pipelines/Get-ArtifactsStagingDirectory.ps1 | 2 +- azure-pipelines/artifacts/Variables.ps1 | 8 ++++---- azure-pipelines/artifacts/_stage_all.ps1 | 3 +-- azure-pipelines/dotnet-test-cloud.ps1 | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 b/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 index d96b1610..723574f5 100644 --- a/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 +++ b/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 @@ -4,7 +4,7 @@ Param( if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { $ArtifactStagingFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY } else { - $ArtifactStagingFolder = Join-Path (Resolve-Path $PSScriptRoot/..) (Join-Path obj _artifacts) + $ArtifactStagingFolder = [System.IO.Path]::GetFullPath("$PSScriptRoot/../obj/_artifacts") if ($CleanIfLocal -and (Test-Path $ArtifactStagingFolder)) { Remove-Item $ArtifactStagingFolder -Recurse -Force } diff --git a/azure-pipelines/artifacts/Variables.ps1 b/azure-pipelines/artifacts/Variables.ps1 index c6330cd3..4bc6d216 100644 --- a/azure-pipelines/artifacts/Variables.ps1 +++ b/azure-pipelines/artifacts/Variables.ps1 @@ -2,13 +2,13 @@ # It "snaps" the values of these variables where we can compute them during the build, # and otherwise captures the scripts to run later during an Azure Pipelines environment release. -$RepoRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot (Join-Path .. ..))) -$ArtifactBasePath = Join-Path $RepoRoot (Join-Path obj _artifacts) +$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot/../..") +$ArtifactBasePath = "$RepoRoot/obj/_artifacts" $VariablesArtifactPath = Join-Path $ArtifactBasePath variables if (-not (Test-Path $VariablesArtifactPath)) { New-Item -ItemType Directory -Path $VariablesArtifactPath | Out-Null } # Copy variables, either by value if the value is calculable now, or by script -Get-ChildItem -Path (Join-Path $PSScriptRoot (Join-Path .. variables)) |% { +Get-ChildItem "$PSScriptRoot/../variables" |% { $value = $null if (-not $_.BaseName.StartsWith('_')) { # Skip trying to interpret special scripts # First check the environment variables in case the variable was set in a queued build @@ -35,7 +35,7 @@ Get-ChildItem -Path (Join-Path $PSScriptRoot (Join-Path .. variables)) |% { $value = Get-Content -Path $_.FullName } - Set-Content -Path (Join-Path $VariablesArtifactPath $_.Name) -Value $value + Set-Content -Path "$VariablesArtifactPath/$($_.Name)" -Value $value } @{ diff --git a/azure-pipelines/artifacts/_stage_all.ps1 b/azure-pipelines/artifacts/_stage_all.ps1 index af398a2e..87421d56 100644 --- a/azure-pipelines/artifacts/_stage_all.ps1 +++ b/azure-pipelines/artifacts/_stage_all.ps1 @@ -6,7 +6,6 @@ param ( [string]$ArtifactNameSuffix ) -$RepoRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot (Join-Path .. ..))) $ArtifactStagingFolder = & "$PSScriptRoot/../Get-ArtifactsStagingDirectory.ps1" -CleanIfLocal function Create-SymbolicLink { @@ -33,7 +32,7 @@ function Create-SymbolicLink { # Stage all artifacts $Artifacts = & "$PSScriptRoot\_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix $Artifacts |% { - $DestinationFolder = (Join-Path (Join-Path $ArtifactStagingFolder "$($_.ArtifactName)$ArtifactNameSuffix") $_.ContainerFolder).TrimEnd('\') + $DestinationFolder = [System.IO.Path]::GetFullPath("$ArtifactStagingFolder/$($_.ArtifactName)$ArtifactNameSuffix/$($_.ContainerFolder)").TrimEnd('\') $Name = "$(Split-Path $_.Source -Leaf)" #Write-Host "$($_.Source) -> $($_.ArtifactName)\$($_.ContainerFolder)" -ForegroundColor Yellow diff --git a/azure-pipelines/dotnet-test-cloud.ps1 b/azure-pipelines/dotnet-test-cloud.ps1 index c8642453..a7a63a02 100644 --- a/azure-pipelines/dotnet-test-cloud.ps1 +++ b/azure-pipelines/dotnet-test-cloud.ps1 @@ -4,7 +4,7 @@ Param( [switch]$PublishResults ) -$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot '..') +$RepoRoot = (Resolve-Path "$PSScriptRoot/..").Path $ArtifactStagingFolder = & "$PSScriptRoot/Get-ArtifactsStagingDirectory.ps1" dotnet test $RepoRoot ` From e9df7075913bfea945429fa29f1322c2fcdc6e30 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Feb 2022 16:11:09 -0700 Subject: [PATCH 393/889] Collect and publish symbols from every build agent Accommodates https://github.com/microsoft/azure-pipelines-tasks/issues/13821 by publish symbols on a Windows agent Closes #135 --- azure-pipelines/Convert-PDB.ps1 | 43 ---------------- azure-pipelines/Get-SymbolFiles.ps1 | 20 ++------ azure-pipelines/artifacts/symbols.ps1 | 1 + azure-pipelines/artifacts/test_symbols.ps1 | 9 +--- azure-pipelines/build.yml | 6 ++- azure-pipelines/dotnet.yml | 18 ------- azure-pipelines/publish-symbols.yml | 59 ++++++++++++++++++++++ 7 files changed, 70 insertions(+), 86 deletions(-) delete mode 100644 azure-pipelines/Convert-PDB.ps1 create mode 100644 azure-pipelines/publish-symbols.yml diff --git a/azure-pipelines/Convert-PDB.ps1 b/azure-pipelines/Convert-PDB.ps1 deleted file mode 100644 index 2d394e72..00000000 --- a/azure-pipelines/Convert-PDB.ps1 +++ /dev/null @@ -1,43 +0,0 @@ -<# -.SYNOPSIS - Converts between Windows PDB and Portable PDB formats. -.PARAMETER DllPath - The path to the DLL whose PDB is to be converted. -.PARAMETER PdbPath - The path to the PDB to convert. May be omitted if the DLL was compiled on this machine and the PDB is still at its original path. -.PARAMETER OutputPath - The path of the output PDB to write. -#> -#Function Convert-PortableToWindowsPDB() { - Param( - [Parameter(Mandatory=$true,Position=0)] - [string]$DllPath, - [Parameter()] - [string]$PdbPath, - [Parameter(Mandatory=$true,Position=1)] - [string]$OutputPath - ) - - if ($IsMacOS -or $IsLinux) { - Write-Error "This script only works on Windows" - return - } - - $version = '1.1.0-beta2-21101-01' - $baseDir = "$PSScriptRoot/../obj/tools" - $pdb2pdbpath = "$baseDir/Microsoft.DiaSymReader.Pdb2Pdb.$version/tools/Pdb2Pdb.exe" - if (-not (Test-Path $pdb2pdbpath)) { - if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null } - $baseDir = (Resolve-Path $baseDir).Path # Normalize it - Write-Verbose "& (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null" - & (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null - } - - $args = $DllPath,'/out',$OutputPath,'/nowarn','0021' - if ($PdbPath) { - $args += '/pdb',$PdbPath - } - - Write-Verbose "$pdb2pdbpath $args" - & $pdb2pdbpath $args -#} diff --git a/azure-pipelines/Get-SymbolFiles.ps1 b/azure-pipelines/Get-SymbolFiles.ps1 index 45afe7c2..d4c5289a 100644 --- a/azure-pipelines/Get-SymbolFiles.ps1 +++ b/azure-pipelines/Get-SymbolFiles.ps1 @@ -1,10 +1,10 @@ <# .SYNOPSIS - Collect the list of PDBs built in this repo, after converting them from portable to Windows PDBs. + Collect the list of PDBs built in this repo. .PARAMETER Path - The root path to recursively search for PDBs. + The directory to recursively search for PDBs. .PARAMETER Tests - A switch indicating to find test-related PDBs instead of product-only PDBs. + A switch indicating to find PDBs only for test binaries instead of only for shipping shipping binaries. #> [CmdletBinding()] param ( @@ -53,17 +53,5 @@ $PDBs |% { } Write-Output $BinaryImagePath - - if (-not ($IsMacOS -or $IsLinux)) { - # Convert the PDB to legacy Windows PDBs - Write-Host "Converting PDB for $_" -ForegroundColor DarkGray - $WindowsPdbDir = "$($_.Directory.FullName)\$WindowsPdbSubDirName" - if (!(Test-Path $WindowsPdbDir)) { mkdir $WindowsPdbDir | Out-Null } - & "$PSScriptRoot\Convert-PDB.ps1" -DllPath $BinaryImagePath -PdbPath $_ -OutputPath "$WindowsPdbDir\$($_.BaseName).pdb" - if ($LASTEXITCODE -ne 0) { - Write-Warning "PDB conversion of `"$_`" failed." - } - - Write-Output "$WindowsPdbDir\$($_.BaseName).pdb" - } + Write-Output $_.FullName } diff --git a/azure-pipelines/artifacts/symbols.ps1 b/azure-pipelines/artifacts/symbols.ps1 index 8704571e..9e2c7bd5 100644 --- a/azure-pipelines/artifacts/symbols.ps1 +++ b/azure-pipelines/artifacts/symbols.ps1 @@ -1,4 +1,5 @@ $BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot/../../bin") +if (!(Test-Path $BinPath)) { return } $symbolfiles = & "$PSScriptRoot/../Get-SymbolFiles.ps1" -Path $BinPath | Get-Unique @{ diff --git a/azure-pipelines/artifacts/test_symbols.ps1 b/azure-pipelines/artifacts/test_symbols.ps1 index d65ad0ae..ce2b6481 100644 --- a/azure-pipelines/artifacts/test_symbols.ps1 +++ b/azure-pipelines/artifacts/test_symbols.ps1 @@ -1,11 +1,6 @@ -# This doesn't work off Windows, nor do we need to convert symbols on multiple OS agents -if ($IsMacOS -or $IsLinux) { - return; -} - -$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin") +$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot/../../bin") if (!(Test-Path $BinPath)) { return } -$symbolfiles = & "$PSScriptRoot\..\Get-SymbolFiles.ps1" -Path $BinPath -Tests | Get-Unique +$symbolfiles = & "$PSScriptRoot/../Get-SymbolFiles.ps1" -Path $BinPath -Tests | Get-Unique @{ "$BinPath" = $SymbolFiles; diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 796be61d..f779fd12 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -45,8 +45,7 @@ jobs: - Windows - Linux - macOS - pool: - vmImage: Ubuntu 20.04 + pool: ${{ parameters.windowsPool }} # Use Windows agent because PublishSymbols task requires it (https://github.com/microsoft/azure-pipelines-tasks/issues/13821). condition: succeededOrFailed() steps: - checkout: self @@ -54,6 +53,9 @@ jobs: - template: install-dependencies.yml parameters: initArgs: -NoRestore + - template: publish-symbols.yml + parameters: + includeMacOS: ${{ parameters.includeMacOS }} - template: publish-codecoverage.yml parameters: includeMacOS: ${{ parameters.includeMacOS }} diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 86b7eb82..a103adfd 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -16,24 +16,6 @@ steps: displayName: Publish artifacts condition: succeededOrFailed() -- task: PublishSymbols@2 - inputs: - SymbolsFolder: $(Build.ArtifactStagingDirectory)/symbols-$(Agent.JobName) - SearchPattern: '**/*.pdb' - IndexSources: false - SymbolServerType: TeamServices - displayName: Publish symbols to symbol server - condition: eq(variables['Agent.OS'], 'Windows_NT') # Execute on failed test runs too. Windows-only till https://github.com/microsoft/azure-pipelines-tasks/issues/13821 is fixed. - -- task: PublishSymbols@2 - inputs: - SymbolsFolder: $(Build.ArtifactStagingDirectory)/test_symbols-$(Agent.JobName) - SearchPattern: '**/*.pdb' - IndexSources: false - SymbolServerType: TeamServices - displayName: Publish test symbols to symbol server - condition: and(failed(), eq(variables['Agent.OS'], 'Windows_NT')) # Execute on failed test runs only. - - bash: bash <(curl -s https://codecov.io/bash) displayName: Publish code coverage results to codecov.io condition: ne(variables['codecov_token'], '') diff --git a/azure-pipelines/publish-symbols.yml b/azure-pipelines/publish-symbols.yml new file mode 100644 index 00000000..c45eff02 --- /dev/null +++ b/azure-pipelines/publish-symbols.yml @@ -0,0 +1,59 @@ +parameters: + includeMacOS: + +steps: +- task: DownloadPipelineArtifact@2 + inputs: + artifact: symbols-Windows + path: $(Pipeline.Workspace)/symbols/Windows + displayName: Download Windows symbols + continueOnError: true +- task: DownloadPipelineArtifact@2 + inputs: + artifact: symbols-Linux + path: $(Pipeline.Workspace)/symbols/Linux + displayName: Download Linux symbols + continueOnError: true +- task: DownloadPipelineArtifact@2 + inputs: + artifact: symbols-macOS + path: $(Pipeline.Workspace)/symbols/macOS + displayName: Download macOS symbols + continueOnError: true + condition: ${{ parameters.includeMacOS }} + +- task: DownloadPipelineArtifact@2 + inputs: + artifact: test_symbols-Windows + path: $(Pipeline.Workspace)/test_symbols/Windows + displayName: Download Windows test symbols + continueOnError: true +- task: DownloadPipelineArtifact@2 + inputs: + artifact: test_symbols-Linux + path: $(Pipeline.Workspace)/test_symbols/Linux + displayName: Download Linux test symbols + continueOnError: true +- task: DownloadPipelineArtifact@2 + inputs: + artifact: test_symbols-macOS + path: $(Pipeline.Workspace)/test_symbols/macOS + displayName: Download macOS test symbols + continueOnError: true + condition: ${{ parameters.includeMacOS }} + +- task: PublishSymbols@2 + inputs: + SymbolsFolder: $(Pipeline.Workspace)/symbols + SearchPattern: '**/*.pdb' + IndexSources: false + SymbolServerType: TeamServices + displayName: Publish symbols + +- task: PublishSymbols@2 + inputs: + SymbolsFolder: $(Pipeline.Workspace)/test_symbols + SearchPattern: '**/*.pdb' + IndexSources: false + SymbolServerType: TeamServices + displayName: Publish test symbols From 6ecd99be42bc60e4bb359e84e9ec12dadc863403 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Feb 2022 16:20:49 -0700 Subject: [PATCH 394/889] Do not include product symbols with test symbols --- azure-pipelines/Get-SymbolFiles.ps1 | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/azure-pipelines/Get-SymbolFiles.ps1 b/azure-pipelines/Get-SymbolFiles.ps1 index d4c5289a..fccb1bb1 100644 --- a/azure-pipelines/Get-SymbolFiles.ps1 +++ b/azure-pipelines/Get-SymbolFiles.ps1 @@ -13,19 +13,12 @@ param ( [switch]$Tests ) -$WindowsPdbSubDirName = "symstore" - $ActivityName = "Collecting symbols from $Path" Write-Progress -Activity $ActivityName -CurrentOperation "Discovery PDB files" -$PDBs = Get-ChildItem -rec "$Path/*.pdb" |? { $_.FullName -notmatch "\W$WindowsPdbSubDirName\W" } +$PDBs = Get-ChildItem -rec "$Path/*.pdb" # Filter PDBs to product OR test related. $testregex = "unittest|tests" -if ($Tests) { - $PDBs = $PDBs |? { $_.FullName -match $testregex } -} else { - $PDBs = $PDBs |? { $_.FullName -notmatch $testregex } -} Write-Progress -Activity $ActivityName -CurrentOperation "De-duplicating symbols" $PDBsByHash = @{} @@ -42,6 +35,12 @@ $PDBs |% { $PDBsByHash.Add($_.Hash, $_.FullName) Write-Output $_ } +} |? { + if ($Tests) { + $_.FullName -match $testregex + } else { + $_.FullName -notmatch $testregex + } } |% { # Collect the DLLs/EXEs as well. $dllPath = "$($_.Directory)/$($_.BaseName).dll" From e67a6e4b39d1625ebcea0dcf89f34c458984e1d4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Feb 2022 17:38:54 -0700 Subject: [PATCH 395/889] Update GitHub Actions to more closely resemble AzP --- .github/workflows/build.yml | 31 +++++++++++++------ .../Get-ArtifactsStagingDirectory.ps1 | 2 ++ azure-pipelines/artifacts/build_logs.ps1 | 11 ++----- azure-pipelines/dotnet-test-cloud.ps1 | 2 ++ 4 files changed, 29 insertions(+), 17 deletions(-) mode change 100644 => 100755 azure-pipelines/dotnet-test-cloud.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 574cf524..18ae3e28 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,14 +34,20 @@ jobs: run: | ./init.ps1 -UpgradePrerequisites dotnet --info + + # Print mono version if it is present. + if (Get-Command mono -ErrorAction SilentlyContinue) { + mono --version + } shell: pwsh - name: Set pipeline variables based on source run: azure-pipelines/variables/_pipelines.ps1 shell: pwsh - name: build - run: dotnet build -t:build,pack --no-restore -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/build.binlog" + run: dotnet build -t:build,pack --no-restore -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog" - name: test - run: dotnet test --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --logger trx --blame-hang-timeout 30s --blame-crash + run: azure-pipelines/dotnet-test-cloud.ps1 -Configuration ${{ env.BUILDCONFIGURATION }} -Agent ${{ runner.os }} + shell: pwsh - name: Update pipeline variables based on build outputs run: azure-pipelines/variables/_pipelines.ps1 shell: pwsh @@ -54,46 +60,53 @@ jobs: uses: actions/upload-artifact@v1 with: name: projectAssetsJson-${{ runner.os }} - path: obj/_artifacts/projectAssetsJson + path: ${{ runner.temp }}/_artifacts/projectAssetsJson continue-on-error: true - name: Upload variables uses: actions/upload-artifact@v1 with: name: variables-${{ runner.os }} - path: obj/_artifacts/variables + path: ${{ runner.temp }}/_artifacts/Variables continue-on-error: true - name: Upload build_logs if: always() uses: actions/upload-artifact@v1 with: name: build_logs-${{ runner.os }} - path: obj/_artifacts/build_logs + path: ${{ runner.temp }}/_artifacts/build_logs + continue-on-error: true + - name: Upload test_logs + if: always() + uses: actions/upload-artifact@v1 + with: + name: test_logs-${{ runner.os }} + path: ${{ runner.temp }}/_artifacts/test_logs continue-on-error: true - name: Upload testResults if: always() uses: actions/upload-artifact@v1 with: name: testResults-${{ runner.os }} - path: obj/_artifacts/testResults + path: ${{ runner.temp }}/_artifacts/testResults continue-on-error: true - name: Upload coverageResults if: always() uses: actions/upload-artifact@v1 with: name: coverageResults-${{ runner.os }} - path: obj/_artifacts/coverageResults + path: ${{ runner.temp }}/_artifacts/coverageResults continue-on-error: true - name: Upload symbols uses: actions/upload-artifact@v1 with: name: symbols-${{ runner.os }} - path: obj/_artifacts/symbols + path: ${{ runner.temp }}/_artifacts/symbols continue-on-error: true - name: Upload deployables uses: actions/upload-artifact@v1 with: name: deployables-${{ runner.os }} - path: obj/_artifacts/deployables + path: ${{ runner.temp }}/_artifacts/deployables if: always() - name: Publish code coverage results to codecov.io run: bash <(curl -s https://codecov.io/bash) diff --git a/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 b/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 index 723574f5..391e5713 100644 --- a/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 +++ b/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 @@ -3,6 +3,8 @@ Param( ) if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { $ArtifactStagingFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY +} elseif ($env:RUNNER_TEMP) { + $ArtifactStagingFolder = "$env:RUNNER_TEMP\_artifacts" } else { $ArtifactStagingFolder = [System.IO.Path]::GetFullPath("$PSScriptRoot/../obj/_artifacts") if ($CleanIfLocal -and (Test-Path $ArtifactStagingFolder)) { diff --git a/azure-pipelines/artifacts/build_logs.ps1 b/azure-pipelines/artifacts/build_logs.ps1 index b55ba48f..f05358e0 100644 --- a/azure-pipelines/artifacts/build_logs.ps1 +++ b/azure-pipelines/artifacts/build_logs.ps1 @@ -1,12 +1,7 @@ -if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { - $artifactsRoot = $env:BUILD_ARTIFACTSTAGINGDIRECTORY -} else { - $RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") - $artifactsRoot = "$RepoRoot\bin" -} +$ArtifactStagingFolder = & "$PSScriptRoot/../Get-ArtifactsStagingDirectory.ps1" -if (!(Test-Path $artifactsRoot/build_logs)) { return } +if (!(Test-Path $ArtifactStagingFolder/build_logs)) { return } @{ - "$artifactsRoot/build_logs" = (Get-ChildItem -Recurse "$artifactsRoot/build_logs") + "$ArtifactStagingFolder/build_logs" = (Get-ChildItem -Recurse "$ArtifactStagingFolder/build_logs") } diff --git a/azure-pipelines/dotnet-test-cloud.ps1 b/azure-pipelines/dotnet-test-cloud.ps1 old mode 100644 new mode 100755 index a7a63a02..440bd890 --- a/azure-pipelines/dotnet-test-cloud.ps1 +++ b/azure-pipelines/dotnet-test-cloud.ps1 @@ -1,3 +1,5 @@ +#!/usr/bin/env pwsh + Param( [string]$Configuration='Debug', [string]$Agent='Local', From 8a837f711324dce3d66570271c9cc3a62dc8e2d0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 17 Feb 2022 09:09:17 -0700 Subject: [PATCH 396/889] Activate msbuild 17's platform negotiation feature Not that this template repo itself requires it, but it's a great baseline to start with as it means the repo will grow nicely as it gets more complicated for real projects. --- Directory.Build.props | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index a8f35b37..935550c9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -13,6 +13,10 @@ true true + + true + true + $(MSBuildThisFileDirectory) @@ -35,7 +39,7 @@ - + From e261c40938f2a1190824fbec4c7c020292f5f5b3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 17 Feb 2022 09:58:44 -0700 Subject: [PATCH 397/889] Switch to EO-compliant agent pools --- azure-pipelines/release.yml | 6 ++++-- azure-pipelines/vs-insertion.yml | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index 0ef91cb3..1470f765 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -15,7 +15,8 @@ stages: jobs: - deployment: create pool: - vmImage: ubuntu-latest + name: AzurePipelines-EO + vmImage: AzurePipelinesUbuntu20.04compliant environment: No-Approval strategy: runOnce: @@ -49,7 +50,8 @@ stages: jobs: - deployment: push pool: - vmImage: ubuntu-latest + name: AzurePipelines-EO + vmImage: AzurePipelinesUbuntu20.04compliant environment: No-Approval strategy: runOnce: diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 9f09b8ef..8c5b1aa9 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -18,7 +18,8 @@ stages: jobs: - deployment: insertion pool: - vmImage: windows-latest + name: AzurePipelines-EO + vmImage: AzurePipelinesWindows2022compliant environment: No-Approval strategy: runOnce: From 7d468a2f3f06c9e7ea86e34dca1eecdfc3e39780 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 25 Feb 2022 07:01:25 -0700 Subject: [PATCH 398/889] Fix VS insertion pool --- azure-pipelines/vs-insertion.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 8c5b1aa9..77853a6a 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -17,9 +17,7 @@ stages: displayName: VS insertion jobs: - deployment: insertion - pool: - name: AzurePipelines-EO - vmImage: AzurePipelinesWindows2022compliant + pool: VSEngSS-MicroBuild2022-1ES environment: No-Approval strategy: runOnce: From a803831c66647bb775cf1febd2117966ad6b801d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 6 Mar 2022 07:12:33 -0700 Subject: [PATCH 399/889] Bump Microsoft.NET.Test.Sdk from 17.0.0 to 17.1.0 (#143) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.0.0 to 17.1.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v17.0.0...v17.1.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index b3fc51f0..e75f6ae8 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -11,7 +11,7 @@ - + From 25fa06401e58cdd3037106914d3e9febe230f80f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 6 Mar 2022 14:25:10 +0000 Subject: [PATCH 400/889] Bump coverlet.msbuild from 3.1.1 to 3.1.2 (#144) --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index e75f6ae8..077d8d8f 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,7 +10,7 @@ - + From f1581aacb92bda75bce2bd68ed44a698f2bf1884 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 8 Mar 2022 09:02:53 -0700 Subject: [PATCH 401/889] Update .NET SDK to 6.0.200 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index e2af429b..6bfbd177 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.100", + "version": "6.0.200", "rollForward": "patch", "allowPrerelease": false } From cfa18ae4623dae6215f666d02acd2d7cb856a3c6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 9 Mar 2022 17:14:01 -0700 Subject: [PATCH 402/889] Re-enable transitive P2Ps Because it isn't actually required for msbuild platform negotiation. --- Directory.Build.props | 1 - 1 file changed, 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 935550c9..e70a74bb 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -15,7 +15,6 @@ true - true $(MSBuildThisFileDirectory) From 8a61e11c513a79b1f5ab8f747cc4414dba4946ee Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 9 Mar 2022 18:44:12 -0700 Subject: [PATCH 403/889] Delete a remnant of push_to_ci --- azure-pipelines/official.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index a4ae3884..1c800f3c 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -42,7 +42,6 @@ stages: TreatWarningsAsErrors: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release - push_to_ci: true NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages SignTypeSelection: ${{ parameters.SignTypeSelection }} Packaging.EnableSBOMSigning: true From e92074087c0087bcbdcbfe7bf86030d9f09f1bde Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 25 Mar 2022 09:22:42 -0600 Subject: [PATCH 404/889] Improve TargetFramework detection --- tools/Install-DotNetSdk.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 3c82ee2b..d1da4250 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -42,12 +42,12 @@ Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$P $projXml = [xml](Get-Content -Path $_) $pg = $projXml.Project.PropertyGroup if ($pg) { - $targetFrameworks = $pg.TargetFramework - if (!$targetFrameworks) { - $targetFrameworks = $pg.TargetFrameworks - if ($targetFrameworks) { - $targetFrameworks = $targetFrameworks -Split ';' - } + $targetFrameworks = @() + $tf = $pg.TargetFramework + $targetFrameworks += $tf + $tfs = $pg.TargetFrameworks + if ($tfs) { + $targetFrameworks = $tfs -Split ';' } } $targetFrameworks |? { $_ -match 'net(?:coreapp)?(\d+\.\d+)' } |% { From 7e34288f4cf0fbb6f1f86c7a05199a7330b50eda Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 30 Mar 2022 07:20:08 -0600 Subject: [PATCH 405/889] Fix Install-DotNetSdk.ps1 for Windows machine-wide installations --- tools/Install-DotNetSdk.ps1 | 44 +++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 3c82ee2b..6b584f1c 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -72,6 +72,7 @@ Function Get-FileFromWeb([Uri]$Uri, $OutDir) { $OutFile = Join-Path $OutDir $Uri.Segments[-1] if (!(Test-Path $OutFile)) { Write-Verbose "Downloading $Uri..." + if (!(Test-Path $OutDir)) { mkdir $OutDir } try { (New-Object System.Net.WebClient).DownloadFile($Uri, $OutFile) } finally { @@ -87,12 +88,51 @@ Function Get-InstallerExe($Version, [switch]$Runtime) { if ($Runtime) { $sdkOrRuntime = 'Runtime' } # Get the latest/actual version for the specified one - if (([Version]$Version).Build -eq -1) { + $TypedVersion = [Version]$Version + if ($TypedVersion.Build -eq -1) { $versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/latest.version" -UseBasicParsing) $Version = $versionInfo[-1] } - Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/dotnet-$($sdkOrRuntime.ToLowerInvariant())-$Version-win-$arch.exe" -OutDir "$DotNetInstallScriptRoot" + $majorMinor = "$($TypedVersion.Major).$($TypedVersion.Minor)" + $ReleasesFile = Join-Path $DotNetInstallScriptRoot "$majorMinor\releases.json" + if (!(Test-Path $ReleasesFile)) { + Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/$majorMinor/releases.json" -OutDir (Split-Path $ReleasesFile) + } + + $releases = Get-Content $ReleasesFile | ConvertFrom-Json + $url = $null + foreach ($release in $releases.releases) { + $filesElement = $null + if ($Runtime) { + if ($release.runtime.version -eq $Version) { + $filesElement = $release.runtime.files + } + } else { + if ($release.sdk.version -eq $Version) { + $filesElement = $release.sdk.files + } + } + + if ($filesElement) { + foreach ($file in $filesElement) { + if ($file.rid -eq "win-$arch") { + $url = $file.url + Break + } + } + + if ($url) { + Break + } + } + } + + if ($url) { + Get-FileFromWeb -Uri $url -OutDir $DotNetInstallScriptRoot + } else { + Write-Error "Unable to find release of $sdkOrRuntime v$Version" + } } Function Install-DotNet($Version, [switch]$Runtime) { From 3aeff335e600bb8968e1fd7d1eb2d9a05900c328 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 30 Mar 2022 18:13:34 -0600 Subject: [PATCH 406/889] Ignore launchSettings.json --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d060a300..71645608 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ *.user *.userosscache *.sln.docstates +launchSettings.json # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs From b917529de6555deb96fbcccda3ce986659259cd9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 31 Mar 2022 07:50:18 -0600 Subject: [PATCH 407/889] Replace deployments with ordinary jobs --- azure-pipelines/release.yml | 87 +++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 48 deletions(-) diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index bfe5987c..029b654d 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -13,60 +13,51 @@ stages: - stage: GitHubRelease displayName: GitHub Release jobs: - - deployment: create + - job: create pool: vmImage: ubuntu-latest - environment: No-Approval - strategy: - runOnce: - deploy: - steps: - - download: none - - powershell: | - Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" - displayName: Set pipeline name - - task: GitHubRelease@1 - displayName: GitHub release (create) - inputs: - gitHubConnection: # TODO: fill in service connection here - repositoryName: $(Build.Repository.Name) - target: $(resources.pipeline.CI.sourceCommit) - tagSource: userSpecifiedTag - tag: v$(resources.pipeline.CI.runName) - title: v$(resources.pipeline.CI.runName) - isDraft: true # After running this step, visit the new draft release, edit, and publish. - changeLogCompareToRelease: lastNonDraftRelease - changeLogType: issueBased - changeLogLabels: | - [ - { "label" : "bug", "displayName" : "Fixes", "state" : "closed" }, - { "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" } - ] + steps: + - powershell: | + Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" + displayName: Set pipeline name + - task: GitHubRelease@1 + displayName: GitHub release (create) + inputs: + gitHubConnection: # TODO: fill in service connection here + repositoryName: $(Build.Repository.Name) + target: $(resources.pipeline.CI.sourceCommit) + tagSource: userSpecifiedTag + tag: v$(resources.pipeline.CI.runName) + title: v$(resources.pipeline.CI.runName) + isDraft: true # After running this step, visit the new draft release, edit, and publish. + changeLogCompareToRelease: lastNonDraftRelease + changeLogType: issueBased + changeLogLabels: | + [ + { "label" : "bug", "displayName" : "Fixes", "state" : "closed" }, + { "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" } + ] - stage: nuget_org displayName: nuget.org dependsOn: GitHubRelease jobs: - - deployment: push + - job: push pool: vmImage: ubuntu-latest - environment: No-Approval - strategy: - runOnce: - deploy: - steps: - - download: CI - artifact: deployables-Windows - displayName: Download deployables-Windows artifact - patterns: 'deployables-Windows/*' - - task: NuGetToolInstaller@1 - displayName: Use NuGet 5.x - inputs: - versionSpec: 5.x - - task: NuGetCommand@2 - displayName: NuGet push - inputs: - command: push - packagesToPush: $(Pipeline.Workspace)/CI/deployables-Windows/*.nupkg - nuGetFeedType: external - publishFeedCredentials: # TODO: fill in service connection here + steps: + - download: CI + artifact: deployables-Windows + displayName: Download deployables-Windows artifact + patterns: 'deployables-Windows/*' + - task: NuGetToolInstaller@1 + displayName: Use NuGet 5.x + inputs: + versionSpec: 5.x + - task: NuGetCommand@2 + displayName: NuGet push + inputs: + command: push + packagesToPush: $(Pipeline.Workspace)/CI/deployables-Windows/*.nupkg + nuGetFeedType: external + publishFeedCredentials: # TODO: fill in service connection here From efe7fddda409bb2241a6a6aacdd1a91367c1585d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 31 Mar 2022 09:15:01 -0600 Subject: [PATCH 408/889] Simplify release and CI package push --- azure-pipelines.yml | 2 +- azure-pipelines/publish-deployables.yml | 13 +--- azure-pipelines/release.yml | 90 +++++++++++-------------- 3 files changed, 41 insertions(+), 64 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a1435d91..fe8363a2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -22,7 +22,7 @@ variables: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ - ci_feed: CI # Azure Artifacts feed name + ci_feed: https://pkgs.dev.azure.com/andrewarnott/_packaging/CI/nuget/v3/index.json # Azure Artifacts feed URL NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages jobs: diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml index a4f8e593..f8c1dfc9 100644 --- a/azure-pipelines/publish-deployables.yml +++ b/azure-pipelines/publish-deployables.yml @@ -3,17 +3,6 @@ steps: displayName: Download deployables artifact: deployables-Windows -- task: NuGetToolInstaller@1 - displayName: Use NuGet 5.x - inputs: - versionSpec: 5.x - -- task: NuGetCommand@2 +- script: dotnet nuget push $(Pipeline.Workspace)/deployables-Windows/*.nupkg -s $(ci_feed) -k azdo --skip-duplicate displayName: Push packages to CI feed - inputs: - command: push - packagesToPush: $(Pipeline.Workspace)/deployables-Windows/*.nupkg - nuGetFeedType: internal - publishVstsFeed: $(ci_feed) - allowPackageConflicts: true condition: and(succeeded(), ne(variables['ci_feed'], ''), ne(variables['Build.Reason'], 'PullRequest')) diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index 029b654d..205c514b 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -9,55 +9,43 @@ resources: tags: - auto-release -stages: -- stage: GitHubRelease - displayName: GitHub Release - jobs: - - job: create - pool: - vmImage: ubuntu-latest - steps: - - powershell: | - Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" - displayName: Set pipeline name - - task: GitHubRelease@1 - displayName: GitHub release (create) - inputs: - gitHubConnection: # TODO: fill in service connection here - repositoryName: $(Build.Repository.Name) - target: $(resources.pipeline.CI.sourceCommit) - tagSource: userSpecifiedTag - tag: v$(resources.pipeline.CI.runName) - title: v$(resources.pipeline.CI.runName) - isDraft: true # After running this step, visit the new draft release, edit, and publish. - changeLogCompareToRelease: lastNonDraftRelease - changeLogType: issueBased - changeLogLabels: | - [ - { "label" : "bug", "displayName" : "Fixes", "state" : "closed" }, - { "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" } - ] +variables: +- group: Publishing secrets -- stage: nuget_org - displayName: nuget.org - dependsOn: GitHubRelease - jobs: - - job: push - pool: - vmImage: ubuntu-latest - steps: - - download: CI - artifact: deployables-Windows - displayName: Download deployables-Windows artifact - patterns: 'deployables-Windows/*' - - task: NuGetToolInstaller@1 - displayName: Use NuGet 5.x - inputs: - versionSpec: 5.x - - task: NuGetCommand@2 - displayName: NuGet push - inputs: - command: push - packagesToPush: $(Pipeline.Workspace)/CI/deployables-Windows/*.nupkg - nuGetFeedType: external - publishFeedCredentials: # TODO: fill in service connection here +jobs: +- job: release + pool: + vmImage: ubuntu-latest + steps: + - checkout: none + - powershell: Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" + displayName: Set pipeline name + - task: UseDotNet@2 + displayName: Install .NET SDK + inputs: + packageType: sdk + version: 6.x + - task: GitHubRelease@1 + displayName: GitHub release (create) + inputs: + gitHubConnection: # TODO: fill in service connection here + repositoryName: $(Build.Repository.Name) + target: $(resources.pipeline.CI.sourceCommit) + tagSource: userSpecifiedTag + tag: v$(resources.pipeline.CI.runName) + title: v$(resources.pipeline.CI.runName) + isDraft: true # After running this step, visit the new draft release, edit, and publish. + changeLogCompareToRelease: lastNonDraftRelease + changeLogType: issueBased + changeLogLabels: | + [ + { "label" : "bug", "displayName" : "Fixes", "state" : "closed" }, + { "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" } + ] + - download: CI + artifact: deployables-Windows + displayName: Download deployables-Windows artifact + patterns: 'deployables-Windows/*' + - script: dotnet nuget push $(Pipeline.Workspace)/CI/deployables-Windows/*.nupkg -s https://api.nuget.org/v3/index.json --api-key $(NuGetOrgApiKey) --skip-duplicate + displayName: Push nuget packages + condition: and(succeeded(), ne(variables['NuGetOrgApiKey'], '')) From 52dcdc720bd044be13fa99e29d6d94b94d120559 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 31 Mar 2022 09:28:40 -0600 Subject: [PATCH 409/889] GitHub release enhancements - Set GitHub release prerelease flag - Include deployables as release artifacts --- azure-pipelines/release.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index 205c514b..437ee65b 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -18,13 +18,23 @@ jobs: vmImage: ubuntu-latest steps: - checkout: none - - powershell: Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" - displayName: Set pipeline name + - powershell: | + Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" + if ('$(resources.pipeline.CI.runName)'.Contains('-')) { + Write-Host "##vso[task.setvariable variable=IsPrerelease]true" + } else { + Write-Host "##vso[task.setvariable variable=IsPrerelease]false" + } + displayName: Set up pipeline - task: UseDotNet@2 displayName: Install .NET SDK inputs: packageType: sdk version: 6.x + - download: CI + artifact: deployables-Windows + displayName: Download deployables-Windows artifact + patterns: 'deployables-Windows/*' - task: GitHubRelease@1 displayName: GitHub release (create) inputs: @@ -35,6 +45,8 @@ jobs: tag: v$(resources.pipeline.CI.runName) title: v$(resources.pipeline.CI.runName) isDraft: true # After running this step, visit the new draft release, edit, and publish. + isPreRelease: $(IsPrerelease) + assets: $(Pipeline.Workspace)/CI/deployables-Windows/*.nupkg changeLogCompareToRelease: lastNonDraftRelease changeLogType: issueBased changeLogLabels: | @@ -42,10 +54,6 @@ jobs: { "label" : "bug", "displayName" : "Fixes", "state" : "closed" }, { "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" } ] - - download: CI - artifact: deployables-Windows - displayName: Download deployables-Windows artifact - patterns: 'deployables-Windows/*' - script: dotnet nuget push $(Pipeline.Workspace)/CI/deployables-Windows/*.nupkg -s https://api.nuget.org/v3/index.json --api-key $(NuGetOrgApiKey) --skip-duplicate displayName: Push nuget packages condition: and(succeeded(), ne(variables['NuGetOrgApiKey'], '')) From 05b8a491c03a9acb4268477a3e187a4c8ec9769e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 31 Mar 2022 10:37:02 -0600 Subject: [PATCH 410/889] Increase test timeout to 60s --- azure-pipelines/dotnet-test-cloud.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/dotnet-test-cloud.ps1 b/azure-pipelines/dotnet-test-cloud.ps1 index 440bd890..08cd4d1f 100755 --- a/azure-pipelines/dotnet-test-cloud.ps1 +++ b/azure-pipelines/dotnet-test-cloud.ps1 @@ -14,7 +14,7 @@ dotnet test $RepoRoot ` -c $Configuration ` --filter "TestCategory!=FailsInCloudTest" ` -p:CollectCoverage=true ` - --blame-hang-timeout 30s ` + --blame-hang-timeout 60s ` --blame-crash ` -bl:"$ArtifactStagingFolder/build_logs/test.binlog" ` --diag "$ArtifactStagingFolder/test_logs/diag.log;TraceLevel=info" ` From 4feafe4c1c30128f97780fa78c7dc271b2bb80c7 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 31 Mar 2022 13:33:50 -0600 Subject: [PATCH 411/889] Add sample azure-public stage --- azure-pipelines/official.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 1c800f3c..d7b949d3 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -60,6 +60,7 @@ stages: - job: archive pool: VSEng-ReleasePool-1ES steps: + - checkout: none - download: current artifact: Variables-Windows displayName: Download Variables-Windows artifact @@ -81,3 +82,29 @@ stages: SymbolsAgentPath: $(Pipeline.Workspace)/symbols-legacy - task: MicroBuildCleanup@1 displayName: Send Telemetry + +# - stage: azure_public_vsimpl_feed +# displayName: azure-public/vs-impl feed +# condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) +# jobs: +# - job: push +# pool: +# name: AzurePipelines-EO +# vmImage: AzurePipelinesUbuntu20.04compliant +# steps: +# - checkout: none +# - download: current +# artifact: deployables-Windows +# displayName: Download deployables-Windows artifact +# - task: UseDotNet@2 +# displayName: Install .NET SDK +# inputs: +# packageType: sdk +# version: 6.x +# - task: NuGetAuthenticate@0 +# displayName: Authenticate NuGet feeds +# inputs: +# nuGetServiceConnections: azure-public/vs-impl +# forceReinstallCredentialProvider: true +# - script: dotnet nuget push $(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg -s https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json --api-key azdo --skip-duplicate +# displayName: Push nuget packages From 34262db00810c6f0e48dfe12efbea0a69b1acf89 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 31 Mar 2022 13:34:19 -0600 Subject: [PATCH 412/889] Add recognition for RIDs in test paths --- azure-pipelines/dotnet-test-cloud.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/dotnet-test-cloud.ps1 b/azure-pipelines/dotnet-test-cloud.ps1 index 08cd4d1f..7d5a4350 100755 --- a/azure-pipelines/dotnet-test-cloud.ps1 +++ b/azure-pipelines/dotnet-test-cloud.ps1 @@ -27,8 +27,12 @@ Get-ChildItem -Recurse -Path $RepoRoot\test\*.trx |% { if ($PublishResults) { $x = [xml](Get-Content -Path $_) $storage = $x.TestRun.TestDefinitions.GetElementsByTagName('UnitTest')[0].storage -replace '\\','/' - if ($storage -match '/(?[^/]+)/(?[^/]+)\.dll$') { - $runTitle = "$($matches.lib) ($($matches.tfm), $Agent)" + if ($storage -match '/(?net[^/]+)/(?:(?[^/]+)/)?(?[^/]+)\.dll$') { + if ($matches.rid) { + $runTitle = "$($matches.lib) ($($matches.tfm), $($matches.rid), $Agent)" + } else { + $runTitle = "$($matches.lib) ($($matches.tfm), $Agent)" + } } else { $unknownCounter += 1; $runTitle = "unknown$unknownCounter ($Agent)"; From 9d0b31316dbb66265441a80686c63dc7b1d45351 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 10 Apr 2022 09:19:59 -0600 Subject: [PATCH 413/889] Use appropriate slash for the agent OS Fixes #150 --- azure-pipelines/publish-deployables.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml index f8c1dfc9..9ccdc29e 100644 --- a/azure-pipelines/publish-deployables.yml +++ b/azure-pipelines/publish-deployables.yml @@ -3,6 +3,6 @@ steps: displayName: Download deployables artifact: deployables-Windows -- script: dotnet nuget push $(Pipeline.Workspace)/deployables-Windows/*.nupkg -s $(ci_feed) -k azdo --skip-duplicate +- powershell: dotnet nuget push "$(Resolve-Path '$(Pipeline.Workspace)\deployables-Windows\')*.nupkg" -s $(ci_feed) -k azdo --skip-duplicate displayName: Push packages to CI feed condition: and(succeeded(), ne(variables['ci_feed'], ''), ne(variables['Build.Reason'], 'PullRequest')) From 3f11fb5dce7ba03f3753099c1314f15c9bc47b72 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 11 Apr 2022 13:46:40 -0600 Subject: [PATCH 414/889] Update devcontainer Dockerfile to match global.json --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c47acfaa..234db6d1 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:6.0.100-focal +FROM mcr.microsoft.com/dotnet/sdk:6.0.200-focal # Installing mono makes `dotnet test` work without errors even for net472. # But installing it takes a long time, so it's excluded by default. From e899f99b887eb091e4068958078638fa2bcad9b8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 11 Apr 2022 13:57:10 -0600 Subject: [PATCH 415/889] Do not trigger CI on changes to the release or vs-insertion pipeline --- azure-pipelines/official.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index d7b949d3..48ef6cc9 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -10,6 +10,8 @@ trigger: - doc/ - '*.md' - .vscode/ + - azure-pipelines/release.yml + - azure-pipelines/vs-insertion.yml #schedules: #- cron: "0 3 * * *" # Daily @ 8 PM PST # displayName: Daily vs-insertion From dd60e837b038dc6964181712275085332f5dfd83 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 11 Apr 2022 17:41:52 -0600 Subject: [PATCH 416/889] Remove explicit Microsoft.NETFramework.ReferenceAssemblies PackageReference --- Directory.Build.props | 1 - 1 file changed, 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index e70a74bb..ecb971a7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -36,7 +36,6 @@ - From 885c8ec6e85fb70460a35cad77e1a46934567135 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 12 Apr 2022 06:02:02 -0600 Subject: [PATCH 417/889] Turn off SBOM signing It times out too frequently. --- azure-pipelines/official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 48ef6cc9..b13d2e1d 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -46,7 +46,7 @@ stages: BuildConfiguration: Release NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages SignTypeSelection: ${{ parameters.SignTypeSelection }} - Packaging.EnableSBOMSigning: true + Packaging.EnableSBOMSigning: false jobs: - template: build.yml From 09516ca14922aadc4474d3f2e05cdef8a168dd75 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 12 Apr 2022 06:18:04 -0600 Subject: [PATCH 418/889] Tolerate trx files with test run failures --- azure-pipelines/dotnet-test-cloud.ps1 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/azure-pipelines/dotnet-test-cloud.ps1 b/azure-pipelines/dotnet-test-cloud.ps1 index 7d5a4350..877f11ed 100755 --- a/azure-pipelines/dotnet-test-cloud.ps1 +++ b/azure-pipelines/dotnet-test-cloud.ps1 @@ -26,16 +26,20 @@ Get-ChildItem -Recurse -Path $RepoRoot\test\*.trx |% { if ($PublishResults) { $x = [xml](Get-Content -Path $_) - $storage = $x.TestRun.TestDefinitions.GetElementsByTagName('UnitTest')[0].storage -replace '\\','/' - if ($storage -match '/(?net[^/]+)/(?:(?[^/]+)/)?(?[^/]+)\.dll$') { + $runTitle = $null + if ($x.TestRun.TestDefinitions -and $x.TestRun.TestDefinitions.GetElementsByTagName('UnitTest')) { + $storage = $x.TestRun.TestDefinitions.GetElementsByTagName('UnitTest')[0].storage -replace '\\','/' + if ($storage -match '/(?net[^/]+)/(?:(?[^/]+)/)?(?[^/]+)\.dll$') { if ($matches.rid) { $runTitle = "$($matches.lib) ($($matches.tfm), $($matches.rid), $Agent)" } else { $runTitle = "$($matches.lib) ($($matches.tfm), $Agent)" } - } else { - $unknownCounter += 1; - $runTitle = "unknown$unknownCounter ($Agent)"; + } + } + if (!$runTitle) { + $unknownCounter += 1; + $runTitle = "unknown$unknownCounter ($Agent)"; } Write-Host "##vso[results.publish type=VSTest;runTitle=$runTitle;publishRunAttachments=true;resultFiles=$_;failTaskOnFailedTests=true;testRunSystem=VSTS - PTR;]" From 33e19c8934b26a2508f79353a5c20ba259a9dcac Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 12 Apr 2022 08:29:59 -0600 Subject: [PATCH 419/889] Improve pipeline verbosity --- azure-pipelines/Convert-PDB.ps1 | 57 +++++++++++------------ azure-pipelines/artifacts/VSInsertion.ps1 | 17 ++++++- azure-pipelines/microbuild.after.yml | 2 +- 3 files changed, 44 insertions(+), 32 deletions(-) diff --git a/azure-pipelines/Convert-PDB.ps1 b/azure-pipelines/Convert-PDB.ps1 index 2d394e72..f119a164 100644 --- a/azure-pipelines/Convert-PDB.ps1 +++ b/azure-pipelines/Convert-PDB.ps1 @@ -8,36 +8,35 @@ .PARAMETER OutputPath The path of the output PDB to write. #> -#Function Convert-PortableToWindowsPDB() { - Param( - [Parameter(Mandatory=$true,Position=0)] - [string]$DllPath, - [Parameter()] - [string]$PdbPath, - [Parameter(Mandatory=$true,Position=1)] - [string]$OutputPath - ) +[CmdletBinding()] +Param( + [Parameter(Mandatory=$true,Position=0)] + [string]$DllPath, + [Parameter()] + [string]$PdbPath, + [Parameter(Mandatory=$true,Position=1)] + [string]$OutputPath +) - if ($IsMacOS -or $IsLinux) { - Write-Error "This script only works on Windows" - return - } +if ($IsMacOS -or $IsLinux) { + Write-Error "This script only works on Windows" + return +} - $version = '1.1.0-beta2-21101-01' - $baseDir = "$PSScriptRoot/../obj/tools" - $pdb2pdbpath = "$baseDir/Microsoft.DiaSymReader.Pdb2Pdb.$version/tools/Pdb2Pdb.exe" - if (-not (Test-Path $pdb2pdbpath)) { - if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null } - $baseDir = (Resolve-Path $baseDir).Path # Normalize it - Write-Verbose "& (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null" - & (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null - } +$version = '1.1.0-beta2-21101-01' +$baseDir = "$PSScriptRoot/../obj/tools" +$pdb2pdbpath = "$baseDir/Microsoft.DiaSymReader.Pdb2Pdb.$version/tools/Pdb2Pdb.exe" +if (-not (Test-Path $pdb2pdbpath)) { + if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null } + $baseDir = (Resolve-Path $baseDir).Path # Normalize it + Write-Verbose "& (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null" + & (& $PSScriptRoot/Get-NuGetTool.ps1) install Microsoft.DiaSymReader.Pdb2Pdb -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json | Out-Null +} - $args = $DllPath,'/out',$OutputPath,'/nowarn','0021' - if ($PdbPath) { - $args += '/pdb',$PdbPath - } +$args = $DllPath,'/out',$OutputPath,'/nowarn','0021' +if ($PdbPath) { + $args += '/pdb',$PdbPath +} - Write-Verbose "$pdb2pdbpath $args" - & $pdb2pdbpath $args -#} +Write-Verbose "$pdb2pdbpath $args" +& $pdb2pdbpath $args diff --git a/azure-pipelines/artifacts/VSInsertion.ps1 b/azure-pipelines/artifacts/VSInsertion.ps1 index 4c56deab..0d1cb373 100644 --- a/azure-pipelines/artifacts/VSInsertion.ps1 +++ b/azure-pipelines/artifacts/VSInsertion.ps1 @@ -4,10 +4,17 @@ .PARAMETER SbomNotRequired Indicates that returning the artifacts available is preferable to nothing at all when the SBOM has not yet been generated. #> +[CmdletBinding()] Param ( [switch]$SbomNotRequired ) +if ($IsMacOS -or $IsLinux) { + # We only package up for insertions on Windows agents since they are where optprof can happen. + Write-Verbose "Skipping VSInsertion artifact since we're not on Windows." + return @{} +} + $RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") $BuildConfiguration = $env:BUILDCONFIGURATION if (!$BuildConfiguration) { @@ -17,9 +24,15 @@ if (!$BuildConfiguration) { $PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration/NuGet" # This artifact is not ready if we're running on the devdiv AzDO account and we don't have an SBOM yet. -if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9' -and -not (Test-Path $PackagesRoot/_manifest) -and -not $SbomNotRequired) { return @{} } +if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9' -and -not (Test-Path $PackagesRoot/_manifest) -and -not $SbomNotRequired) { + Write-Host "Skipping because SBOM isn't generated yet." + return @{} +} -if (!(Test-Path $PackagesRoot)) { return @{} } +if (!(Test-Path $PackagesRoot)) { + Write-Warning "Skipping because packages haven't been built yet." + return @{} +} @{ "$PackagesRoot" = (Get-ChildItem $PackagesRoot -Recurse) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index e889a464..87634808 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -19,7 +19,7 @@ steps: BuildDropPath: $(System.DefaultWorkingDirectory)/bin/Library/$(BuildConfiguration) BuildComponentPath: $(System.DefaultWorkingDirectory)/obj/src/Library -- powershell: Copy-Item -Recurse "$(System.DefaultWorkingDirectory)/bin/Library/$(BuildConfiguration)/_manifest" "$(System.DefaultWorkingDirectory)/bin/Packages/$(BuildConfiguration)/NuGet" +- powershell: Copy-Item -Recurse -Verbose "$(System.DefaultWorkingDirectory)/bin/Library/$(BuildConfiguration)/_manifest" "$(System.DefaultWorkingDirectory)/bin/Packages/$(BuildConfiguration)/NuGet" displayName: Publish Software Bill of Materials - task: Ref12Analyze@0 From e21c1c1653f89510c77fc4f077d4fb4c2acc333a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 12 Apr 2022 08:30:10 -0600 Subject: [PATCH 420/889] Improve pipeline verbosity --- azure-pipelines/artifacts/_stage_all.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines/artifacts/_stage_all.ps1 b/azure-pipelines/artifacts/_stage_all.ps1 index 87421d56..e4954c13 100644 --- a/azure-pipelines/artifacts/_stage_all.ps1 +++ b/azure-pipelines/artifacts/_stage_all.ps1 @@ -1,7 +1,7 @@ # This script links all the artifacts described by _all.ps1 # into a staging directory, reading for uploading to a cloud build artifact store. # It returns a sequence of objects with Name and Path properties. - +[CmdletBinding()] param ( [string]$ArtifactNameSuffix ) @@ -21,7 +21,6 @@ function Create-SymbolicLink { if (Test-Path $Link) { Remove-Item $Link } $LinkContainer = Split-Path $Link -Parent if (!(Test-Path $LinkContainer)) { mkdir $LinkContainer } - Write-Verbose "Linking $Link to $Target" if ($IsMacOS -or $IsLinux) { ln $Target $Link | Out-Null } else { From 0ac22f889f6d001ba5e2e9b6a2ccecb6f393bc84 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 14 Apr 2022 07:01:18 -0600 Subject: [PATCH 421/889] Document how to create a merge commit in a Library.Template based repo --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/README.md b/README.md index 22d1091e..0f9715f3 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,48 @@ Further customize your repo by: 1. Verify the license is suitable for your goal as it appears in the LICENSE and stylecop.json files and the Directory.Build.props file's `PackageLicenseExpression` property. 1. Reset or replace the badges at the top of this file. + +### Maintaining your repo based on this template + +The best way to keep your repo in sync with this template's evolving features and best practices is to periodically merge the template into your repo: + +```ps1 +git checkout main # your default branch +git pull # make sure you're at tip +git fetch libtemplate # fetch latest Library.Template +git merge libtemplate/main +``` + +There will frequently be merge conflicts to work out, but they will be easier to resolve than running the `Apply-Template.ps1` script every time, which simply blows away all your local changes with the latest from the template. + +If you do not already have Library.Template history in your repo or have never completed a merge before, the above steps may produce errors. +To get it working the first time, follow these steps: + +```ps1 +git remote add libtemplate https://github.com/AArnott/Library.Template.git +git fetch libtemplate +``` + +If the `git merge` step described earlier still fails for you, you may need to artificially create your first merge. +First, you must have a local clone of Library.Template on your box: + +```ps1 +git clone https://github.com/AArnott/Library.Template.git +``` + +Make sure you have either `main` checked out in that clone, as appropriate to match. +Use `git rev-parse HEAD` within the Library.Template repo and record the resulting commit as we'll use it later. + +Run the `Apply-Template.ps1` script, passing in the path to your own Library.Template-based repo. This will blow away most customizations you may have made to your repo's build authoring. You should *carefully* review all changes to your repo, staging those changes that you want to keep and reverting those that remove customizations you made. + +Now it's time to commit your changes. We do this in a very low-level way in order to have git record this as a *merge* commit even though it didn't start as a merge. +By doing this, git will allow future merges from `libtemplate/main` and only new changes will be brought down, which will be much easier than the `Apply-Template.ps1` script you just ran. +We create the merge commit with these commands: + +1. Be sure to have staged or reverted all the changes in your repo. +1. Run `git write-tree` within your repo. This will print out a git tree hash. +1. Run `git commit-tree -p HEAD -p A B -m "Merged latest Library.Template"`, where `A` is the output from `git rev-parse HEAD` that you recorded earlier, and `B` is the output from your prior `git write-tree` command. +1. Run `git merge X` where `X` is the output of the `git commit-tree` command. + +Congratulations. You're all done. +Next time you want to sync to latest from Library.Template, you can the simple `git merge` steps given at the start of this section. From cbdabad295480b1844ad94a9ae64ac86d6b5a8a9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 14 Apr 2022 07:09:32 -0600 Subject: [PATCH 422/889] Customize documented steps for microbuild branch --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a80b7b2d..cd9a4d2f 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ The best way to keep your repo in sync with this template's evolving features an git checkout main # your default branch git pull # make sure you're at tip git fetch libtemplate # fetch latest Library.Template -git merge libtemplate/main +git merge libtemplate/microbuild ``` There will frequently be merge conflicts to work out, but they will be easier to resolve than running the `Apply-Template.ps1` script every time, which simply blows away all your local changes with the latest from the template. @@ -74,7 +74,7 @@ Use `git rev-parse HEAD` within the Library.Template repo and record the resulti Run the `Apply-Template.ps1` script, passing in the path to your own Library.Template-based repo. This will blow away most customizations you may have made to your repo's build authoring. You should *carefully* review all changes to your repo, staging those changes that you want to keep and reverting those that remove customizations you made. Now it's time to commit your changes. We do this in a very low-level way in order to have git record this as a *merge* commit even though it didn't start as a merge. -By doing this, git will allow future merges from `libtemplate/main` and only new changes will be brought down, which will be much easier than the `Apply-Template.ps1` script you just ran. +By doing this, git will allow future merges from `libtemplate/microbuild` and only new changes will be brought down, which will be much easier than the `Apply-Template.ps1` script you just ran. We create the merge commit with these commands: 1. Be sure to have staged or reverted all the changes in your repo. From 19515d7ca90ca669fa4c874af46977b7a3ebd6aa Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 14 Apr 2022 09:36:30 -0600 Subject: [PATCH 423/889] Protect against misapplication of the Apply-Template script --- Apply-Template.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Apply-Template.ps1 b/Apply-Template.ps1 index 0d3f3d8e..d659670b 100644 --- a/Apply-Template.ps1 +++ b/Apply-Template.ps1 @@ -15,6 +15,20 @@ Param( [string]$Path ) +Push-Location $Path +try { + # Look for our own initial commit in the target repo's history. + # If it's there, they've already switched to using git merge to freshen up. + # Using Apply-Template would just complicate future merges, so block it. + git log 05f49ce799c1f9cc696d53eea89699d80f59f833 ^HEAD | Out-Null + if ($LASTEXITCODE -eq 0) { + Write-Error 'The target repo already has Library.Template history merged into it. Use `git merge` instead of this script to freshen your repo. See the README.md file for details.' + exit 1 + } +} finally { + Pop-Location +} + Write-Host "Updating $Path" robocopy /mir $PSScriptRoot/azure-pipelines $Path/azure-pipelines robocopy /mir $PSScriptRoot/.devcontainer $Path/.devcontainer From 86a18ec2dd3772eefd6ef5d35ad2520382fe8d9c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 23 Apr 2022 10:02:34 -0600 Subject: [PATCH 424/889] Ignore .lutconfig files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 71645608..65f94776 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ *.user *.userosscache *.sln.docstates +*.lutconfig launchSettings.json # User-specific files (MonoDevelop/Xamarin Studio) From b656d1058f82d10de8e43e1c49f151f7ff4e3f88 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 26 Apr 2022 15:57:11 -0600 Subject: [PATCH 425/889] Clarify nuget push task --- azure-pipelines/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index 437ee65b..6690cccf 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -55,5 +55,5 @@ jobs: { "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" } ] - script: dotnet nuget push $(Pipeline.Workspace)/CI/deployables-Windows/*.nupkg -s https://api.nuget.org/v3/index.json --api-key $(NuGetOrgApiKey) --skip-duplicate - displayName: Push nuget packages + displayName: Push packages to nuget.org condition: and(succeeded(), ne(variables['NuGetOrgApiKey'], '')) From f39d7fc74bcd8b2625670bd68e0053b37b400d74 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 1 May 2022 14:35:13 -0600 Subject: [PATCH 426/889] Test on .NET 6 instead of .NET 5 .NET 5 falls out of Microsoft support in just a few days, so folks should focus testing on the currently supported platforms. --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 077d8d8f..20108645 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -1,7 +1,7 @@ - net5.0;netcoreapp3.1;net472 + net6.0;netcoreapp3.1;net472 From 16d65511f7f92d18eb9dfb19fd40388e86e7a514 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 1 May 2022 15:59:52 -0600 Subject: [PATCH 427/889] Skip CI for release pipeline changes Also remove extra slash in snk path --- Directory.Build.props | 2 +- azure-pipelines.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index ecb971a7..834e7457 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -23,7 +23,7 @@ embedded true - $(MSBuildThisFileDirectory)\strongname.snk + $(MSBuildThisFileDirectory)strongname.snk COMPANY-PLACEHOLDER COMPANY-PLACEHOLDER diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fe8363a2..b7d86b45 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,6 +10,7 @@ trigger: - '*.md' - .vscode/ - .github/ + - azure-pipelines/release.yml parameters: - name: includeMacOS From e0d4ad51a33eacceb0ef1c20a43f7a8b75c79c9d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 1 May 2022 21:35:19 -0600 Subject: [PATCH 428/889] Add support for running 32-bit tests --- azure-pipelines/dotnet-test-cloud.ps1 | 45 ++++++++-- tools/Install-DotNetSdk.ps1 | 124 ++++++++++++++++++++------ 2 files changed, 138 insertions(+), 31 deletions(-) diff --git a/azure-pipelines/dotnet-test-cloud.ps1 b/azure-pipelines/dotnet-test-cloud.ps1 index 877f11ed..43cdc3e0 100755 --- a/azure-pipelines/dotnet-test-cloud.ps1 +++ b/azure-pipelines/dotnet-test-cloud.ps1 @@ -1,15 +1,50 @@ #!/usr/bin/env pwsh +<# +.SYNOPSIS + Runs tests as they are run in cloud test runs. +.PARAMETER Configuration + The configuration within which to run tests +.PARAMETER Agent + The name of the agent. This is used in preparing test run titles. +.PARAMETER PublishResults + A switch to publish results to Azure Pipelines. +.PARAMETER x86 + A switch to run the tests in an x86 process. +.PARAMETER dotnet32 + The path to a 32-bit dotnet executable to use. +#> +[CmdletBinding()] Param( [string]$Configuration='Debug', [string]$Agent='Local', - [switch]$PublishResults + [switch]$PublishResults, + [switch]$x86, + [string]$dotnet32 ) $RepoRoot = (Resolve-Path "$PSScriptRoot/..").Path $ArtifactStagingFolder = & "$PSScriptRoot/Get-ArtifactsStagingDirectory.ps1" -dotnet test $RepoRoot ` +$dotnet = 'dotnet' +if ($x86) { + $x86RunTitleSuffix = ", x86" + if ($dotnet32) { + $dotnet = $dotnet32 + } else { + $dotnet32Possibilities = "$PSScriptRoot\../obj/tools/x86/.dotnet/dotnet.exe", "$env:AGENT_TOOLSDIRECTORY/x86/dotnet/dotnet.exe", "${env:ProgramFiles(x86)}\dotnet\dotnet.exe" + $dotnet32Matches = $dotnet32Possibilities |? { Test-Path $_ } + if ($dotnet32Matches) { + $dotnet = Resolve-Path @($dotnet32Matches)[0] + Write-Host "Running tests using `"$dotnet`"" -ForegroundColor DarkGray + } else { + Write-Error "Unable to find 32-bit dotnet.exe" + return 1 + } + } +} + +& $dotnet test $RepoRoot ` --no-build ` -c $Configuration ` --filter "TestCategory!=FailsInCloudTest" ` @@ -18,7 +53,7 @@ dotnet test $RepoRoot ` --blame-crash ` -bl:"$ArtifactStagingFolder/build_logs/test.binlog" ` --diag "$ArtifactStagingFolder/test_logs/diag.log;TraceLevel=info" ` - --logger trx + --logger trx ` $unknownCounter = 0 Get-ChildItem -Recurse -Path $RepoRoot\test\*.trx |% { @@ -33,13 +68,13 @@ Get-ChildItem -Recurse -Path $RepoRoot\test\*.trx |% { if ($matches.rid) { $runTitle = "$($matches.lib) ($($matches.tfm), $($matches.rid), $Agent)" } else { - $runTitle = "$($matches.lib) ($($matches.tfm), $Agent)" + $runTitle = "$($matches.lib) ($($matches.tfm)$x86RunTitleSuffix, $Agent)" } } } if (!$runTitle) { $unknownCounter += 1; - $runTitle = "unknown$unknownCounter ($Agent)"; + $runTitle = "unknown$unknownCounter ($Agent$x86RunTitleSuffix)"; } Write-Host "##vso[results.publish type=VSTest;runTitle=$runTitle;publishRunAttachments=true;resultFiles=$_;failTaskOnFailedTests=true;testRunSystem=VSTS - PTR;]" diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 7dcddc78..76a397f0 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -15,20 +15,28 @@ When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. +.PARAMETER IncludeX86 + Installs a x86 SDK and runtimes in addition to the x64 ones. Only supported on Windows. Ignored on others. #> [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] Param ( [ValidateSet('repo','user','machine')] - [string]$InstallLocality='user' + [string]$InstallLocality='user', + [switch]$IncludeX86 ) $DotNetInstallScriptRoot = "$PSScriptRoot/../obj/tools" if (!(Test-Path $DotNetInstallScriptRoot)) { New-Item -ItemType Directory -Path $DotNetInstallScriptRoot -WhatIf:$false | Out-Null } $DotNetInstallScriptRoot = Resolve-Path $DotNetInstallScriptRoot -# Look up actual required .NET Core SDK version from global.json +# Look up actual required .NET SDK version from global.json $sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1" +If ($IncludeX86 -and ($IsMacOS -or $IsLinux)) { + Write-Verbose "Ignoring -IncludeX86 switch because 32-bit runtimes are only supported on Windows." + $IncludeX86 = $false +} + $arch = [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture if (!$arch) { # Windows Powershell leaves this blank $arch = 'x64' @@ -72,7 +80,7 @@ Function Get-FileFromWeb([Uri]$Uri, $OutDir) { $OutFile = Join-Path $OutDir $Uri.Segments[-1] if (!(Test-Path $OutFile)) { Write-Verbose "Downloading $Uri..." - if (!(Test-Path $OutDir)) { mkdir $OutDir } + if (!(Test-Path $OutDir)) { New-Item -ItemType Directory -Path $OutDir } try { (New-Object System.Net.WebClient).DownloadFile($Uri, $OutFile) } finally { @@ -83,7 +91,7 @@ Function Get-FileFromWeb([Uri]$Uri, $OutDir) { $OutFile } -Function Get-InstallerExe($Version, [switch]$Runtime) { +Function Get-InstallerExe($Version, $Architecture, [switch]$Runtime) { $sdkOrRuntime = 'Sdk' if ($Runtime) { $sdkOrRuntime = 'Runtime' } @@ -116,7 +124,7 @@ Function Get-InstallerExe($Version, [switch]$Runtime) { if ($filesElement) { foreach ($file in $filesElement) { - if ($file.rid -eq "win-$arch") { + if ($file.rid -eq "win-$Architecture") { $url = $file.url Break } @@ -135,22 +143,20 @@ Function Get-InstallerExe($Version, [switch]$Runtime) { } } -Function Install-DotNet($Version, [switch]$Runtime) { +Function Install-DotNet($Version, $Architecture, [switch]$Runtime) { if ($Runtime) { $sdkSubstring = '' } else { $sdkSubstring = 'SDK ' } Write-Host "Downloading .NET Core $sdkSubstring$Version..." - $Installer = Get-InstallerExe -Version $Version -Runtime:$Runtime + $Installer = Get-InstallerExe -Version $Version -Architecture $Architecture -Runtime:$Runtime Write-Host "Installing .NET Core $sdkSubstring$Version..." cmd /c start /wait $Installer /install /passive /norestart if ($LASTEXITCODE -eq 3010) { Write-Verbose "Restart required" } elseif ($LASTEXITCODE -ne 0) { - throw "Failure to install .NET Core SDK" + throw "Failure to install .NET SDK" } } -$switches = @( - '-Architecture',$arch -) +$switches = @() $envVars = @{ # For locally installed dotnet, skip first time experience which takes a long time 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' = 'true'; @@ -161,15 +167,25 @@ if ($InstallLocality -eq 'machine') { $DotNetInstallDir = '/usr/share/dotnet' } else { $restartRequired = $false - if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { - Install-DotNet -Version $sdkVersion + if ($PSCmdlet.ShouldProcess(".NET SDK $sdkVersion", "Install")) { + Install-DotNet -Version $sdkVersion -Architecture $arch $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + + if ($IncludeX86) { + Install-DotNet -Version $sdkVersion -Architecture x86 + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + } } $runtimeVersions | Get-Unique |% { if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { - Install-DotNet -Version $_ -Runtime + Install-DotNet -Version $_ -Architecture $arch -Runtime $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + + if ($IncludeX86) { + Install-DotNet -Version $_ -Architecture x86 -Runtime + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + } } } @@ -182,20 +198,34 @@ if ($InstallLocality -eq 'machine') { } } elseif ($InstallLocality -eq 'repo') { $DotNetInstallDir = "$DotNetInstallScriptRoot/.dotnet" + $DotNetX86InstallDir = "$DotNetInstallScriptRoot/x86/.dotnet" } elseif ($env:AGENT_TOOLSDIRECTORY) { $DotNetInstallDir = "$env:AGENT_TOOLSDIRECTORY/dotnet" + $DotNetX86InstallDir = "$env:AGENT_TOOLSDIRECTORY/x86/dotnet" } else { $DotNetInstallDir = Join-Path $HOME .dotnet } -Write-Host "Installing .NET Core SDK and runtimes to $DotNetInstallDir" -ForegroundColor Blue - if ($DotNetInstallDir) { - $switches += '-InstallDir',"`"$DotNetInstallDir`"" + if (!(Test-Path $DotNetInstallDir)) { New-Item -ItemType Directory -Path $DotNetInstallDir } + $DotNetInstallDir = Resolve-Path $DotNetInstallDir + Write-Host "Installing .NET SDK and runtimes to $DotNetInstallDir" -ForegroundColor Blue $envVars['DOTNET_MULTILEVEL_LOOKUP'] = '0' $envVars['DOTNET_ROOT'] = $DotNetInstallDir } +if ($IncludeX86) { + if ($DotNetX86InstallDir) { + if (!(Test-Path $DotNetX86InstallDir)) { New-Item -ItemType Directory -Path $DotNetX86InstallDir } + $DotNetX86InstallDir = Resolve-Path $DotNetX86InstallDir + Write-Host "Installing x86 .NET SDK and runtimes to $DotNetX86InstallDir" -ForegroundColor Blue + } else { + # Only machine-wide or repo-wide installations can handle two unique dotnet.exe architectures. + Write-Error "The installation location or OS isn't supported for x86 installation. Try a different -InstallLocality value." + return 1 + } +} + if ($IsMacOS -or $IsLinux) { $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/781752509a890ca7520f1182e8bae71f9a53d754/src/dotnet-install.sh" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" @@ -219,47 +249,89 @@ $DotNetInstallScriptPathExpression = "& '$DotNetInstallScriptPathExpression'" $anythingInstalled = $false $global:LASTEXITCODE = 0 -if ($PSCmdlet.ShouldProcess(".NET Core SDK $sdkVersion", "Install")) { +if ($PSCmdlet.ShouldProcess(".NET SDK $sdkVersion", "Install")) { $anythingInstalled = $true - Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion $switches" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion -Architecture $arch -InstallDir $DotNetInstallDir $switches" if ($LASTEXITCODE -ne 0) { Write-Error ".NET SDK installation failure: $LASTEXITCODE" exit $LASTEXITCODE } } else { - Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion $switches -DryRun" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion -Architecture $arch -InstallDir $DotNetInstallDir $switches -DryRun" +} + +if ($IncludeX86) { + if ($PSCmdlet.ShouldProcess(".NET x86 SDK $sdkVersion", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion -Architecture x86 -InstallDir $DotNetX86InstallDir $switches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET x86 SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion -Architecture x86 -InstallDir $DotNetX86InstallDir $switches -DryRun" + } } $dotnetRuntimeSwitches = $switches + '-Runtime','dotnet' $runtimeVersions | Sort-Object -Unique |% { - if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { + if ($PSCmdlet.ShouldProcess(".NET Core $Arch runtime $_", "Install")) { $anythingInstalled = $true - Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $dotnetRuntimeSwitches" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $dotnetRuntimeSwitches" if ($LASTEXITCODE -ne 0) { Write-Error ".NET SDK installation failure: $LASTEXITCODE" exit $LASTEXITCODE } } else { - Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $dotnetRuntimeSwitches -DryRun" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $dotnetRuntimeSwitches -DryRun" + } + + if ($IncludeX86) { + if ($PSCmdlet.ShouldProcess(".NET Core x86 runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $dotnetRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $dotnetRuntimeSwitches -DryRun" + } } } $windowsDesktopRuntimeSwitches = $switches + '-Runtime','windowsdesktop' $windowsDesktopRuntimeVersions | Sort-Object -Unique |% { - if ($PSCmdlet.ShouldProcess(".NET Core WindowsDesktop runtime $_", "Install")) { + if ($PSCmdlet.ShouldProcess(".NET Core WindowsDesktop $arch runtime $_", "Install")) { $anythingInstalled = $true - Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $windowsDesktopRuntimeSwitches" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $windowsDesktopRuntimeSwitches" if ($LASTEXITCODE -ne 0) { Write-Error ".NET SDK installation failure: $LASTEXITCODE" exit $LASTEXITCODE } } else { - Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ $windowsDesktopRuntimeSwitches -DryRun" + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $windowsDesktopRuntimeSwitches -DryRun" + } + + if ($IncludeX86) { + if ($PSCmdlet.ShouldProcess(".NET Core WindowsDesktop x86 runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $windowsDesktopRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $windowsDesktopRuntimeSwitches -DryRun" + } } } From 78cba24937d03e10c3266e7421b1aef038d0e354 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 5 May 2022 21:07:12 -0600 Subject: [PATCH 429/889] Shift to `using` directives outside the namespace This is a concession from StyleCop defaults, but it's just too hard to paddle upstream with the C# language team, which doesn't consistently test their refactoring features when `using` is inside the namespace. --- stylecop.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stylecop.json b/stylecop.json index 37918949..6cd45574 100644 --- a/stylecop.json +++ b/stylecop.json @@ -10,6 +10,9 @@ }, "fileNamingConvention": "metadata", "xmlHeader": false + }, + "orderingRules": { + "usingDirectivesPlacement": "outsideNamespace" } } } From c82cc3463cb88e1591401059e127a1d84c4317f9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 5 May 2022 21:07:33 -0600 Subject: [PATCH 430/889] Permit attribute lists with multiple attributes in tests --- test/.editorconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/.editorconfig b/test/.editorconfig index 8aa791be..74dd4a1f 100644 --- a/test/.editorconfig +++ b/test/.editorconfig @@ -50,3 +50,6 @@ dotnet_diagnostic.CA2007.severity = none # SA1401: Fields should be private dotnet_diagnostic.SA1401.severity = silent + +# SA1133: Do not combine attributes +dotnet_diagnostic.SA1133.severity = silent From 0a6f58c3cc425ca7a8612acb9129e730fce8507c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 5 May 2022 21:22:34 -0600 Subject: [PATCH 431/889] Update Nerdbank.GitVersioning dependency --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 834e7457..2e13d76f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -37,7 +37,7 @@ - + From 9dde17ff42c902d3be0951021e049b7c8fc6fec1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 5 May 2022 21:32:22 -0600 Subject: [PATCH 432/889] Use icons for all task display names --- azure-pipelines/build.yml | 2 +- azure-pipelines/dotnet.yml | 10 +++++----- azure-pipelines/expand-template.yml | 6 +++--- azure-pipelines/install-dependencies.yml | 6 +++--- azure-pipelines/publish-codecoverage.yml | 10 +++++----- azure-pipelines/publish-deployables.yml | 4 ++-- azure-pipelines/publish-symbols.yml | 16 ++++++++-------- azure-pipelines/release.yml | 10 +++++----- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index f779fd12..5bfd95f5 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -14,7 +14,7 @@ jobs: - template: install-dependencies.yml - powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud -c' - displayName: Set build number + displayName: ⚙ Set build number - template: dotnet.yml - template: expand-template.yml diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index a103adfd..1d7d9de7 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -1,23 +1,23 @@ steps: - script: dotnet build -t:build,pack --no-restore -c $(BuildConfiguration) /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" - displayName: dotnet build + displayName: 🛠 dotnet build - powershell: azure-pipelines/dotnet-test-cloud.ps1 -Configuration $(BuildConfiguration) -Agent $(Agent.JobName) -PublishResults - displayName: dotnet test + displayName: 🧪 dotnet test - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true - displayName: Update pipeline variables based on build outputs + displayName: ⚙ Update pipeline variables based on build outputs condition: succeededOrFailed() - powershell: azure-pipelines/artifacts/_pipelines.ps1 -ArtifactNameSuffix "-$(Agent.JobName)" failOnStderr: true - displayName: Publish artifacts + displayName: 📢 Publish artifacts condition: succeededOrFailed() - bash: bash <(curl -s https://codecov.io/bash) - displayName: Publish code coverage results to codecov.io + displayName: 📢 Publish code coverage results to codecov.io condition: ne(variables['codecov_token'], '') timeoutInMinutes: 3 continueOnError: true diff --git a/azure-pipelines/expand-template.yml b/azure-pipelines/expand-template.yml index ed510de3..d843f1ea 100644 --- a/azure-pipelines/expand-template.yml +++ b/azure-pipelines/expand-template.yml @@ -2,13 +2,13 @@ steps: - script: | dotnet build-server shutdown git clean -fdx - displayName: Cleaning repo for template expansion + displayName: 🧹 Cleaning repo for template expansion - powershell: | git config user.name "test user" git config user.email "andrewarnott@gmail.com" ./Expand-Template.ps1 -LibraryName Calc -Author "Andrew Arnott" - displayName: Expanding template + displayName: 🧪 Expanding template failOnStderr: true # TODO: Verify that all changes are staged to the git index - script: dotnet build - displayName: dotnet build (expanded template) + displayName: 🛠 dotnet build (expanded template) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 4f848b09..3993f104 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -4,7 +4,7 @@ parameters: steps: - task: NuGetAuthenticate@0 - displayName: Authenticate NuGet feeds + displayName: 🔏 Authenticate NuGet feeds inputs: forceReinstallCredentialProvider: true @@ -17,9 +17,9 @@ steps: if (Get-Command mono -ErrorAction SilentlyContinue) { mono --version } - displayName: Install prerequisites + displayName: ⚙ Install prerequisites - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true - displayName: Set pipeline variables based on source + displayName: ⚙ Set pipeline variables based on source name: SetPipelineVariables diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index a0862be3..423e12fc 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -4,15 +4,15 @@ parameters: steps: - download: current artifact: coverageResults-Windows - displayName: Download Windows code coverage results + displayName: 🔻 Download Windows code coverage results continueOnError: true - download: current artifact: coverageResults-Linux - displayName: Download Linux code coverage results + displayName: 🔻 Download Linux code coverage results continueOnError: true - download: current artifact: coverageResults-macOS - displayName: Download macOS code coverage results + displayName: 🔻 Download macOS code coverage results continueOnError: true condition: ${{ parameters.includeMacOS }} - powershell: | @@ -26,9 +26,9 @@ steps: } $Inputs = [string]::join(';', ($reports |% { Resolve-Path -relative $_ })) obj/reportgenerator -reports:"$Inputs" -targetdir:coveragereport -reporttypes:Cobertura - displayName: Merge coverage + displayName: ⚙ Merge coverage - task: PublishCodeCoverageResults@1 - displayName: Publish code coverage results to Azure DevOps + displayName: 📢 Publish code coverage results to Azure DevOps inputs: codeCoverageTool: cobertura summaryFileLocation: 'coveragereport/Cobertura.xml' diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml index 9ccdc29e..31e80a43 100644 --- a/azure-pipelines/publish-deployables.yml +++ b/azure-pipelines/publish-deployables.yml @@ -1,8 +1,8 @@ steps: - download: current - displayName: Download deployables + displayName: 🔻 Download deployables artifact: deployables-Windows - powershell: dotnet nuget push "$(Resolve-Path '$(Pipeline.Workspace)\deployables-Windows\')*.nupkg" -s $(ci_feed) -k azdo --skip-duplicate - displayName: Push packages to CI feed + displayName: 📦 Push packages to CI feed condition: and(succeeded(), ne(variables['ci_feed'], ''), ne(variables['Build.Reason'], 'PullRequest')) diff --git a/azure-pipelines/publish-symbols.yml b/azure-pipelines/publish-symbols.yml index c45eff02..00c188fc 100644 --- a/azure-pipelines/publish-symbols.yml +++ b/azure-pipelines/publish-symbols.yml @@ -6,19 +6,19 @@ steps: inputs: artifact: symbols-Windows path: $(Pipeline.Workspace)/symbols/Windows - displayName: Download Windows symbols + displayName: 🔻 Download Windows symbols continueOnError: true - task: DownloadPipelineArtifact@2 inputs: artifact: symbols-Linux path: $(Pipeline.Workspace)/symbols/Linux - displayName: Download Linux symbols + displayName: 🔻 Download Linux symbols continueOnError: true - task: DownloadPipelineArtifact@2 inputs: artifact: symbols-macOS path: $(Pipeline.Workspace)/symbols/macOS - displayName: Download macOS symbols + displayName: 🔻 Download macOS symbols continueOnError: true condition: ${{ parameters.includeMacOS }} @@ -26,19 +26,19 @@ steps: inputs: artifact: test_symbols-Windows path: $(Pipeline.Workspace)/test_symbols/Windows - displayName: Download Windows test symbols + displayName: 🔻 Download Windows test symbols continueOnError: true - task: DownloadPipelineArtifact@2 inputs: artifact: test_symbols-Linux path: $(Pipeline.Workspace)/test_symbols/Linux - displayName: Download Linux test symbols + displayName: 🔻 Download Linux test symbols continueOnError: true - task: DownloadPipelineArtifact@2 inputs: artifact: test_symbols-macOS path: $(Pipeline.Workspace)/test_symbols/macOS - displayName: Download macOS test symbols + displayName: 🔻 Download macOS test symbols continueOnError: true condition: ${{ parameters.includeMacOS }} @@ -48,7 +48,7 @@ steps: SearchPattern: '**/*.pdb' IndexSources: false SymbolServerType: TeamServices - displayName: Publish symbols + displayName: 📢 Publish symbols - task: PublishSymbols@2 inputs: @@ -56,4 +56,4 @@ steps: SearchPattern: '**/*.pdb' IndexSources: false SymbolServerType: TeamServices - displayName: Publish test symbols + displayName: 📢 Publish test symbols diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index 6690cccf..2679b24e 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -25,18 +25,18 @@ jobs: } else { Write-Host "##vso[task.setvariable variable=IsPrerelease]false" } - displayName: Set up pipeline + displayName: ⚙ Set up pipeline - task: UseDotNet@2 - displayName: Install .NET SDK + displayName: ⚙ Install .NET SDK inputs: packageType: sdk version: 6.x - download: CI artifact: deployables-Windows - displayName: Download deployables-Windows artifact + displayName: 🔻 Download deployables-Windows artifact patterns: 'deployables-Windows/*' - task: GitHubRelease@1 - displayName: GitHub release (create) + displayName: 📢 GitHub release (create) inputs: gitHubConnection: # TODO: fill in service connection here repositoryName: $(Build.Repository.Name) @@ -55,5 +55,5 @@ jobs: { "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" } ] - script: dotnet nuget push $(Pipeline.Workspace)/CI/deployables-Windows/*.nupkg -s https://api.nuget.org/v3/index.json --api-key $(NuGetOrgApiKey) --skip-duplicate - displayName: Push packages to nuget.org + displayName: 📦 Push packages to nuget.org condition: and(succeeded(), ne(variables['NuGetOrgApiKey'], '')) From 9805678248d0fbda63f97982f37e35de71890d2f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 12 May 2022 08:41:05 -0600 Subject: [PATCH 433/889] Fix NUGET_PACKAGES path in pipelines Be default the NUGET_PACKAGES path has a trailing slash. In our override, we should do this as well or the msbuild property that gets generated is missing the slash, which can break some builds. --- .github/workflows/build.yml | 2 +- azure-pipelines.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 18ae3e28..4db43f53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BUILDCONFIGURATION: Release codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ - NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages + NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages/ jobs: build: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b7d86b45..d98ed107 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,7 +24,7 @@ variables: BuildConfiguration: Release codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ ci_feed: https://pkgs.dev.azure.com/andrewarnott/_packaging/CI/nuget/v3/index.json # Azure Artifacts feed URL - NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages + NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ jobs: - template: azure-pipelines/build.yml From da08e901c94c416cbbdfa980020ced9ed9612851 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 12 May 2022 16:08:56 -0600 Subject: [PATCH 434/889] Add ability to split stage and publish artifact steps --- azure-pipelines/artifacts/_all.ps1 | 10 +++---- azure-pipelines/artifacts/_pipelines.ps1 | 35 ++++++++++++++++++++---- azure-pipelines/artifacts/_stage_all.ps1 | 8 +++++- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1 index afe42be3..c9182a45 100755 --- a/azure-pipelines/artifacts/_all.ps1 +++ b/azure-pipelines/artifacts/_all.ps1 @@ -12,7 +12,7 @@ Value = an array of paths (absolute or relative to the BaseDirectory) to files to include in the artifact. FileInfo objects are also allowed. .PARAMETER Force - Executes artifact scripts even if they have already been uploaded. + Executes artifact scripts even if they have already been staged. #> param ( @@ -28,14 +28,14 @@ Function EnsureTrailingSlash($path) { $path.Replace('\', [IO.Path]::DirectorySeparatorChar) } -Function Test-ArtifactUploaded($artifactName) { - $varName = "ARTIFACTUPLOADED_$($artifactName.ToUpper())" +Function Test-ArtifactStaged($artifactName) { + $varName = "ARTIFACTSTAGED_$($artifactName.ToUpper())" Test-Path "env:$varName" } Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse | % { $ArtifactName = $_.BaseName - if ($Force -or !(Test-ArtifactUploaded($ArtifactName + $ArtifactNameSuffix))) { + if ($Force -or !(Test-ArtifactStaged($ArtifactName + $ArtifactNameSuffix))) { $totalFileCount = 0 $fileGroups = & $_ if ($fileGroups) { @@ -65,6 +65,6 @@ Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse | % { Write-Warning "No files found for the `"$ArtifactName`" artifact." } } else { - Write-Host "Skipping $ArtifactName because it has already been uploaded." -ForegroundColor DarkGray + Write-Host "Skipping $ArtifactName because it has already been staged." -ForegroundColor DarkGray } } diff --git a/azure-pipelines/artifacts/_pipelines.ps1 b/azure-pipelines/artifacts/_pipelines.ps1 index 73a3af0a..a62d2675 100644 --- a/azure-pipelines/artifacts/_pipelines.ps1 +++ b/azure-pipelines/artifacts/_pipelines.ps1 @@ -2,14 +2,39 @@ # into commands that instruct Azure Pipelines to actually collect those artifacts. param ( - [string]$ArtifactNameSuffix + [string]$ArtifactNameSuffix, + [switch]$StageOnly ) -& "$PSScriptRoot/_stage_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix |% { - Write-Host "##vso[artifact.upload containerfolder=$($_.Name);artifactname=$($_.Name);]$($_.Path)" +Function Set-PipelineVariable($name, $value) { + if ((Test-Path "Env:\$name") -and (Get-Item "Env:\$name").Value -eq $value) { + return # already set + } + + #New-Item -Path "Env:\$name".ToUpper() -Value $value -Force | Out-Null + Write-Host "##vso[task.setvariable variable=$name]$value" +} + +Function Test-ArtifactUploaded($artifactName) { + $varName = "ARTIFACTUPLOADED_$($artifactName.ToUpper())" + Test-Path "env:$varName" +} +& "$PSScriptRoot/_stage_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix |% { # Set a variable which will out-live this script so that a subsequent attempt to collect and upload artifacts # will skip this one from a check in the _all.ps1 script. - $varName = "ARTIFACTUPLOADED_$($_.Name.ToUpper())" - Write-Host "##vso[task.setvariable variable=$varName]true" + Set-PipelineVariable "ARTIFACTSTAGED_$($_.Name.ToUpper())" 'true' + Write-Host "Staged artifact $($_.Name) to $($_.Path)" + + if (!$StageOnly) { + if (Test-ArtifactUploaded $_.Name) { + Write-Host "Skipping $($_.Name) because it has already been uploaded." -ForegroundColor DarkGray + } else { + Write-Host "##vso[artifact.upload containerfolder=$($_.Name);artifactname=$($_.Name);]$($_.Path)" + + # Set a variable which will out-live this script so that a subsequent attempt to collect and upload artifacts + # will skip this one from a check in the _all.ps1 script. + Set-PipelineVariable "ARTIFACTUPLOADED_$($_.Name.ToUpper())" 'true' + } + } } diff --git a/azure-pipelines/artifacts/_stage_all.ps1 b/azure-pipelines/artifacts/_stage_all.ps1 index e4954c13..b7166b4e 100644 --- a/azure-pipelines/artifacts/_stage_all.ps1 +++ b/azure-pipelines/artifacts/_stage_all.ps1 @@ -42,7 +42,13 @@ $Artifacts |% { } } -$Artifacts |% { "$($_.ArtifactName)$ArtifactNameSuffix" } | Get-Unique |% { +$ArtifactNames = $Artifacts |% { "$($_.ArtifactName)$ArtifactNameSuffix" } +$ArtifactNames += Get-ChildItem env:ARTIFACTSTAGED_* |% { + # Return from ALLCAPS to the actual capitalization used for the artifact. + $artifactNameAllCaps = "$($_.Name.Substring('ARTIFACTSTAGED_'.Length))" + (Get-ChildItem $ArtifactStagingFolder\$artifactNameAllCaps* -Filter $artifactNameAllCaps).Name +} +$ArtifactNames | Get-Unique |% { $artifact = New-Object -TypeName PSObject Add-Member -InputObject $artifact -MemberType NoteProperty -Name Name -Value $_ Add-Member -InputObject $artifact -MemberType NoteProperty -Name Path -Value (Join-Path $ArtifactStagingFolder $_) From c268a9e8d99bfed18778aaecea828720522c6dea Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 18 May 2022 16:18:24 -0600 Subject: [PATCH 435/889] Fix several Install-DotNetSdk issues * Stop popping Windows Explorer dialogs * Stop installing the same .NET runtime versions multiple times. * Install WindowsDesktop too. --- tools/Install-DotNetSdk.ps1 | 57 +++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 76a397f0..2bac3b9b 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -80,7 +80,7 @@ Function Get-FileFromWeb([Uri]$Uri, $OutDir) { $OutFile = Join-Path $OutDir $Uri.Segments[-1] if (!(Test-Path $OutFile)) { Write-Verbose "Downloading $Uri..." - if (!(Test-Path $OutDir)) { New-Item -ItemType Directory -Path $OutDir } + if (!(Test-Path $OutDir)) { New-Item -ItemType Directory -Path $OutDir | Out-Null } try { (New-Object System.Net.WebClient).DownloadFile($Uri, $OutFile) } finally { @@ -91,35 +91,31 @@ Function Get-FileFromWeb([Uri]$Uri, $OutDir) { $OutFile } -Function Get-InstallerExe($Version, $Architecture, [switch]$Runtime) { - $sdkOrRuntime = 'Sdk' - if ($Runtime) { $sdkOrRuntime = 'Runtime' } - +Function Get-InstallerExe( + $Version, + $Architecture, + [ValidateSet('Sdk','Runtime','WindowsDesktop')] + [string]$sku +) { # Get the latest/actual version for the specified one $TypedVersion = [Version]$Version if ($TypedVersion.Build -eq -1) { - $versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sdkOrRuntime/$Version/latest.version" -UseBasicParsing) + $versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sku/$Version/latest.version" -UseBasicParsing) $Version = $versionInfo[-1] } $majorMinor = "$($TypedVersion.Major).$($TypedVersion.Minor)" $ReleasesFile = Join-Path $DotNetInstallScriptRoot "$majorMinor\releases.json" if (!(Test-Path $ReleasesFile)) { - Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/$majorMinor/releases.json" -OutDir (Split-Path $ReleasesFile) + Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/$majorMinor/releases.json" -OutDir (Split-Path $ReleasesFile) | Out-Null } $releases = Get-Content $ReleasesFile | ConvertFrom-Json $url = $null foreach ($release in $releases.releases) { $filesElement = $null - if ($Runtime) { - if ($release.runtime.version -eq $Version) { - $filesElement = $release.runtime.files - } - } else { - if ($release.sdk.version -eq $Version) { - $filesElement = $release.sdk.files - } + if ($release.$sku.version -eq $Version) { + $filesElement = $release.$sku.files } if ($filesElement) { @@ -139,15 +135,14 @@ Function Get-InstallerExe($Version, $Architecture, [switch]$Runtime) { if ($url) { Get-FileFromWeb -Uri $url -OutDir $DotNetInstallScriptRoot } else { - Write-Error "Unable to find release of $sdkOrRuntime v$Version" + Write-Error "Unable to find release of $sku v$Version" } } -Function Install-DotNet($Version, $Architecture, [switch]$Runtime) { - if ($Runtime) { $sdkSubstring = '' } else { $sdkSubstring = 'SDK ' } - Write-Host "Downloading .NET Core $sdkSubstring$Version..." - $Installer = Get-InstallerExe -Version $Version -Architecture $Architecture -Runtime:$Runtime - Write-Host "Installing .NET Core $sdkSubstring$Version..." +Function Install-DotNet($Version, $Architecture, [ValidateSet('Sdk','Runtime','WindowsDesktop')][string]$sku = 'Sdk') { + Write-Host "Downloading .NET Core $sku $Version..." + $Installer = Get-InstallerExe -Version $Version -Architecture $Architecture -sku $sku + Write-Host "Installing .NET Core $sku $Version..." cmd /c start /wait $Installer /install /passive /norestart if ($LASTEXITCODE -eq 3010) { Write-Verbose "Restart required" @@ -177,13 +172,25 @@ if ($InstallLocality -eq 'machine') { } } - $runtimeVersions | Get-Unique |% { - if ($PSCmdlet.ShouldProcess(".NET Core runtime $_", "Install")) { - Install-DotNet -Version $_ -Architecture $arch -Runtime + $runtimeVersions | Sort-Object | Get-Unique |% { + if ($PSCmdlet.ShouldProcess(".NET runtime $_", "Install")) { + Install-DotNet -Version $_ -sku Runtime -Architecture $arch + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + + if ($IncludeX86) { + Install-DotNet -Version $_ -sku Runtime -Architecture x86 + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + } + } + } + + $windowsDesktopRuntimeVersions | Sort-Object | Get-Unique |% { + if ($PSCmdlet.ShouldProcess(".NET Windows Desktop $_", "Install")) { + Install-DotNet -Version $_ -sku WindowsDesktop -Architecture $arch $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) if ($IncludeX86) { - Install-DotNet -Version $_ -Architecture x86 -Runtime + Install-DotNet -Version $_ -sku WindowsDesktop -Architecture x86 $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) } } From 7bf4e22b5ab48ca5b0b3992804f685d9b857dad1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 20 May 2022 14:06:55 -0600 Subject: [PATCH 436/889] Fix Apply-Template merge check --- Apply-Template.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apply-Template.ps1 b/Apply-Template.ps1 index d659670b..12bfaa12 100644 --- a/Apply-Template.ps1 +++ b/Apply-Template.ps1 @@ -20,7 +20,7 @@ try { # Look for our own initial commit in the target repo's history. # If it's there, they've already switched to using git merge to freshen up. # Using Apply-Template would just complicate future merges, so block it. - git log 05f49ce799c1f9cc696d53eea89699d80f59f833 ^HEAD | Out-Null + git merge-base --is-ancestor 05f49ce799c1f9cc696d53eea89699d80f59f833 HEAD | Out-Null if ($LASTEXITCODE -eq 0) { Write-Error 'The target repo already has Library.Template history merged into it. Use `git merge` instead of this script to freshen your repo. See the README.md file for details.' exit 1 From 5abdd709c599b95cb6f584eef289fe665031116a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Jun 2022 08:24:16 -0600 Subject: [PATCH 437/889] Bump Microsoft.NET.Test.Sdk from 17.1.0 to 17.2.0 (#159) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.1.0 to 17.2.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v17.1.0...v17.2.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 20108645..7dd444b6 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -11,7 +11,7 @@ - + From 311e766eea33c9ea74f6b6b444fa2cb6463722c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Jun 2022 14:24:39 +0000 Subject: [PATCH 438/889] Bump Nerdbank.GitVersioning from 3.5.103 to 3.5.107 (#157) --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 2e13d76f..a2da14f6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -37,7 +37,7 @@ - + From 6a1593c66812b348812be702b41320290839ce0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Jun 2022 14:24:49 +0000 Subject: [PATCH 439/889] Bump StyleCop.Analyzers.Unstable from 1.2.0.406 to 1.2.0.435 (#156) --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index a2da14f6..22c1b94d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -40,7 +40,7 @@ - + From a91a2f1e2331902ab7515f1d317cf105892b9cb9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Jun 2022 14:31:58 +0000 Subject: [PATCH 440/889] Bump xunit.runner.visualstudio from 2.4.3 to 2.4.5 (#158) --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 7dd444b6..402468a8 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -12,7 +12,7 @@ - + From 8f2ed5eaf2436e9e49e741650308c0b45b4a53df Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 7 Jun 2022 15:50:23 -0600 Subject: [PATCH 441/889] Update SDK to 6.0.300 --- .devcontainer/Dockerfile | 2 +- global.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 234db6d1..b13ca0ac 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:6.0.200-focal +FROM mcr.microsoft.com/dotnet/sdk:6.0.300-focal # Installing mono makes `dotnet test` work without errors even for net472. # But installing it takes a long time, so it's excluded by default. diff --git a/global.json b/global.json index 6bfbd177..954a92e7 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.200", + "version": "6.0.300", "rollForward": "patch", "allowPrerelease": false } From 8c6b68ecdd6cb98a02bc89e762d4cf8851e0148b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 8 Jun 2022 08:48:38 -0600 Subject: [PATCH 442/889] Add adoption caution about github issues being closed --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 0f9715f3..8cab6b7a 100644 --- a/README.md +++ b/README.md @@ -79,5 +79,9 @@ We create the merge commit with these commands: 1. Run `git commit-tree -p HEAD -p A B -m "Merged latest Library.Template"`, where `A` is the output from `git rev-parse HEAD` that you recorded earlier, and `B` is the output from your prior `git write-tree` command. 1. Run `git merge X` where `X` is the output of the `git commit-tree` command. +**CAUTION**: when merging this for the first time, a github-hosted repo may close issues in your repo with the same number as issues that this repo closed in git commit messages. +Verify after completing your PR by visiting your github closed issues, sorted by recently updated, and reactivate any that were inadvertently closed by this merge. +This shouldn't be a recurring issue because going forward, we will avoid referencing github issues with simple `#123` syntax in this repo's history. + Congratulations. You're all done. Next time you want to sync to latest from Library.Template, you can the simple `git merge` steps given at the start of this section. From f678dd36be37f69272b6346b4ba3acb7472ec418 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 8 Jun 2022 12:12:42 -0600 Subject: [PATCH 443/889] Install the nuget cred provider for .NET 6 and .NET Framework Recently we've only been getting the .NET Core 3.1 plugin, which leaves .NET Framework-based nuget tools un-authenticated. --- tools/Install-NuGetCredProvider.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Install-NuGetCredProvider.ps1 b/tools/Install-NuGetCredProvider.ps1 index 6d310034..496049a2 100755 --- a/tools/Install-NuGetCredProvider.ps1 +++ b/tools/Install-NuGetCredProvider.ps1 @@ -33,7 +33,7 @@ if ($IsMacOS -or $IsLinux) { $installerScript = Join-Path $toolsPath $installerScript -if (!(Test-Path $installerScript)) { +if (!(Test-Path $installerScript) -or $Force) { Invoke-WebRequest $sourceUrl -OutFile $installerScript } @@ -43,7 +43,7 @@ if ($IsMacOS -or $IsLinux) { chmod u+x $installerScript } -& $installerScript -Force:$Force +& $installerScript -Force:$Force -AddNetfx -InstallNet6 if ($AccessToken) { $endpoints = @() From d8f567ef793329d7ff8cc09cf43922d2d00316c9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 8 Jun 2022 08:58:02 -0600 Subject: [PATCH 444/889] Avoid truncated code coverage data Apply workaround for microsoft/vstest issue 3724. --- azure-pipelines/artifacts/coverageResults.ps1 | 7 +-- azure-pipelines/dotnet-test-cloud.ps1 | 3 +- azure-pipelines/publish-codecoverage.yml | 7 +-- azure-pipelines/test.runsettings | 44 +++++++++++++++++++ test/Directory.Build.targets | 7 --- test/Library.Tests/Library.Tests.csproj | 1 - 6 files changed, 54 insertions(+), 15 deletions(-) create mode 100644 azure-pipelines/test.runsettings diff --git a/azure-pipelines/artifacts/coverageResults.ps1 b/azure-pipelines/artifacts/coverageResults.ps1 index 8fdb3f72..b3a08891 100644 --- a/azure-pipelines/artifacts/coverageResults.ps1 +++ b/azure-pipelines/artifacts/coverageResults.ps1 @@ -1,10 +1,11 @@ $RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") +$coverageFiles = @(Get-ChildItem "$RepoRoot/test/*.cobertura.xml" -Recurse) + # Prepare code coverage reports for merging on another machine if ($env:SYSTEM_DEFAULTWORKINGDIRECTORY) { Write-Host "Substituting $env:SYSTEM_DEFAULTWORKINGDIRECTORY with `"{reporoot}`"" - $reports = Get-ChildItem "$RepoRoot/bin/coverage.*cobertura.xml" -Recurse - $reports |% { + $coverageFiles |% { $content = Get-Content -Path $_ |% { $_ -Replace [regex]::Escape($env:SYSTEM_DEFAULTWORKINGDIRECTORY), "{reporoot}" } Set-Content -Path $_ -Value $content -Encoding UTF8 } @@ -16,7 +17,7 @@ if (!((Test-Path $RepoRoot\bin) -and (Test-Path $RepoRoot\obj))) { return } @{ $RepoRoot = ( - @(Get-ChildItem "$RepoRoot\bin\coverage.*cobertura.xml" -Recurse) + + $coverageFiles + (Get-ChildItem "$RepoRoot\obj\*.cs" -Recurse) ); } diff --git a/azure-pipelines/dotnet-test-cloud.ps1 b/azure-pipelines/dotnet-test-cloud.ps1 index 43cdc3e0..24bf812a 100755 --- a/azure-pipelines/dotnet-test-cloud.ps1 +++ b/azure-pipelines/dotnet-test-cloud.ps1 @@ -48,7 +48,8 @@ if ($x86) { --no-build ` -c $Configuration ` --filter "TestCategory!=FailsInCloudTest" ` - -p:CollectCoverage=true ` + --collect "Code Coverage;Format=cobertura" ` + --settings "$PSScriptRoot/test.runsettings" ` --blame-hang-timeout 60s ` --blame-crash ` -bl:"$ArtifactStagingFolder/build_logs/test.binlog" ` diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index 423e12fc..4bc1b3bb 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -16,14 +16,15 @@ steps: continueOnError: true condition: ${{ parameters.includeMacOS }} - powershell: | - dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 4.8.5 --configfile azure-pipelines/justnugetorg.nuget.config + dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 5.1.9 --configfile azure-pipelines/justnugetorg.nuget.config Copy-Item -Recurse $(Pipeline.Workspace)/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj Write-Host 'Substituting {reporoot} with $(System.DefaultWorkingDirectory)' - $reports = Get-ChildItem -Recurse '$(Pipeline.Workspace)/coverage.*cobertura.xml' + $reports = Get-ChildItem -Recurse '$(Pipeline.Workspace)/*.cobertura.xml' $reports |% { $content = Get-Content -Path $_ |% { $_.Replace('{reporoot}', '$(System.DefaultWorkingDirectory)') } Set-Content -Path $_ -Value $content -Encoding UTF8 } + $Inputs = [string]::join(';', ($reports |% { Resolve-Path -relative $_ })) obj/reportgenerator -reports:"$Inputs" -targetdir:coveragereport -reporttypes:Cobertura displayName: ⚙ Merge coverage @@ -31,5 +32,5 @@ steps: displayName: 📢 Publish code coverage results to Azure DevOps inputs: codeCoverageTool: cobertura - summaryFileLocation: 'coveragereport/Cobertura.xml' + summaryFileLocation: coveragereport/Cobertura.xml failIfCoverageEmpty: true diff --git a/azure-pipelines/test.runsettings b/azure-pipelines/test.runsettings new file mode 100644 index 00000000..c69022fc --- /dev/null +++ b/azure-pipelines/test.runsettings @@ -0,0 +1,44 @@ + + + + + + + + + \.dll$ + \.exe$ + + + xunit\..* + + + + + ^System\.Diagnostics\.DebuggerHiddenAttribute$ + ^System\.Diagnostics\.DebuggerNonUserCodeAttribute$ + ^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$ + ^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$ + + + + + True + + True + + True + + False + + True + + True + + True + + + + + + diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets index 2faab375..e7edee55 100644 --- a/test/Directory.Build.targets +++ b/test/Directory.Build.targets @@ -1,10 +1,3 @@ - - cobertura - [xunit.*]* - - $(OutputPath)/ - - diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 402468a8..92062dc7 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,7 +10,6 @@ - From f064b9a150eb529716d393fc0f1f60b55a301eb4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 8 Jun 2022 16:22:01 -0600 Subject: [PATCH 445/889] Normalize slashes in coverage --- azure-pipelines/publish-codecoverage.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index 4bc1b3bb..23e88a6e 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -21,7 +21,8 @@ steps: Write-Host 'Substituting {reporoot} with $(System.DefaultWorkingDirectory)' $reports = Get-ChildItem -Recurse '$(Pipeline.Workspace)/*.cobertura.xml' $reports |% { - $content = Get-Content -Path $_ |% { $_.Replace('{reporoot}', '$(System.DefaultWorkingDirectory)') } + # In addition to replacing {reporoot}, we also normalize on one kind of slash so that the report aggregates data for a file whether data was collected on Windows or not. + $content = Get-Content -Path $_ |% { [Regex]::Replace($_, '{reporoot}([^"]+)', { '$(System.DefaultWorkingDirectory)' + $args[0].groups[1].value.replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar) }) } Set-Content -Path $_ -Value $content -Encoding UTF8 } From e903112e9ebff59ebad913bf6c89b14f97f707b1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 14 Jun 2022 13:20:10 -0600 Subject: [PATCH 446/889] Include only unique coverage reports in artifact The test runner is creating *two* cobertura.xml files for each test run. Besides doubling the size of the coverageResults artifact, this makes the `publish-codecoverage.yml` pipeline step do much more work which can take *minutes* instead of seconds. --- azure-pipelines/artifacts/coverageResults.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/artifacts/coverageResults.ps1 b/azure-pipelines/artifacts/coverageResults.ps1 index b3a08891..280ff9ae 100644 --- a/azure-pipelines/artifacts/coverageResults.ps1 +++ b/azure-pipelines/artifacts/coverageResults.ps1 @@ -1,6 +1,6 @@ $RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") -$coverageFiles = @(Get-ChildItem "$RepoRoot/test/*.cobertura.xml" -Recurse) +$coverageFiles = @(Get-ChildItem "$RepoRoot/test/*.cobertura.xml" -Recurse | Where {$_.FullName -notlike "*/In/*" -and $_.FullName -notlike "*\In\*" }) # Prepare code coverage reports for merging on another machine if ($env:SYSTEM_DEFAULTWORKINGDIRECTORY) { From c881dcad9590e33952a956950d6a2e4c4249c0ef Mon Sep 17 00:00:00 2001 From: Steve Bush Date: Wed, 15 Jun 2022 09:02:52 -0700 Subject: [PATCH 447/889] CodeCov binary uploader Replaces the bash CodeCov uploader with the latest binary version. A PowerShell script downloads the latest codecov binary. Another PowerShell script collects and uploads code coverage artifact files to CodeCov.io. You can pass flags and a coverage report name as parameters. --- .github/workflows/build.yml | 5 ++-- azure-pipelines/Get-CodeCovTool.ps1 | 38 ++++++++++++++++++++++++++ azure-pipelines/dotnet.yml | 5 +++- azure-pipelines/publish-CodeCov.ps1 | 42 +++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 azure-pipelines/Get-CodeCovTool.ps1 create mode 100644 azure-pipelines/publish-CodeCov.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4db43f53..cde83cd9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -109,7 +109,8 @@ jobs: path: ${{ runner.temp }}/_artifacts/deployables if: always() - name: Publish code coverage results to codecov.io - run: bash <(curl -s https://codecov.io/bash) - shell: bash + run: ./azure-pipelines/publish-CodeCov.ps1 -CodeCovToken "${{ env.codecov_token }}" -PathToCodeCoverage "${{ runner.temp }}/_artifacts/coverageResults" -Name "${{ runner.os }} Coverage Results" -Flags "${{ runner.os }}Host,${{ env.BUILDCONFIGURATION }}" + shell: pwsh timeout-minutes: 3 continue-on-error: true + if: always() diff --git a/azure-pipelines/Get-CodeCovTool.ps1 b/azure-pipelines/Get-CodeCovTool.ps1 new file mode 100644 index 00000000..d6ca157b --- /dev/null +++ b/azure-pipelines/Get-CodeCovTool.ps1 @@ -0,0 +1,38 @@ +<# +.SYNOPSIS + Downloads the CodeCov.io uploader tool and returns the path to it. +#> +[CmdletBinding()] +Param( +) + +$toolsPath = & "$PSScriptRoot\Get-TempToolsPath.ps1" +$binaryToolsPath = Join-Path $toolsPath codecov +if (!(Test-Path $binaryToolsPath)) { $null = mkdir $binaryToolsPath } + +if ($IsMacOS) +{ + $codeCovPath = Join-Path $binaryToolsPath codecov + $codeCovUrl = "https://uploader.codecov.io/latest/macos/codecov" +} +elseif ($IsLinux) +{ + $codeCovPath = Join-Path $binaryToolsPath codecov + $codeCovUrl = "https://uploader.codecov.io/latest/linux/codecov" +} +else +{ + $codeCovPath = Join-Path $binaryToolsPath codecov.exe + $codeCovUrl = "https://uploader.codecov.io/latest/windows/codecov.exe" +} + +if (!(Test-Path $codeCovPath)) { + Write-Host "Downloading latest codeconv..." -ForegroundColor Yellow + (New-Object System.Net.WebClient).DownloadFile($codeCovUrl, $codeCovPath) +} + +if ($IsMacOS -or $IsLinux) { + chmod u+x $codeCovPath +} + +return (Resolve-Path $codeCovPath).Path diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 1d7d9de7..a461c147 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -16,7 +16,10 @@ steps: displayName: 📢 Publish artifacts condition: succeededOrFailed() -- bash: bash <(curl -s https://codecov.io/bash) +- powershell: | + $ArtifactStagingFolder = & "azure-pipelines/Get-ArtifactsStagingDirectory.ps1" + $CoverageResultsFolder = Join-Path $ArtifactStagingFolder "coverageResults-$(Agent.JobName)" + azure-pipelines/publish-CodeCov.ps1 -CodeCovToken "$(codecov_token)" -PathToCodeCoverage "$CoverageResultsFolder" -Name "$(Agent.JobName) Coverage Results" -Flags "$(Agent.JobName)Host,$(BuildConfiguration)" displayName: 📢 Publish code coverage results to codecov.io condition: ne(variables['codecov_token'], '') timeoutInMinutes: 3 diff --git a/azure-pipelines/publish-CodeCov.ps1 b/azure-pipelines/publish-CodeCov.ps1 new file mode 100644 index 00000000..ec550e7a --- /dev/null +++ b/azure-pipelines/publish-CodeCov.ps1 @@ -0,0 +1,42 @@ +<# +.SYNOPSIS + Uploads code coverage to codecov.io +.PARAMETER CodeCovToken + Code coverage token to use +.PARAMETER PathToCodeCoverage + Path to root of code coverage files +.PARAMETER Name + Optional name to upload with codecoverge +.PARAMETER Flags + Optional flags to upload with codecoverge +#> +[CmdletBinding()] +Param ( + [string]$CodeCovToken, + [string]$PathToCodeCoverage, + [string]$Name="", + [string]$Flags="" +) + +$RepoRoot = (Resolve-Path "$PSScriptRoot/..").Path +$CodeCoveragePathWildcard = (Join-Path $PathToCodeCoverage "*.cobertura.xml") + +Write-Host "RepoRoot: $RepoRoot" -ForegroundColor Yellow +Write-Host "CodeCoveragePathWildcard: $CodeCoveragePathWildcard" -ForegroundColor Yellow + +Get-ChildItem -Recurse -Path $CodeCoveragePathWildcard | % { + + if ($IsMacOS -or $IsLinux) + { + $relativeFilePath = Resolve-Path -relative $_ + } + else + { + $relativeFilePath = Resolve-Path -relative (Get-ChildItem $_ | Select-Object -ExpandProperty Target) + } + + Write-Host "Uploading: $relativeFilePath" -ForegroundColor Yellow + Write-Host "Flags: $Flags$TargetFrameworkFlag$TestTypeFlag$OSTypeFlag" -ForegroundColor Yellow + + & (& "$PSScriptRoot/Get-CodeCovTool.ps1") -t "$CodeCovToken" -f "$relativeFilePath" -R "$RepoRoot" -F "$Flags" -n "$Name" +} From 79a441098f323457a8033a09a843300b00631de3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 15 Jun 2022 13:08:50 -0600 Subject: [PATCH 448/889] Add completions for dotnet-test-cloud script --- azure-pipelines/dotnet-test-cloud.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/dotnet-test-cloud.ps1 b/azure-pipelines/dotnet-test-cloud.ps1 index 24bf812a..d07f1ad8 100755 --- a/azure-pipelines/dotnet-test-cloud.ps1 +++ b/azure-pipelines/dotnet-test-cloud.ps1 @@ -16,6 +16,7 @@ #> [CmdletBinding()] Param( + [ValidateSet('Debug', 'Release')] [string]$Configuration='Debug', [string]$Agent='Local', [switch]$PublishResults, From 85d970c258bafda482b003ba79f4510a491a570d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 15 Jun 2022 13:09:08 -0600 Subject: [PATCH 449/889] Move coverage merge script to a ps1 that can be locally invoked --- .gitignore | 1 + azure-pipelines/Merge-CodeCoverage.ps1 | 42 ++++++++++++++++++++++++ azure-pipelines/publish-codecoverage.yml | 14 +------- 3 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 azure-pipelines/Merge-CodeCoverage.ps1 diff --git a/.gitignore b/.gitignore index 65f94776..3bb49919 100644 --- a/.gitignore +++ b/.gitignore @@ -140,6 +140,7 @@ _TeamCity* # Visual Studio code coverage results *.coverage *.coveragexml +/coveragereport/ # NCrunch _NCrunch_* diff --git a/azure-pipelines/Merge-CodeCoverage.ps1 b/azure-pipelines/Merge-CodeCoverage.ps1 new file mode 100644 index 00000000..6672b94c --- /dev/null +++ b/azure-pipelines/Merge-CodeCoverage.ps1 @@ -0,0 +1,42 @@ +#!/usr/bin/env pwsh + +<# +.SYNOPSIS + Merges code coverage reports. +.PARAMETER Path + The path(s) to search for Cobertura code coverage reports. +.PARAMETER Format + The format for the merged result. The default is Cobertura +.PARAMETER OutputDir + The directory the merged result will be written to. The default is `coveragereport` in the root of this repo. +#> +[CmdletBinding()] +Param( + [Parameter(Mandatory=$true)] + [string[]]$Path, + [ValidateSet('Badges', 'Clover', 'Cobertura', 'CsvSummary', 'Html', 'Html_Dark', 'Html_Light', 'HtmlChart', 'HtmlInline', 'HtmlInline_AzurePipelines', 'HtmlInline_AzurePipelines_Dark', 'HtmlInline_AzurePipelines_Light', 'HtmlSummary', 'JsonSummary', 'Latex', 'LatexSummary', 'lcov', 'MarkdownSummary', 'MHtml', 'PngChart', 'SonarQube', 'TeamCitySummary', 'TextSummary', 'Xml', 'XmlSummary')] + [string]$Format='Cobertura', + [string]$OutputDir=("$PSScriptRoot/../coveragereport") +) + +$RepoRoot = [string](Resolve-Path $PSScriptRoot/..) + +if (!(Test-Path $RepoRoot/obj/reportgenerator*)) { + dotnet tool install --tool-path $RepoRoot/obj dotnet-reportgenerator-globaltool --version 5.1.9 --configfile $PSScriptRoot/justnugetorg.nuget.config +} + +Write-Verbose "Searching $Path for *.cobertura.xml files" +$reports = Get-ChildItem -Recurse $Path -Filter *.cobertura.xml + +if ($reports) { + $reports |% { $_.FullName } |% { + # In addition to replacing {reporoot}, we also normalize on one kind of slash so that the report aggregates data for a file whether data was collected on Windows or not. + $content = Get-Content -Path $_ |% { [Regex]::Replace($_, '{reporoot}([^"]+)', { $RepoRoot + $args[0].groups[1].value.replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar) }) } + Set-Content -Path $_ -Value $content -Encoding UTF8 + } + + $Inputs = [string]::join(';', ($reports |% { Resolve-Path -relative $_.FullName })) + & "$RepoRoot/obj/reportgenerator" -reports:"$Inputs" -targetdir:$OutputDir -reporttypes:$Format +} else { + Write-Error "No reports found to merge." +} diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index 23e88a6e..6e7ef21b 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -15,19 +15,7 @@ steps: displayName: 🔻 Download macOS code coverage results continueOnError: true condition: ${{ parameters.includeMacOS }} -- powershell: | - dotnet tool install --tool-path obj dotnet-reportgenerator-globaltool --version 5.1.9 --configfile azure-pipelines/justnugetorg.nuget.config - Copy-Item -Recurse $(Pipeline.Workspace)/coverageResults-Windows/obj/* $(System.DefaultWorkingDirectory)/obj - Write-Host 'Substituting {reporoot} with $(System.DefaultWorkingDirectory)' - $reports = Get-ChildItem -Recurse '$(Pipeline.Workspace)/*.cobertura.xml' - $reports |% { - # In addition to replacing {reporoot}, we also normalize on one kind of slash so that the report aggregates data for a file whether data was collected on Windows or not. - $content = Get-Content -Path $_ |% { [Regex]::Replace($_, '{reporoot}([^"]+)', { '$(System.DefaultWorkingDirectory)' + $args[0].groups[1].value.replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar) }) } - Set-Content -Path $_ -Value $content -Encoding UTF8 - } - - $Inputs = [string]::join(';', ($reports |% { Resolve-Path -relative $_ })) - obj/reportgenerator -reports:"$Inputs" -targetdir:coveragereport -reporttypes:Cobertura +- powershell: azure-pipelines/Merge-CodeCoverage.ps1 -Path '$(Pipeline.Workspace)' -OutputDir coveragereport -Format Cobertura -Verbose displayName: ⚙ Merge coverage - task: PublishCodeCoverageResults@1 displayName: 📢 Publish code coverage results to Azure DevOps From ac247b8566c88e201f1df92013048ce7f3a30772 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 17 Jun 2022 15:44:22 -0600 Subject: [PATCH 450/889] Revert "Add completions for dotnet-test-cloud script" It was problematic since it disallowed non-default config names. This reverts commit 79a441098f323457a8033a09a843300b00631de3. --- azure-pipelines/dotnet-test-cloud.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines/dotnet-test-cloud.ps1 b/azure-pipelines/dotnet-test-cloud.ps1 index d07f1ad8..24bf812a 100755 --- a/azure-pipelines/dotnet-test-cloud.ps1 +++ b/azure-pipelines/dotnet-test-cloud.ps1 @@ -16,7 +16,6 @@ #> [CmdletBinding()] Param( - [ValidateSet('Debug', 'Release')] [string]$Configuration='Debug', [string]$Agent='Local', [switch]$PublishResults, From 6156061d6576a32b150393a22787c24629ef1545 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 18 Jun 2022 12:15:07 -0600 Subject: [PATCH 451/889] Touch-up formatting and simplify/correct a bit --- azure-pipelines/Get-CodeCovTool.ps1 | 11 ++++------- azure-pipelines/publish-CodeCov.ps1 | 30 +++++++++-------------------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/azure-pipelines/Get-CodeCovTool.ps1 b/azure-pipelines/Get-CodeCovTool.ps1 index d6ca157b..63b5d3f3 100644 --- a/azure-pipelines/Get-CodeCovTool.ps1 +++ b/azure-pipelines/Get-CodeCovTool.ps1 @@ -10,24 +10,21 @@ $toolsPath = & "$PSScriptRoot\Get-TempToolsPath.ps1" $binaryToolsPath = Join-Path $toolsPath codecov if (!(Test-Path $binaryToolsPath)) { $null = mkdir $binaryToolsPath } -if ($IsMacOS) -{ +if ($IsMacOS) { $codeCovPath = Join-Path $binaryToolsPath codecov $codeCovUrl = "https://uploader.codecov.io/latest/macos/codecov" } -elseif ($IsLinux) -{ +elseif ($IsLinux) { $codeCovPath = Join-Path $binaryToolsPath codecov $codeCovUrl = "https://uploader.codecov.io/latest/linux/codecov" } -else -{ +else { $codeCovPath = Join-Path $binaryToolsPath codecov.exe $codeCovUrl = "https://uploader.codecov.io/latest/windows/codecov.exe" } if (!(Test-Path $codeCovPath)) { - Write-Host "Downloading latest codeconv..." -ForegroundColor Yellow + Write-Host "Downloading latest codecov upload tool..." -ForegroundColor Yellow (New-Object System.Net.WebClient).DownloadFile($codeCovUrl, $codeCovPath) } diff --git a/azure-pipelines/publish-CodeCov.ps1 b/azure-pipelines/publish-CodeCov.ps1 index ec550e7a..1f4d3790 100644 --- a/azure-pipelines/publish-CodeCov.ps1 +++ b/azure-pipelines/publish-CodeCov.ps1 @@ -6,37 +6,25 @@ .PARAMETER PathToCodeCoverage Path to root of code coverage files .PARAMETER Name - Optional name to upload with codecoverge + Name to upload with codecoverge .PARAMETER Flags - Optional flags to upload with codecoverge + Flags to upload with codecoverge #> [CmdletBinding()] Param ( + [Parameter(Mandatory=$true)] [string]$CodeCovToken, + [Parameter(Mandatory=$true)] [string]$PathToCodeCoverage, - [string]$Name="", - [string]$Flags="" + [string]$Name, + [string]$Flags ) $RepoRoot = (Resolve-Path "$PSScriptRoot/..").Path -$CodeCoveragePathWildcard = (Join-Path $PathToCodeCoverage "*.cobertura.xml") -Write-Host "RepoRoot: $RepoRoot" -ForegroundColor Yellow -Write-Host "CodeCoveragePathWildcard: $CodeCoveragePathWildcard" -ForegroundColor Yellow - -Get-ChildItem -Recurse -Path $CodeCoveragePathWildcard | % { - - if ($IsMacOS -or $IsLinux) - { - $relativeFilePath = Resolve-Path -relative $_ - } - else - { - $relativeFilePath = Resolve-Path -relative (Get-ChildItem $_ | Select-Object -ExpandProperty Target) - } +Get-ChildItem -Recurse -Path $PathToCodeCoverage -Filter "*.cobertura.xml" | % { + $relativeFilePath = Resolve-Path -relative $_ Write-Host "Uploading: $relativeFilePath" -ForegroundColor Yellow - Write-Host "Flags: $Flags$TargetFrameworkFlag$TestTypeFlag$OSTypeFlag" -ForegroundColor Yellow - - & (& "$PSScriptRoot/Get-CodeCovTool.ps1") -t "$CodeCovToken" -f "$relativeFilePath" -R "$RepoRoot" -F "$Flags" -n "$Name" + & (& "$PSScriptRoot/Get-CodeCovTool.ps1") -t $CodeCovToken -f $relativeFilePath -R $RepoRoot -F $Flags -n $Name } From 50d35dfde8113caedeca40f6c14d8b93686b3055 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 18 Jun 2022 15:22:38 -0600 Subject: [PATCH 452/889] fixup --- azure-pipelines/publish-CodeCov.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/publish-CodeCov.ps1 b/azure-pipelines/publish-CodeCov.ps1 index 1f4d3790..9926f018 100644 --- a/azure-pipelines/publish-CodeCov.ps1 +++ b/azure-pipelines/publish-CodeCov.ps1 @@ -23,7 +23,7 @@ Param ( $RepoRoot = (Resolve-Path "$PSScriptRoot/..").Path Get-ChildItem -Recurse -Path $PathToCodeCoverage -Filter "*.cobertura.xml" | % { - $relativeFilePath = Resolve-Path -relative $_ + $relativeFilePath = Resolve-Path -relative $_.FullName Write-Host "Uploading: $relativeFilePath" -ForegroundColor Yellow & (& "$PSScriptRoot/Get-CodeCovTool.ps1") -t $CodeCovToken -f $relativeFilePath -R $RepoRoot -F $Flags -n $Name From 8abd437547653f0c2a01eb96dcf75d9945829cf0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 18 Jun 2022 14:54:27 -0600 Subject: [PATCH 453/889] Add signature validation --- azure-pipelines/Get-CodeCovTool.ps1 | 77 ++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 13 deletions(-) diff --git a/azure-pipelines/Get-CodeCovTool.ps1 b/azure-pipelines/Get-CodeCovTool.ps1 index 63b5d3f3..ca580b4d 100644 --- a/azure-pipelines/Get-CodeCovTool.ps1 +++ b/azure-pipelines/Get-CodeCovTool.ps1 @@ -1,35 +1,86 @@ <# .SYNOPSIS Downloads the CodeCov.io uploader tool and returns the path to it. +.PARAMETER AllowSkipVerify + Allows skipping signature verification of the downloaded tool if gpg is not installed. #> [CmdletBinding()] Param( + [switch]$AllowSkipVerify ) -$toolsPath = & "$PSScriptRoot\Get-TempToolsPath.ps1" -$binaryToolsPath = Join-Path $toolsPath codecov -if (!(Test-Path $binaryToolsPath)) { $null = mkdir $binaryToolsPath } - if ($IsMacOS) { - $codeCovPath = Join-Path $binaryToolsPath codecov $codeCovUrl = "https://uploader.codecov.io/latest/macos/codecov" + $toolName = 'codecov' } elseif ($IsLinux) { - $codeCovPath = Join-Path $binaryToolsPath codecov $codeCovUrl = "https://uploader.codecov.io/latest/linux/codecov" + $toolName = 'codecov' } else { - $codeCovPath = Join-Path $binaryToolsPath codecov.exe $codeCovUrl = "https://uploader.codecov.io/latest/windows/codecov.exe" + $toolName = 'codecov.exe' } -if (!(Test-Path $codeCovPath)) { - Write-Host "Downloading latest codecov upload tool..." -ForegroundColor Yellow - (New-Object System.Net.WebClient).DownloadFile($codeCovUrl, $codeCovPath) +$shaSuffix = ".SHA256SUM" +$sigSuffix = $shaSuffix + ".sig" + +Function Get-FileFromWeb([Uri]$Uri, $OutDir) { + $OutFile = Join-Path $OutDir $Uri.Segments[-1] + if (!(Test-Path $OutFile)) { + Write-Verbose "Downloading $Uri..." + if (!(Test-Path $OutDir)) { New-Item -ItemType Directory -Path $OutDir | Out-Null } + try { + (New-Object System.Net.WebClient).DownloadFile($Uri, $OutFile) + } finally { + # This try/finally causes the script to abort + } + } + + $OutFile } -if ($IsMacOS -or $IsLinux) { - chmod u+x $codeCovPath +$toolsPath = & "$PSScriptRoot\Get-TempToolsPath.ps1" +$binaryToolsPath = Join-Path $toolsPath codecov +$testingPath = Join-Path $binaryToolsPath unverified +$finalToolPath = Join-Path $binaryToolsPath $toolName + +if (!(Test-Path $finalToolPath)) { + if (Test-Path $testingPath) { + Remove-Item -Recurse -Force $testingPath # ensure we download all matching files + } + $tool = Get-FileFromWeb $codeCovUrl $testingPath + $sha = Get-FileFromWeb "$codeCovUrl$shaSuffix" $testingPath + $sig = Get-FileFromWeb "$codeCovUrl$sigSuffix" $testingPath + $key = Get-FileFromWeb https://keybase.io/codecovsecurity/pgp_keys.asc $testingPath + + if ((Get-Command gpg -ErrorAction SilentlyContinue)) { + Write-Host "Importing codecov key" -ForegroundColor Yellow + gpg --import $key + Write-Host "Verifying signature on codecov hash" -ForegroundColor Yellow + gpg --verify $sig $sha + } else { + if ($AllowSkipVerify) { + Write-Warning "gpg not found. Unable to verify hash signature." + } else { + throw "gpg not found. Unable to verify hash signature. Install gpg or add -AllowSkipVerify to override." + } + } + + Write-Host "Verifying hash on downloaded tool" -ForegroundColor Yellow + $actualHash = (Get-FileHash -Path $tool -Algorithm SHA256).Hash + $expectedHash = (Get-Content $sha).Split()[0] + if ($actualHash -ne $expectedHash) { + # Validation failed. Delete the tool so we can't execute it. + #Remove-Item $codeCovPath + throw "codecov uploader tool failed signature validation." + } + + Copy-Item $tool $finalToolPath + + if ($IsMacOS -or $IsLinux) { + chmod u+x $finalToolPath + } } -return (Resolve-Path $codeCovPath).Path +return $finalToolPath From d0b0b55b461068eb2b7cc3c5e440880cf5203b75 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 18 Jun 2022 17:57:28 -0600 Subject: [PATCH 454/889] Fix perf scaling issue in merging coverage reports --- azure-pipelines/Merge-CodeCoverage.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/Merge-CodeCoverage.ps1 b/azure-pipelines/Merge-CodeCoverage.ps1 index 6672b94c..91ab67ab 100644 --- a/azure-pipelines/Merge-CodeCoverage.ps1 +++ b/azure-pipelines/Merge-CodeCoverage.ps1 @@ -31,8 +31,12 @@ $reports = Get-ChildItem -Recurse $Path -Filter *.cobertura.xml if ($reports) { $reports |% { $_.FullName } |% { # In addition to replacing {reporoot}, we also normalize on one kind of slash so that the report aggregates data for a file whether data was collected on Windows or not. - $content = Get-Content -Path $_ |% { [Regex]::Replace($_, '{reporoot}([^"]+)', { $RepoRoot + $args[0].groups[1].value.replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar) }) } - Set-Content -Path $_ -Value $content -Encoding UTF8 + $xml = [xml](Get-Content -Path $_) + $xml.coverage.packages.package.classes.class |? { $_.filename} |% { + $_.filename = $_.filename.Replace('{reporoot}', $RepoRoot).Replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar) + } + + $xml.Save($_) } $Inputs = [string]::join(';', ($reports |% { Resolve-Path -relative $_.FullName })) From fa0ac399504747ba4f8b71bfab31a974698811a6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 20 Jun 2022 08:44:04 -0600 Subject: [PATCH 455/889] Log _pipelines scripts verbosely --- azure-pipelines/artifacts/_all.ps1 | 1 + azure-pipelines/artifacts/_pipelines.ps1 | 8 ++++++-- azure-pipelines/artifacts/_stage_all.ps1 | 10 +++++++--- azure-pipelines/artifacts/testResults.ps1 | 4 ++++ azure-pipelines/dotnet.yml | 2 +- azure-pipelines/variables/_all.ps1 | 11 +++++++++-- azure-pipelines/variables/_pipelines.ps1 | 15 +++++++++++---- 7 files changed, 39 insertions(+), 12 deletions(-) diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1 index c9182a45..033cc87c 100755 --- a/azure-pipelines/artifacts/_all.ps1 +++ b/azure-pipelines/artifacts/_all.ps1 @@ -15,6 +15,7 @@ Executes artifact scripts even if they have already been staged. #> +[CmdletBinding(SupportsShouldProcess = $true)] param ( [string]$ArtifactNameSuffix, [switch]$Force diff --git a/azure-pipelines/artifacts/_pipelines.ps1 b/azure-pipelines/artifacts/_pipelines.ps1 index a62d2675..2d3338b2 100644 --- a/azure-pipelines/artifacts/_pipelines.ps1 +++ b/azure-pipelines/artifacts/_pipelines.ps1 @@ -1,6 +1,10 @@ -# This script translates all the artifacts described by _all.ps1 -# into commands that instruct Azure Pipelines to actually collect those artifacts. +<# +.SYNOPSIS + This script translates all the artifacts described by _all.ps1 + into commands that instruct Azure Pipelines to actually collect those artifacts. +#> +[CmdletBinding()] param ( [string]$ArtifactNameSuffix, [switch]$StageOnly diff --git a/azure-pipelines/artifacts/_stage_all.ps1 b/azure-pipelines/artifacts/_stage_all.ps1 index b7166b4e..d81d16d4 100644 --- a/azure-pipelines/artifacts/_stage_all.ps1 +++ b/azure-pipelines/artifacts/_stage_all.ps1 @@ -1,6 +1,10 @@ -# This script links all the artifacts described by _all.ps1 -# into a staging directory, reading for uploading to a cloud build artifact store. -# It returns a sequence of objects with Name and Path properties. +<# +.SYNOPSIS + This script links all the artifacts described by _all.ps1 + into a staging directory, reading for uploading to a cloud build artifact store. + It returns a sequence of objects with Name and Path properties. +#> + [CmdletBinding()] param ( [string]$ArtifactNameSuffix diff --git a/azure-pipelines/artifacts/testResults.ps1 b/azure-pipelines/artifacts/testResults.ps1 index 2f894c97..4fa0fe62 100644 --- a/azure-pipelines/artifacts/testResults.ps1 +++ b/azure-pipelines/artifacts/testResults.ps1 @@ -1,3 +1,7 @@ +[CmdletBinding()] +Param( +) + $result = @{} if ($env:AGENT_TEMPDIRECTORY) { diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index a461c147..ca9fc9b8 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -11,7 +11,7 @@ steps: displayName: ⚙ Update pipeline variables based on build outputs condition: succeededOrFailed() -- powershell: azure-pipelines/artifacts/_pipelines.ps1 -ArtifactNameSuffix "-$(Agent.JobName)" +- powershell: azure-pipelines/artifacts/_pipelines.ps1 -ArtifactNameSuffix "-$(Agent.JobName)" -Verbose failOnStderr: true displayName: 📢 Publish artifacts condition: succeededOrFailed() diff --git a/azure-pipelines/variables/_all.ps1 b/azure-pipelines/variables/_all.ps1 index 0407d307..cc6e8810 100755 --- a/azure-pipelines/variables/_all.ps1 +++ b/azure-pipelines/variables/_all.ps1 @@ -1,7 +1,14 @@ #!/usr/bin/env pwsh -# This script returns a hashtable of build variables that should be set -# at the start of a build or release definition's execution. +<# +.SYNOPSIS + This script returns a hashtable of build variables that should be set + at the start of a build or release definition's execution. +#> + +[CmdletBinding(SupportsShouldProcess = $true)] +param ( +) $vars = @{} diff --git a/azure-pipelines/variables/_pipelines.ps1 b/azure-pipelines/variables/_pipelines.ps1 index 867b7fc8..951106d2 100644 --- a/azure-pipelines/variables/_pipelines.ps1 +++ b/azure-pipelines/variables/_pipelines.ps1 @@ -1,8 +1,15 @@ -# This script translates the variables returned by the _all.ps1 script -# into commands that instruct Azure Pipelines to actually set those variables for other pipeline tasks to consume. +<# +.SYNOPSIS + This script translates the variables returned by the _all.ps1 script + into commands that instruct Azure Pipelines to actually set those variables for other pipeline tasks to consume. -# The build or release definition may have set these variables to override -# what the build would do. So only set them if they have not already been set. + The build or release definition may have set these variables to override + what the build would do. So only set them if they have not already been set. +#> + +[CmdletBinding()] +param ( +) (& "$PSScriptRoot\_all.ps1").GetEnumerator() |% { # Always use ALL CAPS for env var names since Azure Pipelines converts variable names to all caps and on non-Windows OS, env vars are case sensitive. From cb730eacdd53e4ca06b7f9c74b06da74f44db3a9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 20 Jun 2022 08:46:30 -0600 Subject: [PATCH 456/889] Collect test results from the right directory The dump files used to be written to an agent TEMP directory. Somewhere along the lines they moved to the TestResults directory within the repo itself. Fixes AArnott/Library.Template#167 --- azure-pipelines/artifacts/testResults.ps1 | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/azure-pipelines/artifacts/testResults.ps1 b/azure-pipelines/artifacts/testResults.ps1 index 4fa0fe62..301a4376 100644 --- a/azure-pipelines/artifacts/testResults.ps1 +++ b/azure-pipelines/artifacts/testResults.ps1 @@ -4,17 +4,8 @@ Param( $result = @{} -if ($env:AGENT_TEMPDIRECTORY) { - # The DotNetCoreCLI uses an alternate location to publish these files - $guidRegex = '^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$' - $result[$env:AGENT_TEMPDIRECTORY] = (Get-ChildItem $env:AGENT_TEMPDIRECTORY -Directory |? { $_.Name -match $guidRegex } |% { - Get-ChildItem "$($_.FullName)\dotnet*.dmp","$($_.FullName)\*_crashdump.dmp","$($_.FullName)\testhost*.dmp","$($_.FullName)\Sequence_*.xml" -Recurse - }); -} -else { - $testRoot = Resolve-Path "$PSScriptRoot\..\..\test" - $result[$testRoot] = (Get-ChildItem "$testRoot\TestResults" -Recurse -Directory | Get-ChildItem -Recurse -File) -} +$testRoot = Resolve-Path "$PSScriptRoot\..\..\test" +$result[$testRoot] = (Get-ChildItem "$testRoot\TestResults" -Recurse -Directory | Get-ChildItem -Recurse -File) $testlogsPath = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\test_logs" if (Test-Path $testlogsPath) { From 540ea6a9b78c8c2a8e99ffb553ba523defaa7e81 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 20 Jun 2022 16:25:12 -0600 Subject: [PATCH 457/889] Prepare release notes with breaking changes --- azure-pipelines/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index 2679b24e..4c9db860 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -51,6 +51,7 @@ jobs: changeLogType: issueBased changeLogLabels: | [ + { "label" : "breaking change", "displayName" : "Breaking changes", "state" : "closed" }, { "label" : "bug", "displayName" : "Fixes", "state" : "closed" }, { "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" } ] From 2c7486f63461a1064a4b8454dc52a289377a73d9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 22 Jun 2022 19:34:34 -0600 Subject: [PATCH 458/889] Handle 4-integer package versions in InsertConfigValues.ps1 --- azure-pipelines/variables/InsertConfigValues.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/variables/InsertConfigValues.ps1 b/azure-pipelines/variables/InsertConfigValues.ps1 index efed018c..1ab53f34 100644 --- a/azure-pipelines/variables/InsertConfigValues.ps1 +++ b/azure-pipelines/variables/InsertConfigValues.ps1 @@ -3,7 +3,7 @@ $InsertedPkgs = (& "$PSScriptRoot\..\artifacts\VSInsertion.ps1" -SbomNotRequired $icv=@() foreach ($kvp in $InsertedPkgs.GetEnumerator()) { $kvp.Value |% { - if ($_.Name -match "^(.*)\.(\d+\.\d+\.\d+(?:-.*?)?)(?:\.symbols)?\.nupkg$") { + if ($_.Name -match "^(.*?)\.(\d+\.\d+\.\d+(?:\.\d+)?(?:-.*?)?)(?:\.symbols)?\.nupkg$") { $id = $Matches[1] $version = $Matches[2] $icv += "$id=$version" From c5683bea1c776521445818e010a656a96d58b873 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 21 Jul 2022 21:14:22 -0600 Subject: [PATCH 459/889] Fix symbol file collection when the dll or exe is missing --- azure-pipelines/Get-SymbolFiles.ps1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/Get-SymbolFiles.ps1 b/azure-pipelines/Get-SymbolFiles.ps1 index fccb1bb1..9183c340 100644 --- a/azure-pipelines/Get-SymbolFiles.ps1 +++ b/azure-pipelines/Get-SymbolFiles.ps1 @@ -49,8 +49,13 @@ $PDBs |% { $BinaryImagePath = $dllPath } elseif (Test-Path $exePath) { $BinaryImagePath = $exePath + } else { + Write-Warning "`"$_`" found with no matching binary file." + $BinaryImagePath = $null } - Write-Output $BinaryImagePath - Write-Output $_.FullName + if ($BinaryImagePath) { + Write-Output $BinaryImagePath + Write-Output $_.FullName + } } From 540833819f90b3dacf9753c7c2f3baee19e5094c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 21 Jul 2022 18:18:26 -0600 Subject: [PATCH 460/889] Fix publishing of legacy symbols where on binary image can be found --- azure-pipelines/Publish-Legacy-Symbols.ps1 | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/azure-pipelines/Publish-Legacy-Symbols.ps1 b/azure-pipelines/Publish-Legacy-Symbols.ps1 index 6ca7ddb6..5c4035a1 100644 --- a/azure-pipelines/Publish-Legacy-Symbols.ps1 +++ b/azure-pipelines/Publish-Legacy-Symbols.ps1 @@ -14,19 +14,24 @@ Get-ChildItem "$ArtifactStagingFolder\*.pdb" -Recurse |% { $BinaryImagePath = $dllPath } elseif (Test-Path $exePath) { $BinaryImagePath = $exePath + } else { + Write-Warning "`"$_`" found with no matching binary file." + $BinaryImagePath = $null } - # Convert the PDB to legacy Windows PDBs - Write-Host "Converting PDB for $_" -ForegroundColor DarkGray - $WindowsPdbDir = "$($_.Directory.FullName)\$WindowsPdbSubDirName" - if (!(Test-Path $WindowsPdbDir)) { mkdir $WindowsPdbDir | Out-Null } - $legacyPdbPath = "$WindowsPdbDir\$($_.BaseName).pdb" - & "$PSScriptRoot\Convert-PDB.ps1" -DllPath $BinaryImagePath -PdbPath $_ -OutputPath $legacyPdbPath - if ($LASTEXITCODE -ne 0) { - Write-Warning "PDB conversion of `"$_`" failed." - } + if ($BinaryImagePath) { + # Convert the PDB to legacy Windows PDBs + Write-Host "Converting PDB for $_" -ForegroundColor DarkGray + $WindowsPdbDir = "$($_.Directory.FullName)\$WindowsPdbSubDirName" + if (!(Test-Path $WindowsPdbDir)) { mkdir $WindowsPdbDir | Out-Null } + $legacyPdbPath = "$WindowsPdbDir\$($_.BaseName).pdb" + & "$PSScriptRoot\Convert-PDB.ps1" -DllPath $BinaryImagePath -PdbPath $_ -OutputPath $legacyPdbPath + if ($LASTEXITCODE -ne 0) { + Write-Warning "PDB conversion of `"$_`" failed." + } - Move-Item $legacyPdbPath $_ -Force + Move-Item $legacyPdbPath $_ -Force + } } Write-Host "##vso[artifact.upload containerfolder=symbols-legacy;artifactname=symbols-legacy;]$ArtifactStagingFolder" From b5f7042d435965c623a41856c911675c7ffb5ad1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 21 Jul 2022 18:23:12 -0600 Subject: [PATCH 461/889] Update SBOM support to use the new SBOM plugin Remove deprecated SBOM handling SBOM is now generated as part of the build (when it applies). --- azure-pipelines/Install-NuGetPackage.ps1 | 2 ++ azure-pipelines/artifacts/VSInsertion.ps1 | 11 ----------- azure-pipelines/build.yml | 5 ----- azure-pipelines/microbuild.after.yml | 9 --------- azure-pipelines/microbuild.before.yml | 3 +++ azure-pipelines/variables/InsertConfigValues.ps1 | 2 +- init.ps1 | 12 ++++++++++++ 7 files changed, 18 insertions(+), 26 deletions(-) diff --git a/azure-pipelines/Install-NuGetPackage.ps1 b/azure-pipelines/Install-NuGetPackage.ps1 index 0bf05710..13967233 100644 --- a/azure-pipelines/Install-NuGetPackage.ps1 +++ b/azure-pipelines/Install-NuGetPackage.ps1 @@ -45,6 +45,8 @@ try { $p = Start-Process $nugetPath $nugetArgs -NoNewWindow -Wait -PassThru if ($p.ExitCode -ne 0) { throw } } + + Write-Output (Get-ChildItem "$PackagesDir\$PackageId.*")[0].FullName } finally { Pop-Location } diff --git a/azure-pipelines/artifacts/VSInsertion.ps1 b/azure-pipelines/artifacts/VSInsertion.ps1 index 0d1cb373..ba6af320 100644 --- a/azure-pipelines/artifacts/VSInsertion.ps1 +++ b/azure-pipelines/artifacts/VSInsertion.ps1 @@ -1,12 +1,7 @@ # This artifact captures everything needed to insert into VS (NuGet packages, insertion metadata, etc.) -<# -.PARAMETER SbomNotRequired - Indicates that returning the artifacts available is preferable to nothing at all when the SBOM has not yet been generated. -#> [CmdletBinding()] Param ( - [switch]$SbomNotRequired ) if ($IsMacOS -or $IsLinux) { @@ -23,12 +18,6 @@ if (!$BuildConfiguration) { $PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration/NuGet" -# This artifact is not ready if we're running on the devdiv AzDO account and we don't have an SBOM yet. -if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9' -and -not (Test-Path $PackagesRoot/_manifest) -and -not $SbomNotRequired) { - Write-Host "Skipping because SBOM isn't generated yet." - return @{} -} - if (!(Test-Path $PackagesRoot)) { Write-Warning "Skipping because packages haven't been built yet." return @{} diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index a8c33859..f0e6c7e1 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -36,11 +36,6 @@ jobs: - template: microbuild.after.yml parameters: EnableAPIScan: ${{ parameters.EnableAPIScan }} - # Repeat this step to scoop up any artifacts that would only be collected after running microbuild.after.yml - - powershell: azure-pipelines/artifacts/_pipelines.ps1 -ArtifactNameSuffix "-$(Agent.JobName)" - failOnStderr: true - displayName: Publish artifacts - condition: succeededOrFailed() - template: expand-template.yml diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 87634808..6f107833 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -13,15 +13,6 @@ steps: condition: succeededOrFailed() displayName: MicroBuild Cleanup -- task: ManifestGeneratorTask@0 - displayName: Software Bill of Materials generation - inputs: - BuildDropPath: $(System.DefaultWorkingDirectory)/bin/Library/$(BuildConfiguration) - BuildComponentPath: $(System.DefaultWorkingDirectory)/obj/src/Library - -- powershell: Copy-Item -Recurse -Verbose "$(System.DefaultWorkingDirectory)/bin/Library/$(BuildConfiguration)/_manifest" "$(System.DefaultWorkingDirectory)/bin/Packages/$(BuildConfiguration)/NuGet" - displayName: Publish Software Bill of Materials - - task: Ref12Analyze@0 displayName: Ref12 (Codex) Analyze inputs: diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index ab930694..05efd4a9 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -12,3 +12,6 @@ steps: inputs: signType: $(SignType) displayName: Install MicroBuild Signing Plugin + +- task: MicroBuildSbomPlugin@1 + displayName: Install MicroBuild Sbom Plugin diff --git a/azure-pipelines/variables/InsertConfigValues.ps1 b/azure-pipelines/variables/InsertConfigValues.ps1 index 1ab53f34..3ae11de9 100644 --- a/azure-pipelines/variables/InsertConfigValues.ps1 +++ b/azure-pipelines/variables/InsertConfigValues.ps1 @@ -1,4 +1,4 @@ -$InsertedPkgs = (& "$PSScriptRoot\..\artifacts\VSInsertion.ps1" -SbomNotRequired) +$InsertedPkgs = (& "$PSScriptRoot\..\artifacts\VSInsertion.ps1") $icv=@() foreach ($kvp in $InsertedPkgs.GetEnumerator()) { diff --git a/init.ps1 b/init.ps1 index 0a7e1cbd..4a576ac2 100755 --- a/init.ps1 +++ b/init.ps1 @@ -39,6 +39,8 @@ Install the MicroBuild setup plugin for building VSIXv3 packages. .PARAMETER OptProf Install the MicroBuild OptProf plugin for building optimized assemblies on desktop machines. +.PARAMETER Sbom + Install the MicroBuild SBOM plugin. .PARAMETER AccessToken An optional access token for authenticating to Azure Artifacts authenticated feeds. #> @@ -63,6 +65,8 @@ Param ( [Parameter()] [switch]$OptProf, [Parameter()] + [switch]$SBOM, + [Parameter()] [string]$AccessToken ) @@ -130,6 +134,14 @@ try { $EnvVars['LocLanguages'] = "JPN" } + if ($SBOM) { + Write-Host "Installing MicroBuild SBOM plugin" -ForegroundColor $HeaderColor + & $InstallNuGetPkgScriptPath MicroBuild.Plugins.Sbom -source $MicroBuildPackageSource -Verbosity $nugetVerbosity + $PkgMicrosoft_ManifestTool_CrossPlatform = & $InstallNuGetPkgScriptPath Microsoft.ManifestTool.CrossPlatform -source 'https://1essharedassets.pkgs.visualstudio.com/1esPkgs/_packaging/SBOMTool/nuget/v3/index.json' -Verbosity $nugetVerbosity + $EnvVars['GenerateSBOM'] = "true" + $EnvVars['PkgMicrosoft_ManifestTool_CrossPlatform'] = $PkgMicrosoft_ManifestTool_CrossPlatform + } + & "$PSScriptRoot/tools/Set-EnvVars.ps1" -Variables $EnvVars -PrependPath $PrependPath | Out-Null } catch { From 7cc5a15009551f5951cb64916b29db85d438433b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 22 Jul 2022 16:57:52 -0600 Subject: [PATCH 462/889] Skip zipping sources when real signing --- azure-pipelines/microbuild.before.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index 05efd4a9..72fd72bb 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -11,6 +11,7 @@ steps: - task: MicroBuildSigningPlugin@3 inputs: signType: $(SignType) + zipSources: false displayName: Install MicroBuild Signing Plugin - task: MicroBuildSbomPlugin@1 From b7a52ae8ddfa47f86d10943528dfaafec91989b2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 25 Jul 2022 14:51:05 -0600 Subject: [PATCH 463/889] Update MicroBuild package version --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 8886338e..c55c85c8 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -31,7 +31,7 @@ true snupkg - 2.0.68 + 2.0.72 From 7d69d2a446ba4e3cec42c9787b3c18bf96d30a26 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 26 Jul 2022 17:44:03 -0600 Subject: [PATCH 464/889] Update MicroBuild version --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index c55c85c8..bc6ba5cd 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -31,7 +31,7 @@ true snupkg - 2.0.72 + 2.0.73 From 0bb373adc92cdaca099a82d4dcdb1d59c8f73ffe Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 27 Jul 2022 13:58:05 -0600 Subject: [PATCH 465/889] Fix WPF workaround This presumably broke when the intermediate directory was changed to include the relative path to the project directory. --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 22c1b94d..dcf31a29 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -75,7 +75,7 @@ It's also not necessary to generate these assets. --> - <_WpfTempProjectNuGetFilePathNoExt>$(RepoRootPath)obj\$(_TargetAssemblyProjectName)\$(_TargetAssemblyProjectName)$(MSBuildProjectExtension).nuget.g + <_WpfTempProjectNuGetFilePathNoExt>$(BaseIntermediateOutputPath)..\$(_TargetAssemblyProjectName)\$(_TargetAssemblyProjectName)$(MSBuildProjectExtension).nuget.g false false From 3ec6f43d2500784af5585714d411cbf33d9bd55c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:25:45 -0600 Subject: [PATCH 466/889] Bump Nullable from 1.3.0 to 1.3.1 (#172) Bumps [Nullable](https://github.com/manuelroemer/Nullable) from 1.3.0 to 1.3.1. - [Release notes](https://github.com/manuelroemer/Nullable/releases) - [Changelog](https://github.com/manuelroemer/Nullable/blob/master/CHANGELOG.md) - [Commits](https://github.com/manuelroemer/Nullable/commits) --- updated-dependencies: - dependency-name: Nullable dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index dcf31a29..c2b4b004 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -38,7 +38,7 @@ - + From 45948958aece65a9048c74443139f5ce5fed952d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Aug 2022 18:33:20 +0000 Subject: [PATCH 467/889] Bump Nerdbank.GitVersioning from 3.5.107 to 3.5.108 (#171) --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index c2b4b004..d13dbc48 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -37,7 +37,7 @@ - + From 396af02e150f71f9e1fdd942807a7332c698eca5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 2 Aug 2022 12:19:04 -0600 Subject: [PATCH 468/889] Give plenty of time for pipelines for real-signing --- azure-pipelines/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index f0e6c7e1..7ce7738a 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -11,6 +11,7 @@ parameters: jobs: - job: Windows pool: ${{ parameters.windowsPool }} + timeoutInMinutes: 180 # Give plenty of time due to real signing variables: - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: # https://dev.azure.com/devdiv/DevDiv/_wiki/wikis/DevDiv.wiki/25351/APIScan-step-by-step-guide-to-setting-up-a-Pipeline From 7fd07c23d49f61f69a0e50a50ef12dc9c9bedc5b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 2 Aug 2022 12:19:16 -0600 Subject: [PATCH 469/889] Skip APIScan on arm64 binaries --- azure-pipelines/secure-development-tools.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index c5ebf04e..3e1badc4 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -29,6 +29,7 @@ steps: # Exclude any patterns from the Contents (e.g. `!**/git2*`) that we have symbols for but do not need to run APIScan on. Contents: | ** + !**/arm64/** TargetFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs condition: and(succeeded(), ${{ parameters.EnableAPIScan }}, ne(variables.ApiScanClientId, '')) From b39494e5d1115a599f4ed01565bc5419a8dace36 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Aug 2022 09:16:02 -0600 Subject: [PATCH 470/889] Make running tests in a pipeline optional --- azure-pipelines.yml | 5 +++++ azure-pipelines/build.yml | 16 +++++++++++++--- azure-pipelines/dotnet.yml | 4 ++++ azure-pipelines/publish-codecoverage.yml | 2 +- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d98ed107..2cac17bd 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,6 +17,10 @@ parameters: displayName: Build on macOS type: boolean default: false # macOS is often bogged down in Azure Pipelines +- name: RunTests + displayName: Run tests + type: boolean + default: true variables: TreatWarningsAsErrors: true @@ -30,3 +34,4 @@ jobs: - template: azure-pipelines/build.yml parameters: includeMacOS: ${{ parameters.includeMacOS }} + RunTests: ${{ parameters.RunTests }} diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 5bfd95f5..cb489949 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -4,6 +4,9 @@ parameters: default: vmImage: windows-2022 - name: includeMacOS +- name: RunTests + type: boolean + default: true jobs: - job: Windows @@ -17,6 +20,8 @@ jobs: displayName: ⚙ Set build number - template: dotnet.yml + parameters: + RunTests: ${{ parameters.RunTests }} - template: expand-template.yml - job: Linux @@ -27,6 +32,8 @@ jobs: clean: true - template: install-dependencies.yml - template: dotnet.yml + parameters: + RunTests: ${{ parameters.RunTests }} - template: expand-template.yml - job: macOS @@ -38,6 +45,8 @@ jobs: clean: true - template: install-dependencies.yml - template: dotnet.yml + parameters: + RunTests: ${{ parameters.RunTests }} - template: expand-template.yml - job: WrapUp @@ -56,7 +65,8 @@ jobs: - template: publish-symbols.yml parameters: includeMacOS: ${{ parameters.includeMacOS }} - - template: publish-codecoverage.yml - parameters: - includeMacOS: ${{ parameters.includeMacOS }} + - ${{ if parameters.RunTests }}: + - template: publish-codecoverage.yml + parameters: + includeMacOS: ${{ parameters.includeMacOS }} - template: publish-deployables.yml diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index ca9fc9b8..055d44e9 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -1,3 +1,6 @@ +parameters: + RunTests: + steps: - script: dotnet build -t:build,pack --no-restore -c $(BuildConfiguration) /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" @@ -5,6 +8,7 @@ steps: - powershell: azure-pipelines/dotnet-test-cloud.ps1 -Configuration $(BuildConfiguration) -Agent $(Agent.JobName) -PublishResults displayName: 🧪 dotnet test + condition: and(succeeded(), ${{ parameters.RunTests }}) - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index 6e7ef21b..11de8ffa 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -14,7 +14,7 @@ steps: artifact: coverageResults-macOS displayName: 🔻 Download macOS code coverage results continueOnError: true - condition: ${{ parameters.includeMacOS }} + condition: and(succeeded(), ${{ parameters.includeMacOS }}) - powershell: azure-pipelines/Merge-CodeCoverage.ps1 -Path '$(Pipeline.Workspace)' -OutputDir coveragereport -Format Cobertura -Verbose displayName: ⚙ Merge coverage - task: PublishCodeCoverageResults@1 From 13d3a5635b19b6c4f7078059ebe042d3b38be9a3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Aug 2022 12:42:45 -0600 Subject: [PATCH 471/889] Detect more test assemblies --- azure-pipelines/Get-SymbolFiles.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/Get-SymbolFiles.ps1 b/azure-pipelines/Get-SymbolFiles.ps1 index 9183c340..0ce229fc 100644 --- a/azure-pipelines/Get-SymbolFiles.ps1 +++ b/azure-pipelines/Get-SymbolFiles.ps1 @@ -18,7 +18,7 @@ Write-Progress -Activity $ActivityName -CurrentOperation "Discovery PDB files" $PDBs = Get-ChildItem -rec "$Path/*.pdb" # Filter PDBs to product OR test related. -$testregex = "unittest|tests" +$testregex = "unittest|tests|\.test\." Write-Progress -Activity $ActivityName -CurrentOperation "De-duplicating symbols" $PDBsByHash = @{} From f68beb63687c66a3301f16bed97a791088281c22 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Aug 2022 15:09:03 -0600 Subject: [PATCH 472/889] More displayName icons --- azure-pipelines/microbuild.after.yml | 6 +++--- azure-pipelines/microbuild.before.yml | 8 ++++---- azure-pipelines/secure-development-tools.yml | 18 +++++++++--------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 6f107833..d6378b9f 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -4,17 +4,17 @@ parameters: steps: - task: MicroBuildCodesignVerify@3 - displayName: Verify Signed Files + displayName: 🔍 Verify Signed Files inputs: TargetFolders: | $(Build.SourcesDirectory)/bin/Packages/$(BuildConfiguration)/NuGet - task: MicroBuildCleanup@1 condition: succeededOrFailed() - displayName: MicroBuild Cleanup + displayName: ⚙️ MicroBuild Cleanup - task: Ref12Analyze@0 - displayName: Ref12 (Codex) Analyze + displayName: 📑 Ref12 (Codex) Analyze inputs: codexoutputroot: $(Build.ArtifactStagingDirectory)\Codex workflowArguments: | diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index 72fd72bb..a27cf36b 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -1,9 +1,9 @@ steps: - task: ComponentGovernanceComponentDetection@0 - displayName: Component Detection + displayName: 🔍 Component Detection - task: notice@0 - displayName: Generate NOTICE file + displayName: 🛠️ Generate NOTICE file inputs: outputfile: $(System.DefaultWorkingDirectory)/obj/NOTICE outputformat: text @@ -12,7 +12,7 @@ steps: inputs: signType: $(SignType) zipSources: false - displayName: Install MicroBuild Signing Plugin + displayName: 🔧 Install MicroBuild Signing Plugin - task: MicroBuildSbomPlugin@1 - displayName: Install MicroBuild Sbom Plugin + displayName: 🔧 Install MicroBuild Sbom Plugin diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index 3e1badc4..324bfe86 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -5,17 +5,17 @@ parameters: steps: - task: CredScan@3 - displayName: Run CredScan + displayName: 🔍 Run CredScan - task: PoliCheck@2 - displayName: Run PoliCheck + displayName: 🔍 Run PoliCheck inputs: targetType: F targetArgument: $(System.DefaultWorkingDirectory) optionsUEPATH: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml - task: BinSkim@4 - displayName: Run BinSkim + displayName: 🔍 Run BinSkim inputs: InputType: Basic Function: analyze @@ -23,7 +23,7 @@ steps: AnalyzeTargetGlob: $(BinSkimTargets) - task: CopyFiles@2 - displayName: Collect APIScan inputs + displayName: 🔍 Collect APIScan inputs inputs: SourceFolder: $(Build.ArtifactStagingDirectory)/Symbols-$(Agent.JobName) # Exclude any patterns from the Contents (e.g. `!**/git2*`) that we have symbols for but do not need to run APIScan on. @@ -34,7 +34,7 @@ steps: condition: and(succeeded(), ${{ parameters.EnableAPIScan }}, ne(variables.ApiScanClientId, '')) - task: APIScan@2 - displayName: Run APIScan + displayName: 🔍 Run APIScan inputs: softwareFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs softwareName: $(SymbolsFeatureName) @@ -46,12 +46,12 @@ steps: AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) - task: SdtReport@2 - displayName: Create Security Analysis Report + displayName: 🛠️ Create Security Analysis Report inputs: GdnExportAllTools: true - task: PublishSecurityAnalysisLogs@3 - displayName: Publish Code Analysis Logs + displayName: 📢 Publish Code Analysis Logs inputs: ArtifactName: CodeAnalysisLogs ArtifactType: Container @@ -60,7 +60,7 @@ steps: ToolLogsNotFoundAction: Standard - task: PostAnalysis@2 - displayName: Break on compliance issues + displayName: 🏋️‍♀️ Break on compliance issues inputs: GdnBreakAllTools: true GdnBreakGdnToolBinSkimSeverity: Warning @@ -72,5 +72,5 @@ steps: # This is useful when false positives appear so we can copy some of the output into the suppressions file. - publish: $(Build.ArtifactStagingDirectory)/guardian_failures_as_suppressions artifact: guardian_failures_as_suppressions - displayName: Publish Guardian failures + displayName: 🔍 Publish Guardian failures condition: failed() From 5ff626cb52ca4f05217a7392f317928c5b4deba6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Aug 2022 15:14:15 -0600 Subject: [PATCH 473/889] Add a queue-time parameter for skipping compliance tasks --- azure-pipelines/build.yml | 6 +++++- azure-pipelines/microbuild.after.yml | 11 ++++++----- azure-pipelines/official.yml | 7 ++++++- azure-pipelines/secure-development-tools.yml | 6 ++++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 271a3664..2face913 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -7,9 +7,12 @@ parameters: - name: RunTests type: boolean default: true +- name: EnableCompliance + type: boolean + default: true - name: EnableAPIScan type: boolean - default: false + default: true jobs: - job: Windows @@ -41,6 +44,7 @@ jobs: - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - template: microbuild.after.yml parameters: + EnableCompliance: ${{ parameters.EnableCompliance }} EnableAPIScan: ${{ parameters.EnableAPIScan }} - template: expand-template.yml diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index d6378b9f..4c3554ab 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -1,6 +1,6 @@ parameters: -- name: EnableAPIScan - type: boolean + EnableCompliance: + EnableAPIScan: steps: - task: MicroBuildCodesignVerify@3 @@ -26,6 +26,7 @@ steps: condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables['Build.Reason'], 'PullRequest')) continueOnError: true -- template: secure-development-tools.yml - parameters: - EnableAPIScan: ${{ parameters.EnableAPIScan }} +- ${{ if eq(parameters.EnableCompliance, 'true') }}: + - template: secure-development-tools.yml + parameters: + EnableAPIScan: ${{ parameters.EnableAPIScan }} diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 1cc141f5..743fecb2 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -33,8 +33,12 @@ parameters: displayName: Run tests type: boolean default: true +- name: EnableCompliance + displayName: Run Compliance Tools + type: boolean + default: true - name: EnableAPIScan - displayName: Run APIScan + displayName: Include APIScan with Compliance tools type: boolean default: true @@ -55,6 +59,7 @@ stages: jobs: - template: build.yml parameters: + EnableCompliance: ${{ parameters.EnableCompliance }} EnableAPIScan: ${{ parameters.EnableAPIScan }} windowsPool: VSEngSS-MicroBuild2022-1ES includeMacOS: ${{ parameters.includeMacOS }} diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index 324bfe86..cf5e2635 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -1,9 +1,11 @@ parameters: -- name: EnableAPIScan - type: boolean + EnableAPIScan: steps: +- powershell: echo "##vso[build.addbuildtag]compliance" + displayName: 🏷️ Tag run with 'compliance' + - task: CredScan@3 displayName: 🔍 Run CredScan From 4c03a7464f2d8512b75862e3a05e26db6f24f809 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 4 Aug 2022 15:47:23 -0600 Subject: [PATCH 474/889] Fix Expand-Template --- Expand-Template.ps1 | 3 --- 1 file changed, 3 deletions(-) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 5705e722..8d4c2f4b 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -155,9 +155,6 @@ try { $YmlReplacements['(codecov_token: ).*(#.*)'] = "#`$1`$2" } Replace-Placeholders -Path "azure-pipelines.yml" -Replacements $YmlReplacements - Replace-Placeholders -Path "azure-pipelines/microbuild.after.yml" -Replacements @{ - 'Library' = $LibraryName; - } Replace-Placeholders -Path "azure-pipelines/variables/InsertVersionsValues.ps1" -Replacements @{ 'LibraryName' = $LibraryName; From d69d108c08c1e70399920a54e06aa5cfc050dd47 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 5 Aug 2022 08:43:45 -0600 Subject: [PATCH 475/889] Hide the codecov publish task if it won't run Instead of showing it as a skipped task, just hide it if we won't run it because no codecov_token is provided. --- .github/workflows/build.yml | 2 +- azure-pipelines/dotnet.yml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cde83cd9..2c4ba94c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ env: TreatWarningsAsErrors: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BUILDCONFIGURATION: Release - codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ + # codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages/ jobs: diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 055d44e9..79babd4d 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -20,11 +20,11 @@ steps: displayName: 📢 Publish artifacts condition: succeededOrFailed() -- powershell: | - $ArtifactStagingFolder = & "azure-pipelines/Get-ArtifactsStagingDirectory.ps1" - $CoverageResultsFolder = Join-Path $ArtifactStagingFolder "coverageResults-$(Agent.JobName)" - azure-pipelines/publish-CodeCov.ps1 -CodeCovToken "$(codecov_token)" -PathToCodeCoverage "$CoverageResultsFolder" -Name "$(Agent.JobName) Coverage Results" -Flags "$(Agent.JobName)Host,$(BuildConfiguration)" - displayName: 📢 Publish code coverage results to codecov.io - condition: ne(variables['codecov_token'], '') - timeoutInMinutes: 3 - continueOnError: true +- ${{ if and(ne(variables['codecov_token'], ''), parameters.RunTests) }}: + - powershell: | + $ArtifactStagingFolder = & "azure-pipelines/Get-ArtifactsStagingDirectory.ps1" + $CoverageResultsFolder = Join-Path $ArtifactStagingFolder "coverageResults-$(Agent.JobName)" + azure-pipelines/publish-CodeCov.ps1 -CodeCovToken "$(codecov_token)" -PathToCodeCoverage "$CoverageResultsFolder" -Name "$(Agent.JobName) Coverage Results" -Flags "$(Agent.JobName)Host,$(BuildConfiguration)" + displayName: 📢 Publish code coverage results to codecov.io + timeoutInMinutes: 3 + continueOnError: true From 44062e8b68603f85ee53326bcd8eadbacfe2bd1d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 8 Aug 2022 16:52:57 -0600 Subject: [PATCH 476/889] Improve icon for task display name --- azure-pipelines/secure-development-tools.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index cf5e2635..ac540aea 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -48,7 +48,7 @@ steps: AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) - task: SdtReport@2 - displayName: 🛠️ Create Security Analysis Report + displayName: 📃 Create Security Analysis Report inputs: GdnExportAllTools: true From 68e3d617808b4558af4f940fe926e45c04715d0f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 22 Aug 2022 08:53:58 -0600 Subject: [PATCH 477/889] Add warning about squashing a Lib.Template update --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8cab6b7a..d3b5acf0 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,8 @@ We create the merge commit with these commands: 1. Run `git commit-tree -p HEAD -p A B -m "Merged latest Library.Template"`, where `A` is the output from `git rev-parse HEAD` that you recorded earlier, and `B` is the output from your prior `git write-tree` command. 1. Run `git merge X` where `X` is the output of the `git commit-tree` command. +**IMPORTANT**: If using a pull request to get your changes into your repo, you must *merge* your PR. If you *squash* your PR, history will be lost and you will have to repeatedly resolve the same merge conflicts at the next Library.Template update. + **CAUTION**: when merging this for the first time, a github-hosted repo may close issues in your repo with the same number as issues that this repo closed in git commit messages. Verify after completing your PR by visiting your github closed issues, sorted by recently updated, and reactivate any that were inadvertently closed by this merge. This shouldn't be a recurring issue because going forward, we will avoid referencing github issues with simple `#123` syntax in this repo's history. From 8c56d91a1d1967e520e21ce55c87255780b7a798 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Sep 2022 13:25:43 -0600 Subject: [PATCH 478/889] Bump Microsoft.NET.Test.Sdk from 17.2.0 to 17.3.1 (#175) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.2.0 to 17.3.1. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v17.2.0...v17.3.1) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 92062dc7..a707cebe 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,7 +10,7 @@ - + From 4dfc0ba9854c87eb8d310cfe337290c9c7bb5aeb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Sep 2022 13:25:57 -0600 Subject: [PATCH 479/889] Bump Nerdbank.GitVersioning from 3.5.108 to 3.5.109 (#174) Bumps [Nerdbank.GitVersioning](https://github.com/dotnet/Nerdbank.GitVersioning) from 3.5.108 to 3.5.109. - [Release notes](https://github.com/dotnet/Nerdbank.GitVersioning/releases) - [Commits](https://github.com/dotnet/Nerdbank.GitVersioning/compare/v3.5.108...v3.5.109) --- updated-dependencies: - dependency-name: Nerdbank.GitVersioning dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index d13dbc48..35f7d62a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -37,7 +37,7 @@ - + From 2bcf967f7d8f19620077021f61219938478635e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Sep 2022 13:26:07 -0600 Subject: [PATCH 480/889] Bump xunit from 2.4.1 to 2.4.2 (#173) Bumps [xunit](https://github.com/xunit/xunit) from 2.4.1 to 2.4.2. - [Release notes](https://github.com/xunit/xunit/releases) - [Commits](https://github.com/xunit/xunit/compare/2.4.1...2.4.2) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/Library.Tests/Library.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index a707cebe..2c1c3e8e 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -12,7 +12,7 @@ - + From 8b87c079ec2dcb6da4f38449ec6a366cbd02506c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 1 Sep 2022 20:56:12 -0600 Subject: [PATCH 481/889] Remove en-US from URL to docs --- SECURITY.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index f7b89984..c8ee6602 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,7 +4,7 @@ Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). -If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below. +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below. ## Reporting Security Issues @@ -14,7 +14,7 @@ Instead, please report them to the Microsoft Security Response Center (MSRC) at If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). -You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: @@ -38,4 +38,4 @@ We prefer all communications to be in English. Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd). - \ No newline at end of file + From e16106d6686cf153c57064d2d55b77a9484f29d6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 6 Sep 2022 13:38:06 -0600 Subject: [PATCH 482/889] Update doc links --- CONTRIBUTING.md | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 36424c42..e56631dd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,7 +25,7 @@ You should install the version specified in `global.json` or a later version wit the same major.minor.Bxx "hundreds" band. For example if 2.2.300 is specified, you may install 2.2.300, 2.2.301, or 2.2.310 while the 2.2.400 version would not be considered compatible by .NET SDK. -See [.NET Core Versioning](https://docs.microsoft.com/en-us/dotnet/core/versions/) for more information. +See [.NET Core Versioning](https://docs.microsoft.com/dotnet/core/versions/) for more information. ## Package restore @@ -39,4 +39,4 @@ This repository can be built on Windows, Linux, and OSX. Building, testing, and packing this repository can be done by using the standard dotnet CLI commands (e.g. `dotnet build`, `dotnet test`, `dotnet pack`, etc.). -[pwsh]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6 +[pwsh]: https://docs.microsoft.com/powershell/scripting/install/installing-powershell?view=powershell-6 diff --git a/README.md b/README.md index d3b5acf0..33ddbfab 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ * Follow the best and simplest patterns of build, pack and test with dotnet CLI. * Init script that installs prerequisites and auth helpers, supporting both non-elevation and elevation modes. -* Static analyzers: [FxCop](https://docs.microsoft.com/en-us/visualstudio/code-quality/fxcop-analyzers?view=vs-2019) and [StyleCop](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) +* Static analyzers: default [Code Analysis](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/overview) and [StyleCop](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) * Read-only source tree (builds to top-level bin/obj folders) * Auto-versioning (via [Nerdbank.GitVersioning](https://github.com/dotnet/nerdbank.gitversioning)) * Builds with a "pinned" .NET Core SDK to ensure reproducible builds across machines and across time. From 5d14d2cecbb3fd3caa6a421da1525d8480baef8b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 13 Sep 2022 09:47:18 -0600 Subject: [PATCH 483/889] Force non-shallow clones Fixes issue 176 --- azure-pipelines/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index cb489949..23b31221 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -13,6 +13,7 @@ jobs: pool: ${{ parameters.windowsPool }} steps: - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. clean: true - template: install-dependencies.yml @@ -29,6 +30,7 @@ jobs: vmImage: Ubuntu 20.04 steps: - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. clean: true - template: install-dependencies.yml - template: dotnet.yml @@ -42,6 +44,7 @@ jobs: vmImage: macOS-10.15 steps: - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. clean: true - template: install-dependencies.yml - template: dotnet.yml @@ -58,6 +61,7 @@ jobs: condition: succeededOrFailed() steps: - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. clean: true - template: install-dependencies.yml parameters: From 34f4c9f3058c9757647f61869bd7f226a32b7d14 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 13 Sep 2022 10:56:39 -0600 Subject: [PATCH 484/889] Switch to using dotnet-coverage Now that the merge bug has been fixed, this should provide a better report than `dotnet-reportgenerator-globaltool` because methods with `#if` blocks will now still be merged in the report instead of being listed multiple times. --- azure-pipelines/Merge-CodeCoverage.ps1 | 15 ++++++++++----- azure-pipelines/publish-codecoverage.yml | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/azure-pipelines/Merge-CodeCoverage.ps1 b/azure-pipelines/Merge-CodeCoverage.ps1 index 91ab67ab..9fe925cf 100644 --- a/azure-pipelines/Merge-CodeCoverage.ps1 +++ b/azure-pipelines/Merge-CodeCoverage.ps1 @@ -16,13 +16,13 @@ Param( [string[]]$Path, [ValidateSet('Badges', 'Clover', 'Cobertura', 'CsvSummary', 'Html', 'Html_Dark', 'Html_Light', 'HtmlChart', 'HtmlInline', 'HtmlInline_AzurePipelines', 'HtmlInline_AzurePipelines_Dark', 'HtmlInline_AzurePipelines_Light', 'HtmlSummary', 'JsonSummary', 'Latex', 'LatexSummary', 'lcov', 'MarkdownSummary', 'MHtml', 'PngChart', 'SonarQube', 'TeamCitySummary', 'TextSummary', 'Xml', 'XmlSummary')] [string]$Format='Cobertura', - [string]$OutputDir=("$PSScriptRoot/../coveragereport") + [string]$OutputFile=("$PSScriptRoot/../coveragereport/merged.cobertura.xml") ) $RepoRoot = [string](Resolve-Path $PSScriptRoot/..) -if (!(Test-Path $RepoRoot/obj/reportgenerator*)) { - dotnet tool install --tool-path $RepoRoot/obj dotnet-reportgenerator-globaltool --version 5.1.9 --configfile $PSScriptRoot/justnugetorg.nuget.config +if (!(Test-Path $RepoRoot/obj/dotnet-coverage*)) { + dotnet tool install --tool-path $RepoRoot/obj dotnet-coverage --version 17.4.3 --configfile $PSScriptRoot/justnugetorg.nuget.config } Write-Verbose "Searching $Path for *.cobertura.xml files" @@ -39,8 +39,13 @@ if ($reports) { $xml.Save($_) } - $Inputs = [string]::join(';', ($reports |% { Resolve-Path -relative $_.FullName })) - & "$RepoRoot/obj/reportgenerator" -reports:"$Inputs" -targetdir:$OutputDir -reporttypes:$Format + $Inputs = $reports |% { Resolve-Path -relative $_.FullName } + + if (Split-Path $OutputFile) { + New-Item -Type Directory -Path (Split-Path $OutputFile) | Out-Null + } + + & "$RepoRoot/obj/dotnet-coverage" merge $Inputs -o $OutputFile -f cobertura } else { Write-Error "No reports found to merge." } diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index 11de8ffa..fbb6a39a 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -15,11 +15,11 @@ steps: displayName: 🔻 Download macOS code coverage results continueOnError: true condition: and(succeeded(), ${{ parameters.includeMacOS }}) -- powershell: azure-pipelines/Merge-CodeCoverage.ps1 -Path '$(Pipeline.Workspace)' -OutputDir coveragereport -Format Cobertura -Verbose +- powershell: azure-pipelines/Merge-CodeCoverage.ps1 -Path '$(Pipeline.Workspace)' -OutputFile coveragereport/merged.cobertura.xml -Format Cobertura -Verbose displayName: ⚙ Merge coverage - task: PublishCodeCoverageResults@1 displayName: 📢 Publish code coverage results to Azure DevOps inputs: codeCoverageTool: cobertura - summaryFileLocation: coveragereport/Cobertura.xml + summaryFileLocation: coveragereport/merged.cobertura.xml failIfCoverageEmpty: true From 16f2a9a766f476d402fb4ba5ffa491b8f9df7661 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 14 Sep 2022 09:41:37 -0600 Subject: [PATCH 485/889] Update NuGetAuthenticate task version --- azure-pipelines/install-dependencies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 3993f104..81782668 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -3,7 +3,7 @@ parameters: steps: -- task: NuGetAuthenticate@0 +- task: NuGetAuthenticate@1 displayName: 🔏 Authenticate NuGet feeds inputs: forceReinstallCredentialProvider: true From eba59d62b9184b50c52db83ee54e5f0486e8c602 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 14 Sep 2022 09:41:37 -0600 Subject: [PATCH 486/889] Update NuGetAuthenticate task version --- azure-pipelines/official.yml | 2 +- azure-pipelines/vs-insertion.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 743fecb2..4be08885 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -113,7 +113,7 @@ stages: # inputs: # packageType: sdk # version: 6.x -# - task: NuGetAuthenticate@0 +# - task: NuGetAuthenticate@1 # displayName: Authenticate NuGet feeds # inputs: # nuGetServiceConnections: azure-public/vs-impl diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 3143de8a..7abb2e58 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -20,7 +20,7 @@ jobs: - checkout: none - powershell: Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" displayName: Set pipeline name - - task: NuGetAuthenticate@0 + - task: NuGetAuthenticate@1 displayName: Authenticate NuGet feeds inputs: forceReinstallCredentialProvider: true From 261a02c2532c51a55e891cccdb0b56ca25c38f6b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 14 Sep 2022 15:58:51 -0600 Subject: [PATCH 487/889] Document that we return the installed package path --- azure-pipelines/Install-NuGetPackage.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-pipelines/Install-NuGetPackage.ps1 b/azure-pipelines/Install-NuGetPackage.ps1 index 13967233..cdac7308 100644 --- a/azure-pipelines/Install-NuGetPackage.ps1 +++ b/azure-pipelines/Install-NuGetPackage.ps1 @@ -11,6 +11,8 @@ The directory to install the package to. By default, it uses the Packages folder at the root of the repo. .PARAMETER ConfigFile The nuget.config file to use. By default, it uses :/nuget.config. +.OUTPUTS + System.String. The path to the installed package. #> [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Low')] Param( @@ -46,6 +48,7 @@ try { if ($p.ExitCode -ne 0) { throw } } + # Provide the path to the installed package directory to our caller. Write-Output (Get-ChildItem "$PackagesDir\$PackageId.*")[0].FullName } finally { Pop-Location From a16659aacf3bff43aa5e36baba259e9ba0a5b5f7 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 14 Sep 2022 10:23:42 -0600 Subject: [PATCH 488/889] Install .NET SDK before authenticating nuget This may be important because how can NuGetAuthenticate decide to authenticate the `dotnet nuget` commands if `dotnet` isn't already there. --- azure-pipelines/vs-insertion.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 7abb2e58..112dd92f 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -20,15 +20,15 @@ jobs: - checkout: none - powershell: Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" displayName: Set pipeline name - - task: NuGetAuthenticate@1 - displayName: Authenticate NuGet feeds - inputs: - forceReinstallCredentialProvider: true - task: UseDotNet@2 displayName: Install .NET SDK inputs: packageType: sdk version: 6.x + - task: NuGetAuthenticate@1 + displayName: Authenticate NuGet feeds + inputs: + forceReinstallCredentialProvider: true - template: release-deployment-prep.yml - download: CI artifact: VSInsertion-Windows From c47c4b17546353648319dbf669b788d232d93bdf Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 14 Sep 2022 10:24:05 -0600 Subject: [PATCH 489/889] Split out the symbol archive and package push stages into a shareable yml file --- azure-pipelines/official.yml | 56 +------------------- azure-pipelines/prepare-insertion-stages.yml | 56 ++++++++++++++++++++ 2 files changed, 57 insertions(+), 55 deletions(-) create mode 100644 azure-pipelines/prepare-insertion-stages.yml diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 4be08885..0a398070 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -65,58 +65,4 @@ stages: includeMacOS: ${{ parameters.includeMacOS }} RunTests: ${{ parameters.RunTests }} -- stage: symbol_archive - displayName: Symbol archival - condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) - jobs: - - job: archive - pool: VSEng-ReleasePool-1ES - steps: - - checkout: none - - download: current - artifact: Variables-Windows - displayName: Download Variables-Windows artifact - - task: PowerShell@2 - displayName: Set VSTS variables based on artifacts - inputs: - targetType: filePath - filePath: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 - - download: current - artifact: symbols-legacy - displayName: Download symbols-legacy artifact - - task: MicroBuildArchiveSymbols@1 - displayName: Archive symbols to Symweb - inputs: - SymbolsFeatureName: $(SymbolsFeatureName) - SymbolsSymwebProject: VS - SymbolsUncPath: \\cpvsbuild\drops\$(TeamName)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildId)\Symbols.Archival - SymbolsEmailContacts: vsidemicrobuild - SymbolsAgentPath: $(Pipeline.Workspace)/symbols-legacy - - task: MicroBuildCleanup@1 - displayName: Send Telemetry - -# - stage: azure_public_vsimpl_feed -# displayName: azure-public/vs-impl feed -# condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) -# jobs: -# - job: push -# pool: -# name: AzurePipelines-EO -# vmImage: AzurePipelinesUbuntu20.04compliant -# steps: -# - checkout: none -# - download: current -# artifact: deployables-Windows -# displayName: Download deployables-Windows artifact -# - task: UseDotNet@2 -# displayName: Install .NET SDK -# inputs: -# packageType: sdk -# version: 6.x -# - task: NuGetAuthenticate@1 -# displayName: Authenticate NuGet feeds -# inputs: -# nuGetServiceConnections: azure-public/vs-impl -# forceReinstallCredentialProvider: true -# - script: dotnet nuget push $(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg -s https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json --api-key azdo --skip-duplicate -# displayName: Push nuget packages +- template: prepare-insertion-stages.yml diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml new file mode 100644 index 00000000..5d9da076 --- /dev/null +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -0,0 +1,56 @@ +stages: +- stage: symbol_archive + displayName: Symbol archival + condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) + jobs: + - job: archive + pool: VSEng-ReleasePool-1ES + steps: + - checkout: none + - download: current + artifact: Variables-Windows + displayName: Download Variables-Windows artifact + - task: PowerShell@2 + displayName: Set VSTS variables based on artifacts + inputs: + targetType: filePath + filePath: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 + - download: current + artifact: symbols-legacy + displayName: Download symbols-legacy artifact + - task: MicroBuildArchiveSymbols@1 + displayName: Archive symbols to Symweb + inputs: + SymbolsFeatureName: $(SymbolsFeatureName) + SymbolsSymwebProject: VS + SymbolsUncPath: \\cpvsbuild\drops\$(TeamName)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildId)\Symbols.Archival + SymbolsEmailContacts: vsidemicrobuild + SymbolsAgentPath: $(Pipeline.Workspace)/symbols-legacy + - task: MicroBuildCleanup@1 + displayName: Send Telemetry + +# - stage: azure_public_vsimpl_feed +# displayName: azure-public/vs-impl feed +# condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) +# jobs: +# - job: push +# pool: +# name: AzurePipelines-EO +# vmImage: AzurePipelinesUbuntu20.04compliant +# steps: +# - checkout: none +# - download: current +# artifact: deployables-Windows +# displayName: Download deployables-Windows artifact +# - task: UseDotNet@2 +# displayName: Install .NET SDK +# inputs: +# packageType: sdk +# version: 6.x +# - task: NuGetAuthenticate@1 +# displayName: Authenticate NuGet feeds +# inputs: +# nuGetServiceConnections: azure-public/vs-impl +# forceReinstallCredentialProvider: true +# - script: dotnet nuget push $(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg -s https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json --api-key azdo --skip-duplicate +# displayName: Push nuget packages From 10fcdb40dc799a4c8b061043237d3261e7eadd4d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 14 Sep 2022 10:25:23 -0600 Subject: [PATCH 490/889] Add validation pipeline (targeted as a PR policy) --- azure-pipelines/Get-InsertionPRId.ps1 | 26 ++++++ azure-pipelines/PostPRMessage.ps1 | 57 ++++++++++++++ azure-pipelines/prepare-insertion-stages.yml | 2 +- azure-pipelines/vs-validation.yml | 83 ++++++++++++++++++++ 4 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 azure-pipelines/Get-InsertionPRId.ps1 create mode 100644 azure-pipelines/PostPRMessage.ps1 create mode 100644 azure-pipelines/vs-validation.yml diff --git a/azure-pipelines/Get-InsertionPRId.ps1 b/azure-pipelines/Get-InsertionPRId.ps1 new file mode 100644 index 00000000..62cb30cd --- /dev/null +++ b/azure-pipelines/Get-InsertionPRId.ps1 @@ -0,0 +1,26 @@ +<# +.SYNOPSIS + Look up the pull request URL of the insertion PR. +#> +$stagingFolder = $env:BUILD_STAGINGDIRECTORY +if (!$stagingFolder) { + $stagingFolder = $env:SYSTEM_DEFAULTWORKINGDIRECTORY + if (!$stagingFolder) { + Write-Error "This script must be run in an Azure Pipeline." + exit 1 + } +} +$markdownFolder = Join-Path $stagingFolder (Join-Path 'MicroBuild' 'Output') +$markdownFile = Join-Path $markdownFolder 'PullRequestUrl.md' +if (!(Test-Path $markdownFile)) { + Write-Error "This script should be run after the MicroBuildInsertVsPayload task." + exit 2 +} + +$insertionPRUrl = Get-Content $markdownFile +if (!($insertionPRUrl -match 'https:.+?/pullrequest/(\d+)')) { + Write-Error "Failed to parse pull request URL: $insertionPRUrl" + exit 3 +} + +$Matches[1] diff --git a/azure-pipelines/PostPRMessage.ps1 b/azure-pipelines/PostPRMessage.ps1 new file mode 100644 index 00000000..4a2b7886 --- /dev/null +++ b/azure-pipelines/PostPRMessage.ps1 @@ -0,0 +1,57 @@ +[CmdletBinding(SupportsShouldProcess = $true)] +param( + [Parameter(Mandatory=$true)] + $AccessToken, + [Parameter(Mandatory=$true)] + $Markdown, + [ValidateSet('Active','ByDesign','Closed','Fixed','Pending','Unknown','WontFix')] + $CommentState='Active' +) + +# See https://docs.microsoft.com/en-us/dotnet/api/microsoft.teamfoundation.sourcecontrol.webapi.commentthreadstatus?view=azure-devops-dotnet +if ($CommentState -eq 'Active') { + $StatusCode = 1 +} elseif ($CommentState -eq 'ByDesign') { + $StatusCode = 5 +} elseif ($CommentState -eq 'Closed') { + $StatusCode = 4 +} elseif ($CommentState -eq 'Fixed') { + $StatusCode = 2 +} elseif ($CommentState -eq 'Pending') { + $StatusCode = 6 +} elseif ($CommentState -eq 'Unknown') { + $StatusCode = 0 +} elseif ($CommentState -eq 'WontFix') { + $StatusCode = 3 +} + +# Build the JSON body up +$body = ConvertTo-Json @{ + comments = @(@{ + parentCommentId = 0 + content = $Markdown + commentType = 1 + }) + status = $StatusCode +} + +Write-Verbose "Posting JSON payload: `n$Body" + +# Post the message to the Pull Request +# https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20request%20threads?view=azure-devops-rest-5.1 +$url = "$($env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI)$env:SYSTEM_TEAMPROJECTID/_apis/git/repositories/$($env:BUILD_REPOSITORY_NAME)/pullRequests/$($env:SYSTEM_PULLREQUEST_PULLREQUESTID)/threads?api-version=5.1" +if ($PSCmdlet.ShouldProcess($url, 'Post comment via REST call')) { + try { + if (!$env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI) { + Write-Error "Posting to the pull request requires that the script is running in an Azure Pipelines context." + exit 1 + } + Write-Host "Posting PR comment to: $url" + Invoke-RestMethod -Uri $url -Method POST -Headers @{Authorization = "Bearer $AccessToken"} -Body $Body -ContentType application/json + } + catch { + Write-Error $_ + Write-Error $_.Exception.Message + exit 2 + } +} diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index 5d9da076..a707454c 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -11,7 +11,7 @@ stages: artifact: Variables-Windows displayName: Download Variables-Windows artifact - task: PowerShell@2 - displayName: Set VSTS variables based on artifacts + displayName: Set pipeline variables based on artifacts inputs: targetType: filePath filePath: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml new file mode 100644 index 00000000..60860031 --- /dev/null +++ b/azure-pipelines/vs-validation.yml @@ -0,0 +1,83 @@ +# This is a top-level pipeline file, which is designed to be added as an optional PR build policy +# so that a VS insertion and all the validation that entails can be done before ever merging the PR +# in its original repo. + +trigger: none # We only want to trigger manually or based on resources +pr: none + +stages: +- stage: Build + variables: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages + SignTypeSelection: Real + BuildConfiguration: Release + ValidationBuild: true + + jobs: + - template: build.yml + parameters: + EnableCompliance: false + EnableAPIScan: false + windowsPool: VSEngSS-MicroBuild2022-1ES + includeMacOS: false + RunTests: false + +- template: prepare-insertion-stages.yml + +- stage: insertion + displayName: VS insertion + jobs: + - job: insertion + displayName: VS insertion + pool: VSEngSS-MicroBuild2022-1ES + steps: + - checkout: self + clean: true + fetchDepth: 1 + - task: UseDotNet@2 + displayName: Install .NET SDK + inputs: + packageType: sdk + version: 6.x + - task: NuGetAuthenticate@1 + displayName: Authenticate NuGet feeds + inputs: + forceReinstallCredentialProvider: true + - download: current + artifact: Variables-Windows + displayName: Download Variables-Windows artifact + - task: PowerShell@2 + displayName: Set pipeline variables based on artifacts + inputs: + targetType: filePath + filePath: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 + - download: current + artifact: VSInsertion-Windows + displayName: Download VSInsertion-Windows artifact + - script: dotnet nuget push VSInsertion-windows\*.nupkg -s https://pkgs.dev.azure.com/devdiv/_packaging/VS/nuget/v3/index.json -k azdo --skip-duplicate + displayName: Push CoreXT packages to VS feed + workingDirectory: $(Pipeline.Workspace) + - task: MicroBuildInsertVsPayload@4 + displayName: Insert VS Payload + inputs: + TeamName: $(TeamName) + TeamEmail: $(TeamEmail) + InsertionPayloadName: $(Build.Repository.Name) VALIDATION BUILD $(Build.BuildNumber) ($(Build.SourceBranch)) + InsertionDescription: | + This PR is for **validation purposes only** for !$(System.PullRequest.PullRequestId). **Do not complete**. Expect the Required 'Public VS SDK test' to fail because validation builds do not push binaries to the Azure Artifact feeds on `azure-public`. + CustomScriptExecutionCommand: src/VSSDK/NuGet/AllowUnstablePackages.ps1 + InsertionBuildPolicy: Request Perf DDRITs + AutoCompletePR: false + - powershell: | + $insertionPRId = azure-pipelines/Get-InsertionPRId.ps1 + $Markdown = @" + Validation insertion pull request created: !$insertionPRId + Please check status there before proceeding to merge this PR. + Remember to Abandon and Delete Source Branch on that insertion PR when validation is complete. + "@ + azure-pipelines/PostPRMessage.ps1 -AccessToken '$(System.AccessToken)' -Markdown $Markdown -Verbose + displayName: Comment on pull request + condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) + - task: MicroBuildCleanup@1 + displayName: Send Telemetry From d0f9808cfafbfb85908fd7c58567565145a7fe2e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 15 Sep 2022 17:43:05 -0600 Subject: [PATCH 491/889] Update docs in validation PRs --- azure-pipelines/vs-validation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index 60860031..f021ca51 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -65,7 +65,7 @@ stages: TeamEmail: $(TeamEmail) InsertionPayloadName: $(Build.Repository.Name) VALIDATION BUILD $(Build.BuildNumber) ($(Build.SourceBranch)) InsertionDescription: | - This PR is for **validation purposes only** for !$(System.PullRequest.PullRequestId). **Do not complete**. Expect the Required 'Public VS SDK test' to fail because validation builds do not push binaries to the Azure Artifact feeds on `azure-public`. + This PR is for **validation purposes only** for !$(System.PullRequest.PullRequestId). **Do not complete**. CustomScriptExecutionCommand: src/VSSDK/NuGet/AllowUnstablePackages.ps1 InsertionBuildPolicy: Request Perf DDRITs AutoCompletePR: false @@ -74,7 +74,7 @@ stages: $Markdown = @" Validation insertion pull request created: !$insertionPRId Please check status there before proceeding to merge this PR. - Remember to Abandon and Delete Source Branch on that insertion PR when validation is complete. + Remember to Abandon and (if allowed) to Delete Source Branch on that insertion PR when validation is complete. "@ azure-pipelines/PostPRMessage.ps1 -AccessToken '$(System.AccessToken)' -Markdown $Markdown -Verbose displayName: Comment on pull request From 990e1fddf79ead1ffdb27e79ea6f9a4c5973ee42 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 16 Sep 2022 19:50:02 -0600 Subject: [PATCH 492/889] Add reasonable default person as a reviewer on insertion PRs --- azure-pipelines/variables/InsertReviewers.ps1 | 12 ++++++++++++ azure-pipelines/vs-validation.yml | 1 + 2 files changed, 13 insertions(+) create mode 100644 azure-pipelines/variables/InsertReviewers.ps1 diff --git a/azure-pipelines/variables/InsertReviewers.ps1 b/azure-pipelines/variables/InsertReviewers.ps1 new file mode 100644 index 00000000..6fd6648b --- /dev/null +++ b/azure-pipelines/variables/InsertReviewers.ps1 @@ -0,0 +1,12 @@ +# This is a list of AzDO account names or email addresses. +# Add your team DL and/or whoever should be notified of insertion PRs. +$contacts = ,$env:BUILD_REQUESTEDFOREMAIL + +if (Test-Path "$PSScriptRoot\TeamEmail.ps1") { + $contacts += & "$PSScriptRoot\TeamEmail.ps1" +} + +$contacts = $contacts |? { $_ } +if ($contacts) { + [string]::Join(',', $contacts) +} diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index f021ca51..3cbc196e 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -68,6 +68,7 @@ stages: This PR is for **validation purposes only** for !$(System.PullRequest.PullRequestId). **Do not complete**. CustomScriptExecutionCommand: src/VSSDK/NuGet/AllowUnstablePackages.ps1 InsertionBuildPolicy: Request Perf DDRITs + InsertionReviewers: $(Build.RequestedForEmail) AutoCompletePR: false - powershell: | $insertionPRId = azure-pipelines/Get-InsertionPRId.ps1 From 6f6af479ce91e97c641e777df3c9d2eec41b9f58 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 16 Sep 2022 20:37:29 -0600 Subject: [PATCH 493/889] Add source code archival pipeline --- README.md | 1 + azure-pipelines/Archive-SourceCode.ps1 | 220 ++++++++++++++++++ azure-pipelines/archive-sourcecode.yml | 50 ++++ azure-pipelines/build.yml | 2 +- azure-pipelines/release.yml | 2 +- .../variables/BusinessGroupName.ps1 | 1 + 6 files changed, 274 insertions(+), 2 deletions(-) create mode 100644 azure-pipelines/Archive-SourceCode.ps1 create mode 100644 azure-pipelines/archive-sourcecode.yml create mode 100644 azure-pipelines/variables/BusinessGroupName.ps1 diff --git a/README.md b/README.md index 24a5c160..12c5c49c 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Further customize your repo by: 1. Verify the license is suitable for your goal as it appears in the LICENSE and stylecop.json files and the Directory.Build.props file's `PackageLicenseExpression` property. 1. Reset or replace the badges at the top of this file. +1. Check and maybe change any variable groups referenced in the .yml files. Search for `- group:` to find them. ### Maintaining your repo based on this template diff --git a/azure-pipelines/Archive-SourceCode.ps1 b/azure-pipelines/Archive-SourceCode.ps1 new file mode 100644 index 00000000..441bc1cf --- /dev/null +++ b/azure-pipelines/Archive-SourceCode.ps1 @@ -0,0 +1,220 @@ +#Requires -PSEdition Core -Version 7 +<# +.SYNOPSIS + Submits a source archival request for this repo. +.PARAMETER Requester + The alias for the user requesting this backup. +.PARAMETER ManagerAlias + The alias of the manager that owns the repo. +.PARAMETER TeamAlias + The alias of the team that owns the repo. +.PARAMETER BusinessGroupName + A human-readable title for your team or business group. +.PARAMETER ProductionType +.PARAMETER ReleaseType + The type of release being backed up. +.PARAMETER ReleaseDate + The date of the release of your software. Defaults to today. +.PARAMETER OwnerAlias + The alias of the owner. +.PARAMETER OS +.PARAMETER ProductLanguage + One or more languages. +.PARAMETER Notes + Any notes to record with the backup. +.PARAMETER FileCollection + One or more collections to archive. +.PARAMETER ProductName + The name of the product. This will default to the repository name. +.PARAMETER RepoUrl + The URL to the repository. This will default to the repository containing this script. +.PARAMETER BackupType + The kind of backup to be performed. +.PARAMETER ServerPath + The UNC path to the server to be backed up (if applicable). +.PARAMETER SourceCodeArchivalUri + The URI to POST the source code archival request to. + This value will typically come automatically by a variable group associated with your pipeline. + You can also look it up at https://dpsrequestforms.azurewebsites.net/#/help -> SCA Request Help -> SCA API Help -> Description +#> +[CmdletBinding(SupportsShouldProcess = $true, PositionalBinding = $false)] +param ( + [Parameter()] + [string]$Requester, + [Parameter(Mandatory = $true)] + [string]$ManagerAlias, + [Parameter(Mandatory = $true)] + [string]$TeamAlias, + [Parameter(Mandatory = $true)] + [string]$BusinessGroupName, + [Parameter()] + [string]$ProductionType = 'Visual Studio', + [Parameter()] + [string]$ReleaseType = 'RTW', + [Parameter()] + [DateTime]$ReleaseDate = [DateTime]::Today, + [Parameter()] + [string]$OwnerAlias, + [Parameter()] + [ValidateSet('64-Bit Win', '32-Bit Win', 'Linux', 'Mac', '64-Bit ARM', '32-Bit ARM')] + [string[]]$OS = @('64-Bit Win'), + [Parameter(Mandatory = $true)] + [ValidateSet('English', 'Chinese Simplified', 'Chinese Traditional', 'Czech', 'French', 'German', 'Italian', 'Japanese', 'Korean', 'Polish', 'Portuguese', 'Russian', 'Spanish', 'Turkish')] + [string[]]$ProductLanguage, + [Parameter()] + [string]$Notes = '', + [Parameter()] + [ValidateSet('Binaries', 'Localization', 'Source Code')] + [string[]]$FileCollection = @('Source Code'), + [Parameter()] + [string]$ProductName, + [Parameter()] + [Uri]$RepoUrl, + [Parameter()] + [ValidateSet('Server Path', 'Code Repo(Git URL/AzureDevOps)', 'Git', 'Azure Storage Account')] + [string]$BackupType = 'Code Repo(Git URL/AzureDevOps)', + [Parameter()] + [string]$ServerPath = '', + [Parameter()] + [Uri]$SourceCodeArchivalUri = $env:SOURCECODEARCHIVALURI +) + +function Invoke-Git() { + # Make sure we invoke git from within the repo. + Push-Location $PSScriptRoot + try { + return (git $args) + } + finally { + Pop-Location + } +} + +if (!$ProductName) { + if ($env:BUILD_REPOSITORY_NAME) { + Write-Verbose 'Using $env:BUILD_REPOSITORY_NAME for ProductName.' # single quotes are intentional so user sees the name of env var. + $ProductName = $env:BUILD_REPOSITORY_NAME + } + else { + $originUrl = [Uri](Invoke-Git remote get-url origin) + if ($originUrl) { + $lastPathSegment = $originUrl.Segments[$originUrl.Segments.Length - 1] + if ($lastPathSegment.EndsWith('.git')) { + $lastPathSegment = $lastPathSegment.Substring(0, $lastPathSegment.Length - '.git'.Length) + } + Write-Verbose 'Using origin remote URL to derive ProductName.' + $ProductName = $lastPathSegment + } + } + + if (!$ProductName) { + Write-Error "Unable to determine default value for -ProductName." + } +} + +if (!$OwnerAlias) { + if ($env:BUILD_REQUESTEDFOREMAIL) { + Write-Verbose 'Using $env:BUILD_REQUESTEDFOREMAIL and slicing to just the alias for OwnerAlias.' + $OwnerAlias = ($env:BUILD_REQUESTEDFOREMAIL -split '@')[0] + } + else { + Write-Verbose 'Using $env:USERNAME for OwnerAlias.' + $OwnerAlias = $env:USERNAME + } + if (!$OwnerAlias) { + Write-Error "Unable to determine default value for -OwnerAlias." + } +} + +if (!$Requester) { + if ($env:BUILD_REQUESTEDFOREMAIL) { + Write-Verbose 'Using $env:BUILD_REQUESTEDFOREMAIL and slicing to just the alias for Requester.' + $Requester = ($env:BUILD_REQUESTEDFOREMAIL -split '@')[0] + } + else { + Write-Verbose 'Using $env:USERNAME for Requester.' + $Requester = $env:USERNAME + } + if (!$Requester) { + Write-Error "Unable to determine default value for -Requester." + } +} + +if (!$RepoUrl) { + $RepoUrl = $env:BUILD_REPOSITORY_URI + if (!$RepoUrl) { + $originUrl = [Uri](Invoke-Git remote get-url origin) + if ($originUrl) { + Write-Verbose 'Using git origin remote url for GitURL.' + $RepoUrl = $originUrl + } + + if (!$RepoUrl) { + Write-Error "Unable to determine default value for -RepoUrl." + } + } +} + +Push-Location $PSScriptRoot +$versionsObj = & (& "$PSScriptRoot/Get-nbgv.ps1") get-version -f json | ConvertFrom-Json +Pop-Location + +$ReleaseDateString = $ReleaseDate.ToShortDateString() +$Version = $versionsObj.Version + +$BackupSize = Get-ChildItem $PSScriptRoot\..\.git -Recurse -File | Measure-Object -Property Length -Sum +$DataSizeMB = [int]($BackupSize.Sum / 1mb) +$FileCount = $BackupSize.Count + +$Request = @{ + "Requester" = $Requester + "Manager" = $ManagerAlias + "TeamAlias" = $TeamAlias + "AdditionalContacts" = $AdditionalContacts + "BusinessGroupName" = $BusinessGroupName + "ProductName" = $ProductName + "Version" = $Version + "ProductionType" = $ProductionType + "ReleaseType" = $ReleaseType + "ReleaseDateString" = $ReleaseDateString + "OS" = [string]::Join(',', $OS) + "ProductLanguage" = [string]::Join(',', $ProductLanguage) + "FileCollection" = [string]::Join(',', $FileCollection) + "OwnerAlias" = $OwnerAlias + "Notes" = $Notes + "CustomerProvidedDataSizeMB" = $DataSizeMB + "CustomerProvidedFileCount" = $FileCount + "BackupType" = $BackupType + "ServerPath" = $ServerPath + "AzureStorageAccount" = $AzureStorageAccount + "AzureStorageContainer" = $AzureStorageContainer + "GitURL" = $RepoUrl +} + +$RequestJson = ConvertTo-Json $Request +Write-Host "SCA request:`n$RequestJson" + +if ($PSCmdlet.ShouldProcess('source archival request', 'post')) { + if (!$SourceCodeArchivalUri) { + Write-Error "Unable to post request without -SourceCodeArchivalUri parameter." + exit 1 + } + + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + + $Response = Invoke-WebRequest -Uri $SourceCodeArchivalUri -Method POST -Body $RequestJson -ContentType "application/json" -UseBasicParsing -SkipHttpErrorCheck + Write-Host "Status Code : " -NoNewline + $responseContent = ConvertFrom-Json ($Response.Content) + if ($Response.StatusCode -eq 200) { + Write-Host $Response.StatusCode -ForegroundColor Green + Write-Host "Ticket ID : " -NoNewline + Write-Host $responseContent + } + else { + $responseContent = ConvertFrom-Json $Response.Content + Write-Host $Response.StatusCode -ForegroundColor Red + Write-Host "Message : $($responseContent.message)" + } +} elseif ($SourceCodeArchivalUri) { + Write-Host "Would have posted to $SourceCodeArchivalUri" +} diff --git a/azure-pipelines/archive-sourcecode.yml b/azure-pipelines/archive-sourcecode.yml new file mode 100644 index 00000000..37b67cd3 --- /dev/null +++ b/azure-pipelines/archive-sourcecode.yml @@ -0,0 +1,50 @@ +trigger: none # We only want to trigger manually or based on resources +pr: none + +# Source archival requirements come from a compliance tenet. Review a sample task here: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1550985 +# Source code should be archived within 30 days of the release date, and at least every quarter if your product is releasing more than once every 6 months. +# If your sources on GitHub are public open source project, then using GitHub Public Archive is sufficient. +schedules: +- cron: "13 13 13 */3 *" # Every three months + displayName: Periodic source archival + branches: + include: + - main + +parameters: +- name: notes + displayName: Notes to include in the SCA request + type: string +- name: whatif + displayName: Only simulate the request + type: boolean + +variables: +- group: VS Core team # Expected to provide ManagerAlias, SourceCodeArchivalUri + +pool: + name: AzurePipelines-EO + vmImage: AzurePipelinesUbuntu20.04compliant + +steps: +- checkout: self + clean: true + fetchDepth: 0 +- powershell: tools/Install-DotNetSdk.ps1 + displayName: Install .NET SDK +- powershell: azure-pipelines/variables/_pipelines.ps1 + failOnStderr: true + displayName: ⚙ Set pipeline variables based on source +- powershell: > + $TeamAlias = '$(TeamEmail)'.Substring(0, '$(TeamEmail)'.IndexOf('@')) + + azure-pipelines/Archive-SourceCode.ps1 + -ManagerAlias '$(ManagerAlias)' + -TeamAlias $TeamAlias + -BusinessGroupName '$(BusinessGroupName)' + -ProductName '$(SymbolsFeatureName)' + -ProductLanguage English + -Notes '${{ parameters.notes }}' + -Verbose + -WhatIf:$${{ parameters.whatif }} + displayName: Submit archival request diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index a819f3e0..e9b801f2 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -21,7 +21,7 @@ jobs: variables: - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: # https://dev.azure.com/devdiv/DevDiv/_wiki/wikis/DevDiv.wiki/25351/APIScan-step-by-step-guide-to-setting-up-a-Pipeline - - group: VSCloudServices-APIScan + - group: VSCloudServices-APIScan # Expected to provide ApiScanClientId, ApiScanSecret, ApiScanTenant steps: - checkout: self fetchDepth: 0 # avoid shallow clone so nbgv can do its work. diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index e1d88344..db7d7dd0 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -10,7 +10,7 @@ resources: - auto-release variables: -- group: VS SDK feeds +- group: VS SDK feeds # Expected to provide NuGetOrgApiKey jobs: - job: release diff --git a/azure-pipelines/variables/BusinessGroupName.ps1 b/azure-pipelines/variables/BusinessGroupName.ps1 new file mode 100644 index 00000000..00824266 --- /dev/null +++ b/azure-pipelines/variables/BusinessGroupName.ps1 @@ -0,0 +1 @@ +'Visual Studio - VS Core' From c9f248d9179e97b27838604f5646fabd6d64150a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 16 Sep 2022 21:23:50 -0600 Subject: [PATCH 494/889] Touch up on icons in pipeline --- azure-pipelines/archive-sourcecode.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/archive-sourcecode.yml b/azure-pipelines/archive-sourcecode.yml index 37b67cd3..3c0000c9 100644 --- a/azure-pipelines/archive-sourcecode.yml +++ b/azure-pipelines/archive-sourcecode.yml @@ -31,7 +31,7 @@ steps: clean: true fetchDepth: 0 - powershell: tools/Install-DotNetSdk.ps1 - displayName: Install .NET SDK + displayName: ⚙ Install .NET SDK - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true displayName: ⚙ Set pipeline variables based on source @@ -47,4 +47,4 @@ steps: -Notes '${{ parameters.notes }}' -Verbose -WhatIf:$${{ parameters.whatif }} - displayName: Submit archival request + displayName: 🗃️ Submit archival request From f43e6388312ddcff046adbc7b0b8e48627b47d39 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 16 Sep 2022 22:48:12 -0600 Subject: [PATCH 495/889] Make `notes` parameter optional This works around lack of support by using a blank space as a default value. See https://developercommunity.visualstudio.com/idea/975396/optional-runtime-parameter.html --- azure-pipelines/Archive-SourceCode.ps1 | 2 +- azure-pipelines/archive-sourcecode.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/Archive-SourceCode.ps1 b/azure-pipelines/Archive-SourceCode.ps1 index 441bc1cf..8f605a8e 100644 --- a/azure-pipelines/Archive-SourceCode.ps1 +++ b/azure-pipelines/Archive-SourceCode.ps1 @@ -181,7 +181,7 @@ $Request = @{ "ProductLanguage" = [string]::Join(',', $ProductLanguage) "FileCollection" = [string]::Join(',', $FileCollection) "OwnerAlias" = $OwnerAlias - "Notes" = $Notes + "Notes" = $Notes.Trim() "CustomerProvidedDataSizeMB" = $DataSizeMB "CustomerProvidedFileCount" = $FileCount "BackupType" = $BackupType diff --git a/azure-pipelines/archive-sourcecode.yml b/azure-pipelines/archive-sourcecode.yml index 3c0000c9..2f00a00c 100644 --- a/azure-pipelines/archive-sourcecode.yml +++ b/azure-pipelines/archive-sourcecode.yml @@ -15,6 +15,7 @@ parameters: - name: notes displayName: Notes to include in the SCA request type: string + default: ' ' # optional parameters require a non-empty default. - name: whatif displayName: Only simulate the request type: boolean From 12bda8587b4e368ff2417711f6c2d29928c00b12 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 20 Sep 2022 17:21:42 -0600 Subject: [PATCH 496/889] Update macOS agent to OS12 --- azure-pipelines/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 23b31221..c8687859 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -41,7 +41,7 @@ jobs: - job: macOS condition: ${{ parameters.includeMacOS }} pool: - vmImage: macOS-10.15 + vmImage: macOS-12 steps: - checkout: self fetchDepth: 0 # avoid shallow clone so nbgv can do its work. From 34412f06a0e3a69eed70eedd8e8323d75e2d338b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 21 Sep 2022 10:36:48 -0600 Subject: [PATCH 497/889] Add more analyzers --- .editorconfig | 9 +++++++++ Directory.Build.props | 2 ++ 2 files changed, 11 insertions(+) diff --git a/.editorconfig b/.editorconfig index 0d75b34a..c8b5de9a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -167,5 +167,14 @@ dotnet_diagnostic.SA1130.severity = silent # IDE1006: Naming Styles - StyleCop handles these for us dotnet_diagnostic.IDE1006.severity = none +dotnet_diagnostic.DOC100.severity = silent +dotnet_diagnostic.DOC104.severity = warning +dotnet_diagnostic.DOC105.severity = warning +dotnet_diagnostic.DOC106.severity = warning +dotnet_diagnostic.DOC107.severity = warning +dotnet_diagnostic.DOC108.severity = warning +dotnet_diagnostic.DOC200.severity = warning +dotnet_diagnostic.DOC202.severity = warning + [*.sln] indent_style = tab diff --git a/Directory.Build.props b/Directory.Build.props index 35f7d62a..f13158c0 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -41,6 +41,8 @@ + + From 671879ab3f16635eb6621c9dd1781e119b86f3ec Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 21 Sep 2022 11:42:28 -0600 Subject: [PATCH 498/889] Switch to one nuget.config feed --- azure-pipelines/official.yml | 3 --- nuget.config | 24 ++++++------------------ 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 0a398070..d469afdf 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -42,9 +42,6 @@ parameters: type: boolean default: true -variables: - NugetSecurityAnalysisWarningLevel: none # nuget.config requires signed packages by trusted owners - stages: - stage: Build diff --git a/nuget.config b/nuget.config index b73bfabd..4164936d 100644 --- a/nuget.config +++ b/nuget.config @@ -2,31 +2,19 @@ - - - - - - - + - - - Microsoft;xunit;manuel.roemer;sharwell;jamesnk;aarnott;MarcoRossignoli;Thecentury - - - - - - - - + + + + + From 11b5be154b77323110cd068810753a2f5754426e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 21 Sep 2022 12:05:56 -0600 Subject: [PATCH 499/889] Add commented nuget source for non-OSS repos --- nuget.config | 1 + 1 file changed, 1 insertion(+) diff --git a/nuget.config b/nuget.config index 4164936d..66fe3b25 100644 --- a/nuget.config +++ b/nuget.config @@ -7,6 +7,7 @@ + From fe603a52c8128146fa2b6561e93ba84b371cd7cd Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 22 Sep 2022 09:59:20 -0600 Subject: [PATCH 500/889] Use VS-Platform as the internal consumption feed --- nuget.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuget.config b/nuget.config index 66fe3b25..b4710e70 100644 --- a/nuget.config +++ b/nuget.config @@ -7,7 +7,7 @@ - + From a61f8b1d2d493607cc73d9b0d38d36c567633ff4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 22 Sep 2022 10:00:14 -0600 Subject: [PATCH 501/889] Fix key to match the packageSource no matter which is kept --- nuget.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuget.config b/nuget.config index b4710e70..f1a99832 100644 --- a/nuget.config +++ b/nuget.config @@ -7,7 +7,7 @@ - + From 1066a1817cc8ce2de011ae54faddebe957fc4ed8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 22 Sep 2022 10:10:09 -0600 Subject: [PATCH 502/889] Authenticate to azure-public/msft_consumption to allow ingestion of packages in official builds --- azure-pipelines/install-dependencies.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 81782668..4b71e6b5 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -6,6 +6,7 @@ steps: - task: NuGetAuthenticate@1 displayName: 🔏 Authenticate NuGet feeds inputs: + nuGetServiceConnections: azure-public/msft_consumption forceReinstallCredentialProvider: true - powershell: | From f0569776de5ddda31c3a8be52c1025a44dcf798e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 22 Sep 2022 10:29:38 -0600 Subject: [PATCH 503/889] Revert "Authenticate to azure-public/msft_consumption to allow ingestion of packages in official builds" This led to the error in AzP: > ##[error]Error: The service connection for 'https://pkgs.dev.azure.com/azure-public/vside/_packaging/msft_consumption/nuget/v3/index.json' is not valid. ApiKey service connections are not supported in this task. Instead, use -ApiKey (NuGet) or --api-key (dotnet) when invoking the tool itself. See the task documentation for more details. This reverts commit 1066a1817cc8ce2de011ae54faddebe957fc4ed8. --- azure-pipelines/install-dependencies.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 4b71e6b5..81782668 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -6,7 +6,6 @@ steps: - task: NuGetAuthenticate@1 displayName: 🔏 Authenticate NuGet feeds inputs: - nuGetServiceConnections: azure-public/msft_consumption forceReinstallCredentialProvider: true - powershell: | From 2c34cc536a85f5f15227c874ca9e9946702744fe Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 22 Sep 2022 12:00:30 -0600 Subject: [PATCH 504/889] Authenticate to azure-public/msft_consumption to allow ingestion of packages in official builds This reverts commit f0569776de5ddda31c3a8be52c1025a44dcf798e. --- azure-pipelines/install-dependencies.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 81782668..4b71e6b5 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -6,6 +6,7 @@ steps: - task: NuGetAuthenticate@1 displayName: 🔏 Authenticate NuGet feeds inputs: + nuGetServiceConnections: azure-public/msft_consumption forceReinstallCredentialProvider: true - powershell: | From 006072749dc96d071343e0e4aae5edd05635b6d0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 27 Sep 2022 10:27:46 -0600 Subject: [PATCH 505/889] Fix pipeline failure on azure-public --- azure-pipelines/install-dependencies.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 4b71e6b5..cdfd2ed4 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -3,11 +3,12 @@ parameters: steps: -- task: NuGetAuthenticate@1 - displayName: 🔏 Authenticate NuGet feeds - inputs: - nuGetServiceConnections: azure-public/msft_consumption - forceReinstallCredentialProvider: true +- ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + - task: NuGetAuthenticate@1 + displayName: 🔏 Authenticate NuGet feeds + inputs: + nuGetServiceConnections: azure-public/msft_consumption + forceReinstallCredentialProvider: true - powershell: | $AccessToken = '$(System.AccessToken)' # Avoid specifying the access token directly on the init.ps1 command line to avoid it showing up in errors From 503365304724b6779e184ba84998f6dcf5cfb14a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 27 Sep 2022 10:46:18 -0600 Subject: [PATCH 506/889] Authenticate nuget feeds on azure-public too --- azure-pipelines/install-dependencies.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index cdfd2ed4..0976e548 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -3,12 +3,12 @@ parameters: steps: -- ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - - task: NuGetAuthenticate@1 - displayName: 🔏 Authenticate NuGet feeds - inputs: +- task: NuGetAuthenticate@1 + displayName: 🔏 Authenticate NuGet feeds + inputs: + ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: nuGetServiceConnections: azure-public/msft_consumption - forceReinstallCredentialProvider: true + forceReinstallCredentialProvider: true - powershell: | $AccessToken = '$(System.AccessToken)' # Avoid specifying the access token directly on the init.ps1 command line to avoid it showing up in errors From 2678ec5fa3e3d854140405cd980f241df8da617e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 28 Sep 2022 08:39:19 -0600 Subject: [PATCH 507/889] Use static graph restore It's faster, and the future. --- Directory.Build.props | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index f13158c0..3170d14b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -16,6 +16,9 @@ true + + true + $(MSBuildThisFileDirectory) From 90a2c4b7d3907b6f7d6e08eac3305fca6c310245 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 28 Sep 2022 14:50:36 -0600 Subject: [PATCH 508/889] Remove the package mapping in nuget.config nuget no longer requires this. --- nuget.config | 5 ----- 1 file changed, 5 deletions(-) diff --git a/nuget.config b/nuget.config index f1a99832..52071eaa 100644 --- a/nuget.config +++ b/nuget.config @@ -13,9 +13,4 @@ - - - - - From 0552ddca8b22548fe1e331a64ebe430fe6a80008 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 30 Sep 2022 22:48:21 -0600 Subject: [PATCH 509/889] Update dependencies --- Directory.Build.props | 2 +- test/Library.Tests/Library.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 3170d14b..8cada6c7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -40,7 +40,7 @@ - + diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 2c1c3e8e..4e9a7a4c 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,7 +10,7 @@ - + From 2eaf0fb8f261f978f6d60bef5fde8c87d5eb8640 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 5 Oct 2022 11:48:02 -0600 Subject: [PATCH 510/889] Update .NET SDK to 6.0.401 --- .devcontainer/Dockerfile | 2 +- global.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b13ca0ac..5c1bdc7a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:6.0.300-focal +FROM mcr.microsoft.com/dotnet/sdk:6.0.401-focal # Installing mono makes `dotnet test` work without errors even for net472. # But installing it takes a long time, so it's excluded by default. diff --git a/global.json b/global.json index 954a92e7..7bf6fc99 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.300", + "version": "6.0.401", "rollForward": "patch", "allowPrerelease": false } From 577e0023a2325ad5c9abd9d96dd1733ef83ec5be Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 5 Oct 2022 11:49:36 -0600 Subject: [PATCH 511/889] Update MicroBuild version to 2.0.84 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 3da24e86..f74cb06d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -34,7 +34,7 @@ true snupkg - 2.0.73 + 2.0.84 From abab1d849933ee85cb6f026026f28e481db1bc64 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 20 Oct 2022 16:06:44 -0600 Subject: [PATCH 512/889] Fix variable detection on linux Linux can have empty values for environment variables. Windows evidently doesn't tend to have those. --- azure-pipelines/variables/_pipelines.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/variables/_pipelines.ps1 b/azure-pipelines/variables/_pipelines.ps1 index 951106d2..11748b81 100644 --- a/azure-pipelines/variables/_pipelines.ps1 +++ b/azure-pipelines/variables/_pipelines.ps1 @@ -14,7 +14,7 @@ param ( (& "$PSScriptRoot\_all.ps1").GetEnumerator() |% { # Always use ALL CAPS for env var names since Azure Pipelines converts variable names to all caps and on non-Windows OS, env vars are case sensitive. $keyCaps = $_.Key.ToUpper() - if (Test-Path -Path "env:$keyCaps") { + if ((Test-Path "env:$keyCaps") -and (Get-Content "env:$keyCaps")) { Write-Host "Skipping setting $keyCaps because variable is already set to '$(Get-Content env:$keyCaps)'." -ForegroundColor Cyan } else { Write-Host "$keyCaps=$($_.Value)" -ForegroundColor Yellow From 2cc8e3ec10ad4812134c74345a7cacced9437c26 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 21 Oct 2022 17:42:39 -0600 Subject: [PATCH 513/889] Fix release pipeline --- azure-pipelines/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index db7d7dd0..175c37a9 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -35,7 +35,7 @@ jobs: - download: CI artifact: deployables-Windows displayName: 🔻 Download deployables-Windows artifact - patterns: 'deployables-Windows/*' + patterns: 'deployables-Windows/NuGet/*' - task: GitHubRelease@1 displayName: 📢 GitHub release (create) inputs: From bec0a44abf92343e4e685ab63aa2ad63d97099b5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 21 Oct 2022 17:44:36 -0600 Subject: [PATCH 514/889] Enable CodeQL --- azure-pipelines/official.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index d469afdf..ad1544c0 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -52,6 +52,7 @@ stages: NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages SignTypeSelection: ${{ parameters.SignTypeSelection }} Packaging.EnableSBOMSigning: false + Codeql.Enabled: true jobs: - template: build.yml From c3be0152c23ebc3f49d87081bec1875583684bbb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 24 Oct 2022 13:10:18 -0600 Subject: [PATCH 515/889] Fix scheduled run of source code archival pipeline --- azure-pipelines/archive-sourcecode.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/archive-sourcecode.yml b/azure-pipelines/archive-sourcecode.yml index 2f00a00c..0c99a236 100644 --- a/azure-pipelines/archive-sourcecode.yml +++ b/azure-pipelines/archive-sourcecode.yml @@ -19,6 +19,7 @@ parameters: - name: whatif displayName: Only simulate the request type: boolean + default: false variables: - group: VS Core team # Expected to provide ManagerAlias, SourceCodeArchivalUri From 0d28ad612a8ca322fd44cefa0e4024ad7a9066c0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 24 Oct 2022 14:04:19 -0600 Subject: [PATCH 516/889] Update MicroBuild to 2.0.87 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index f74cb06d..a07c9a88 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -34,7 +34,7 @@ true snupkg - 2.0.84 + 2.0.87 From cffffa4afb7b44d45896d8138d6464bc92650fbe Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 24 Oct 2022 14:17:43 -0600 Subject: [PATCH 517/889] Update Nerdbank.GitVersioning version --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 8cada6c7..abdb9d8b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -40,7 +40,7 @@ - + From 2a5a528133ac007b2facba8b53cfbdb86f0f0b67 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 31 Oct 2022 08:51:51 -0600 Subject: [PATCH 518/889] Improve verbose output of artifact collection --- azure-pipelines/artifacts/_all.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1 index 033cc87c..9a22a1d0 100755 --- a/azure-pipelines/artifacts/_all.ps1 +++ b/azure-pipelines/artifacts/_all.ps1 @@ -38,6 +38,7 @@ Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse | % { $ArtifactName = $_.BaseName if ($Force -or !(Test-ArtifactStaged($ArtifactName + $ArtifactNameSuffix))) { $totalFileCount = 0 + Write-Verbose "Collecting file list for artifact $($_.BaseName)" $fileGroups = & $_ if ($fileGroups) { $fileGroups.GetEnumerator() | % { From 77fcd3de2d9f7c6368cc0baeb6cf6e23a204bdaa Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Nov 2022 08:16:02 -0600 Subject: [PATCH 519/889] Switch to NuGet's central package versioning --- Directory.Build.props | 13 ++++++------- Directory.Packages.props | 17 +++++++++++++++++ test/Library.Tests/Library.Tests.csproj | 6 +++--- 3 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 Directory.Packages.props diff --git a/Directory.Build.props b/Directory.Build.props index abdb9d8b..8f186a7c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -39,13 +39,12 @@ - - - - - - - + + + + + + diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 00000000..8bec0397 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,17 @@ + + + + true + + + + + + + + + + + + + diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 4e9a7a4c..39650b7d 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,9 +10,9 @@ - - - + + + From b894b8a9901dfcbec1030860da30bf6c7507bd19 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Nov 2022 08:22:12 -0600 Subject: [PATCH 520/889] Update to the .NET 7.0.100-rc.2 SDK This removes the warning about using NuGet CPVM, "a preview feature". --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 7bf6fc99..01e689ed 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.401", + "version": "7.0.100-rc.2.22477.23", "rollForward": "patch", "allowPrerelease": false } From ab4fb10d210dd404d8d04aa14c706af271129d0e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Nov 2022 08:29:15 -0600 Subject: [PATCH 521/889] Switch to using GlobalPackageReference --- Directory.Build.props | 9 --------- Directory.Packages.props | 14 ++++++++------ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 8f186a7c..301047d1 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -38,15 +38,6 @@ snupkg - - - - - - - - - diff --git a/Directory.Packages.props b/Directory.Packages.props index 8bec0397..2b94d74d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,14 +4,16 @@ true - - - - - - + + + + + + + + From 318aaadd6dc4f2b674e5f7c18e9940550a1b3e43 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Nov 2022 08:45:31 -0600 Subject: [PATCH 522/889] Move GitHub-specific package ref to its own group This is to reduce merge conflicts with the microbuild branch where nearby lines change a lot. --- Directory.Packages.props | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 2b94d74d..c33a3beb 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -11,9 +11,11 @@ - + + + From 428672900e289ae0e59dccdfe51cf5b4e9fd3884 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Nov 2022 09:12:45 -0600 Subject: [PATCH 523/889] Remove old style build from template expansion test --- azure-pipelines/expand-template.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/azure-pipelines/expand-template.yml b/azure-pipelines/expand-template.yml index 1a8b3240..0047e536 100644 --- a/azure-pipelines/expand-template.yml +++ b/azure-pipelines/expand-template.yml @@ -14,14 +14,5 @@ steps: - powershell: .\init.ps1 displayName: 🔽 Install prereqs and restore packages -- task: VSBuild@1 - displayName: 🛠 Build Visual Studio solution (expanded template) - inputs: - msbuildArgs: /t:build,pack /m - platform: Any CPU - configuration: $(BuildConfiguration) - condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - - script: dotnet build displayName: 🛠 dotnet build (expanded template) - condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) From 253e62c08488d57a5b740fb68475501353713cdd Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Nov 2022 12:02:25 -0600 Subject: [PATCH 524/889] Simplify parent import pattern --- src/Directory.Build.props | 2 +- src/Directory.Build.targets | 2 +- test/Directory.Build.props | 2 +- test/Directory.Build.targets | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 77d94765..052fe3ef 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,3 +1,3 @@ - + diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 566ab4fc..c1d929a5 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -3,5 +3,5 @@ - + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 449a06e4..ad4a4b6c 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -1,5 +1,5 @@ - + false diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets index e7edee55..052fe3ef 100644 --- a/test/Directory.Build.targets +++ b/test/Directory.Build.targets @@ -1,3 +1,3 @@ - + From 610968dc21b84a116d0bd1c7a0ff00441308f536 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Nov 2022 12:27:24 -0600 Subject: [PATCH 525/889] Remove redundant attribute --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 14fd9704..75b67153 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -18,7 +18,7 @@ - + From f91a0e871d9f794cc36020341f358718d6b07f83 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Nov 2022 14:19:46 -0600 Subject: [PATCH 526/889] Avoid .NET 7 SDK till it's stable Otherwise, msbuild.exe fails on VS 17.3, which is the latest stable release. We need to wait till folks can use VS 17.4 to use the .NET 7 SDK. --- Directory.Packages.props | 24 ++++++++++++++++++------ global.json | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index c33a3beb..8c1e8f80 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -8,14 +8,26 @@ + - - - - - + + + + + - + + + + + + + + + + + diff --git a/global.json b/global.json index 01e689ed..3ce46e09 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.100-rc.2.22477.23", + "version": "6.0.402", "rollForward": "patch", "allowPrerelease": false } From 956093988fd134e694a50850e9488953ba4aaed2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 4 Nov 2022 14:22:24 -0600 Subject: [PATCH 527/889] Avoid spreading package version information into test directory --- Directory.Packages.props | 1 + test/Directory.Build.props | 4 ++++ test/Directory.Packages.props | 7 ------- 3 files changed, 5 insertions(+), 7 deletions(-) delete mode 100644 test/Directory.Packages.props diff --git a/Directory.Packages.props b/Directory.Packages.props index 75b67153..a2770162 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,6 +7,7 @@ + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index f3d4b88b..1ca1ec44 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -5,4 +5,8 @@ false true + + + + diff --git a/test/Directory.Packages.props b/test/Directory.Packages.props deleted file mode 100644 index 14735472..00000000 --- a/test/Directory.Packages.props +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - From c32551d1365873cdf6c26bec81c07481fa2b28fe Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 7 Nov 2022 08:59:40 -0700 Subject: [PATCH 528/889] Add Directory.Packages.props as a solution item --- Library.sln | 1 + 1 file changed, 1 insertion(+) diff --git a/Library.sln b/Library.sln index 606811aa..638efb56 100644 --- a/Library.sln +++ b/Library.sln @@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig Directory.Build.props = Directory.Build.props Directory.Build.targets = Directory.Build.targets + Directory.Packages.props = Directory.Packages.props global.json = global.json nuget.config = nuget.config README.md = README.md From 295d06694b9fd0993197bb6c1ea94731c2b4bb05 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 10 Nov 2022 17:26:57 +0000 Subject: [PATCH 529/889] Use static code coverage preview This is in an attempt to fix #180 --- Directory.Packages.props | 1 + azure-pipelines/test.runsettings | 6 ++++-- nuget.config | 1 + test/Library.Tests/Library.Tests.csproj | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 8c1e8f80..d1226691 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,6 +4,7 @@ true + diff --git a/azure-pipelines/test.runsettings b/azure-pipelines/test.runsettings index c69022fc..975b7123 100644 --- a/azure-pipelines/test.runsettings +++ b/azure-pipelines/test.runsettings @@ -31,11 +31,13 @@ False - True + False - True + False True + True + False diff --git a/nuget.config b/nuget.config index 22f7b809..9454ec02 100644 --- a/nuget.config +++ b/nuget.config @@ -7,6 +7,7 @@ + diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 39650b7d..2eb4afe1 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,6 +10,7 @@ + From ad6e2422bed202dfd0e95a567635809eb9b3a2f3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 11 Nov 2022 15:19:51 +0000 Subject: [PATCH 530/889] Resolve NU1507 warning --- nuget.config | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nuget.config b/nuget.config index 9454ec02..6ce7cfd0 100644 --- a/nuget.config +++ b/nuget.config @@ -13,4 +13,12 @@ + + + + + + + + From 66a302c4e7c60633ad09c232f0b8cd105ab1f795 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 14 Nov 2022 12:17:50 -0700 Subject: [PATCH 531/889] Update Microsoft.NET.Test.Sdk --- Directory.Packages.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index d1226691..924f4b4e 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ - + @@ -31,4 +31,4 @@ - + \ No newline at end of file From 8ebf3f27b25adbe6d266bc07fbdd01bc94d82a48 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 21 Nov 2022 09:37:48 -0700 Subject: [PATCH 532/889] Use `MSBuildTreatWarningsAsErrors` in pipeline This is more comprehensive than `TreatWarningsAsErrors` because it changes the behavior of the MSBuild logging system itself instead of relying on individual tasks and targets to honor the property and elevate their own warnings. --- .github/workflows/build.yml | 2 +- azure-pipelines.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c4ba94c..a56a6dda 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: pull_request: env: - TreatWarningsAsErrors: true + MSBuildTreatWarningsAsErrors: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BUILDCONFIGURATION: Release # codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2cac17bd..521d4ce6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -23,7 +23,7 @@ parameters: default: true variables: - TreatWarningsAsErrors: true + MSBuildTreatWarningsAsErrors: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ From 73ef446ccb46cf39b434ef004007681624bffc89 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 21 Nov 2022 09:40:20 -0700 Subject: [PATCH 533/889] Avoid static graph restore This until the fix for https://github.com/NuGet/Home/issues/12177 is broadly available. --- Directory.Build.props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 301047d1..e78128b9 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -17,7 +17,8 @@ true - true + + false $(MSBuildThisFileDirectory) From ae66da74a2e324d3fc73753c691cfeb882d18daf Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 8 Nov 2022 22:24:14 -0700 Subject: [PATCH 534/889] Update to the .NET 7 SDK --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 3ce46e09..e5187f36 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.402", + "version": "7.0.100", "rollForward": "patch", "allowPrerelease": false } From ca3ab7d086ec1559228a26e454f6dc71e920066e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 21 Nov 2022 20:06:18 -0700 Subject: [PATCH 535/889] Enable NuGet CPVM transitive pinning --- Directory.Packages.props | 1 + 1 file changed, 1 insertion(+) diff --git a/Directory.Packages.props b/Directory.Packages.props index 924f4b4e..5ce5b0f0 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -2,6 +2,7 @@ true + true From 6bcec4372bd8508a7513aa6653712b2388a94a9a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 22 Nov 2022 09:05:12 -0700 Subject: [PATCH 536/889] Fix build on machines with Visual Studio 2022 Update 3 This is a workaround for Azure Pipelines Hosted agents, which haven't upgraded to Dev17.4 yet. --- Directory.Packages.props | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 5ce5b0f0..e9475f7c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -15,6 +15,7 @@ + @@ -25,6 +26,7 @@ + @@ -32,4 +34,4 @@ - \ No newline at end of file + From 6a34c4f283848ed96447f3ce5fde429309112fe0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 22 Nov 2022 09:23:41 -0700 Subject: [PATCH 537/889] Switch back to `GlobalPackageReference` --- Directory.Packages.props | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index e9475f7c..5996640f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -10,28 +10,15 @@ - - - - - - - + + + + + + - - - - - - - - - - - - + From fb2b395fce67a75e5be07443e204fc5b905b6983 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 24 Nov 2022 13:21:22 -0700 Subject: [PATCH 538/889] Drop the .NET compilers toolset pin This reverts "Fix build on machines with Visual Studio 2022 Update 3" since Azure Pipelines now has Update 4 installed. This reverts commit 6bcec4372bd8508a7513aa6653712b2388a94a9a. --- Directory.Packages.props | 1 - 1 file changed, 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 5996640f..8e696a7e 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -13,7 +13,6 @@ - From a32f820b0f145106b6a7182079a59adf7e9554a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Dec 2022 10:45:54 -0700 Subject: [PATCH 539/889] Bump Microsoft.CodeCoverage (#182) Bumps [Microsoft.CodeCoverage](https://github.com/microsoft/vstest) from 17.5.0-preview-20221109-01 to 17.5.0-preview-20221201-01. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/commits) --- updated-dependencies: - dependency-name: Microsoft.CodeCoverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 8e696a7e..056c5349 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From b71db19e49607ac305668b92d54055807c4f8447 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 1 Dec 2022 10:49:36 -0700 Subject: [PATCH 540/889] Bump MicroBuild version to 2.0.93 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 34bf39a5..33eb2268 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 2.0.87 + 2.0.93 From e7ed3b30668a893d23584ecf05294d7b14f6b445 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 1 Dec 2022 14:46:40 -0700 Subject: [PATCH 541/889] Bump Microsoft.CodeCoverage from 17.5.0-preview-20221201-01 to 17.5.0-preview-20221201-06 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 056c5349..f19a9842 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From a24d8a1e51e439376edc8cf3753f4460c2044204 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 15 Dec 2022 09:05:55 -0700 Subject: [PATCH 542/889] Drop netcoreapp3.1 targeting Also update the .NET SDK to 7.0.101 --- .devcontainer/Dockerfile | 3 ++- global.json | 2 +- test/Library.Tests/CalculatorTests.cs | 2 +- test/Library.Tests/Library.Tests.csproj | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 5c1bdc7a..7ffd07ef 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,5 @@ -FROM mcr.microsoft.com/dotnet/sdk:6.0.401-focal +# Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions +FROM mcr.microsoft.com/dotnet/sdk:7.0.101-jammy # Installing mono makes `dotnet test` work without errors even for net472. # But installing it takes a long time, so it's excluded by default. diff --git a/global.json b/global.json index e5187f36..cc08211e 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.100", + "version": "7.0.101", "rollForward": "patch", "allowPrerelease": false } diff --git a/test/Library.Tests/CalculatorTests.cs b/test/Library.Tests/CalculatorTests.cs index 042e7d94..0e7e8339 100644 --- a/test/Library.Tests/CalculatorTests.cs +++ b/test/Library.Tests/CalculatorTests.cs @@ -14,7 +14,7 @@ public CalculatorTests() public void AddOrSubtract() { // This tests aggregation of code coverage across test runs. -#if NETCOREAPP3_1 +#if NET6_0_OR_GREATER Assert.Equal(3, Calculator.Add(1, 2)); #else Assert.Equal(-1, Calculator.Subtract(1, 2)); diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index 2eb4afe1..d557e4c7 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -1,7 +1,7 @@ - net6.0;netcoreapp3.1;net472 + net6.0;net472 From 2da647834cdc78b9399967a813a4d2ef6461c437 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 15 Dec 2022 09:22:45 -0700 Subject: [PATCH 543/889] Multitarget the library .NET Standard 2.0 is still relevant because it's the last TFM that works on all .NET runtimes. But it's also very old, depriving the developer of the nullable ref annotations that are in later versions of .NET that can help reduce bugs. There are also newer APIs that can be *automatically* consumed by the compiler based on newer TFMs even without using `#if` in your code that can improve runtime performance of the code. --- src/Library/Library.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Library/Library.csproj b/src/Library/Library.csproj index a7547da1..b6b926ab 100644 --- a/src/Library/Library.csproj +++ b/src/Library/Library.csproj @@ -1,6 +1,6 @@ - netstandard2.0 + net6.0;netstandard2.0 README.md From dfd69e0a9d0062a445e6bd4c2c0131d41f588a77 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 15 Dec 2022 09:26:42 -0700 Subject: [PATCH 544/889] Avoid System.Net.Http compile error when targeting net472 --- Directory.Build.targets | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Directory.Build.targets b/Directory.Build.targets index 65a15bfc..cbe19ca0 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -4,5 +4,10 @@ false + + + + + From 8121dad9b92d083ef3500956182a84f4674ea2b4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 15 Dec 2022 09:48:06 -0700 Subject: [PATCH 545/889] Drop obsolete WPF workarounds --- Directory.Build.props | 8 -------- Directory.Build.targets | 2 -- 2 files changed, 10 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index e78128b9..7980f528 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -62,23 +62,15 @@ - <_WpfTempProjectNuGetFilePathNoExt>$(BaseIntermediateOutputPath)..\$(_TargetAssemblyProjectName)\$(_TargetAssemblyProjectName)$(MSBuildProjectExtension).nuget.g - false false false false - - - diff --git a/Directory.Build.targets b/Directory.Build.targets index cbe19ca0..ea7b6e6f 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -8,6 +8,4 @@ - - From 435bda683b3d32c46261684af3c5291e81ed5acd Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 15 Dec 2022 09:03:17 -0700 Subject: [PATCH 546/889] Add emoticons to github workflows --- .github/workflows/build.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a56a6dda..7718f84a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - - name: Install prerequisites + - name: ⚙ Install prerequisites run: | ./init.ps1 -UpgradePrerequisites dotnet --info @@ -40,75 +40,75 @@ jobs: mono --version } shell: pwsh - - name: Set pipeline variables based on source + - name: ⚙️ Set pipeline variables based on source run: azure-pipelines/variables/_pipelines.ps1 shell: pwsh - - name: build + - name: 🛠 build run: dotnet build -t:build,pack --no-restore -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog" - - name: test + - name: 🧪 test run: azure-pipelines/dotnet-test-cloud.ps1 -Configuration ${{ env.BUILDCONFIGURATION }} -Agent ${{ runner.os }} shell: pwsh - - name: Update pipeline variables based on build outputs + - name: ⚙ Update pipeline variables based on build outputs run: azure-pipelines/variables/_pipelines.ps1 shell: pwsh - - name: Collect artifacts + - name: 📥 Collect artifacts run: azure-pipelines/artifacts/_stage_all.ps1 shell: pwsh if: always() - - name: Upload project.assets.json files + - name: 📢 Upload project.assets.json files if: always() uses: actions/upload-artifact@v1 with: name: projectAssetsJson-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/projectAssetsJson continue-on-error: true - - name: Upload variables + - name: 📢 Upload variables uses: actions/upload-artifact@v1 with: name: variables-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/Variables continue-on-error: true - - name: Upload build_logs + - name: 📢 Upload build_logs if: always() uses: actions/upload-artifact@v1 with: name: build_logs-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/build_logs continue-on-error: true - - name: Upload test_logs + - name: 📢 Upload test_logs if: always() uses: actions/upload-artifact@v1 with: name: test_logs-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/test_logs continue-on-error: true - - name: Upload testResults + - name: 📢 Upload testResults if: always() uses: actions/upload-artifact@v1 with: name: testResults-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/testResults continue-on-error: true - - name: Upload coverageResults + - name: 📢 Upload coverageResults if: always() uses: actions/upload-artifact@v1 with: name: coverageResults-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/coverageResults continue-on-error: true - - name: Upload symbols + - name: 📢 Upload symbols uses: actions/upload-artifact@v1 with: name: symbols-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/symbols continue-on-error: true - - name: Upload deployables + - name: 📢 Upload deployables uses: actions/upload-artifact@v1 with: name: deployables-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/deployables if: always() - - name: Publish code coverage results to codecov.io + - name: 📢 Publish code coverage results to codecov.io run: ./azure-pipelines/publish-CodeCov.ps1 -CodeCovToken "${{ env.codecov_token }}" -PathToCodeCoverage "${{ runner.temp }}/_artifacts/coverageResults" -Name "${{ runner.os }} Coverage Results" -Flags "${{ runner.os }}Host,${{ env.BUILDCONFIGURATION }}" shell: pwsh timeout-minutes: 3 From 2107c6a84526544f8c00f4f86bc6390f234a4036 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 17 Dec 2022 16:40:56 -0700 Subject: [PATCH 547/889] Bump C# language version to 11 Just use `latest` so it'll be whatever the SDK version permits. Dropping the property altogether would use the formally recommended version for the TFM, which is less desirable. --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 7980f528..d722f5e4 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,7 +5,7 @@ $(RepoRootPath)obj\$([MSBuild]::MakeRelative($(RepoRootPath), $(MSBuildProjectDirectory)))\ $(RepoRootPath)bin\$(MSBuildProjectName)\ $(RepoRootPath)bin\Packages\$(Configuration)\ - 10.0 + latest enable enable latest From 7e26321035767c832e5205ad71be7e666b4d8d2a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 17 Dec 2022 17:14:19 -0700 Subject: [PATCH 548/889] Bump Microsoft.NET.Test.Sdk to 17.4.1 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index f19a9842..9ec9d10c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,7 @@ - + From 73ed0f8cc96286dc9a188662178e64e2aaf2ee73 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jan 2023 09:47:36 -0700 Subject: [PATCH 549/889] Bump Microsoft.CodeCoverage (#187) Bumps [Microsoft.CodeCoverage](https://github.com/microsoft/vstest) from 17.5.0-preview-20221201-06 to 17.5.0-release-20221220-01. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/commits) --- updated-dependencies: - dependency-name: Microsoft.CodeCoverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 9ec9d10c..bfa98614 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From 1d09284ec92f9a50dc84d7c15a009688a22c889d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 4 Jan 2023 09:23:52 -0700 Subject: [PATCH 550/889] Switch code coverage from static to dynamic instrumentation --- azure-pipelines/test.runsettings | 2 -- 1 file changed, 2 deletions(-) diff --git a/azure-pipelines/test.runsettings b/azure-pipelines/test.runsettings index 975b7123..4e24a0a6 100644 --- a/azure-pipelines/test.runsettings +++ b/azure-pipelines/test.runsettings @@ -36,8 +36,6 @@ False True - True - False From c36559cdfe5273db85685f965919b7ee86452571 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 5 Jan 2023 13:44:09 -0700 Subject: [PATCH 551/889] Upgrade Microsoft.CodeCoverage --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index bfa98614..1acbd174 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From 77e4b5106dd74aa25564ba0631212146184a1f2d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 6 Jan 2023 09:30:23 -0700 Subject: [PATCH 552/889] Fix merge coverage error when output directory already exists --- azure-pipelines/Merge-CodeCoverage.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/Merge-CodeCoverage.ps1 b/azure-pipelines/Merge-CodeCoverage.ps1 index 9fe925cf..02ff12b0 100644 --- a/azure-pipelines/Merge-CodeCoverage.ps1 +++ b/azure-pipelines/Merge-CodeCoverage.ps1 @@ -41,7 +41,7 @@ if ($reports) { $Inputs = $reports |% { Resolve-Path -relative $_.FullName } - if (Split-Path $OutputFile) { + if ((Split-Path $OutputFile) -and -not (Test-Path (Split-Path $OutputFile))) { New-Item -Type Directory -Path (Split-Path $OutputFile) | Out-Null } From eb847be2bae977a110c44d683d43e253cea8ec8c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 13 Jan 2023 06:54:39 -0700 Subject: [PATCH 553/889] .gitignore .DS_Store --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 3bb49919..69599b87 100644 --- a/.gitignore +++ b/.gitignore @@ -349,3 +349,6 @@ MigrationBackup/ # dotnet tool local install directory .store/ + +# mac-created file to track user view preferences for a directory +.DS_Store From ef51aae8523a668e0a59bb231982b9d56f0f494c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 13 Jan 2023 08:49:21 -0700 Subject: [PATCH 554/889] Update AzureRepos package version --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 240095ed..34bd522c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -22,7 +22,7 @@ - + From 6c3e5ea0f32bfa74ebab3fc753b7f4a32220a25a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 13 Jan 2023 08:50:38 -0700 Subject: [PATCH 555/889] Use MSBuildTreatWarningsAsErrors on official microbuild too --- azure-pipelines/official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index ad1544c0..61cbb631 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -46,7 +46,7 @@ stages: - stage: Build variables: - TreatWarningsAsErrors: true + MSBuildTreatWarningsAsErrors: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages From 08405d839a4d97f4ec28d74a711eb433fc3fc09f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 17 Jan 2023 15:51:06 -0700 Subject: [PATCH 556/889] Fix schedule trigger for source archival --- azure-pipelines/Archive-SourceCode.ps1 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/Archive-SourceCode.ps1 b/azure-pipelines/Archive-SourceCode.ps1 index 8f605a8e..cfc30d2d 100644 --- a/azure-pipelines/Archive-SourceCode.ps1 +++ b/azure-pipelines/Archive-SourceCode.ps1 @@ -116,11 +116,10 @@ if (!$OwnerAlias) { if ($env:BUILD_REQUESTEDFOREMAIL) { Write-Verbose 'Using $env:BUILD_REQUESTEDFOREMAIL and slicing to just the alias for OwnerAlias.' $OwnerAlias = ($env:BUILD_REQUESTEDFOREMAIL -split '@')[0] + } else { + $OwnerAlias = $TeamAlias } - else { - Write-Verbose 'Using $env:USERNAME for OwnerAlias.' - $OwnerAlias = $env:USERNAME - } + if (!$OwnerAlias) { Write-Error "Unable to determine default value for -OwnerAlias." } From c4d099cb455f118c23cd10a2b53553fc38aba490 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 22 Jan 2023 09:06:39 -0700 Subject: [PATCH 557/889] Increase likelihood that folks set PackageProjectUrl property --- .editorconfig | 6 +++--- Directory.Build.props | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.editorconfig b/.editorconfig index c8b5de9a..07868777 100644 --- a/.editorconfig +++ b/.editorconfig @@ -19,12 +19,12 @@ indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true -# Xml project files -[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,msbuildproj}] +# MSBuild project files +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,msbuildproj,props,targets}] indent_size = 2 # Xml config files -[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct,runsettings}] +[*.{ruleset,config,nuspec,resx,vsixmanifest,vsct,runsettings}] indent_size = 2 # JSON files diff --git a/Directory.Build.props b/Directory.Build.props index d722f5e4..35fd4f69 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -29,6 +29,7 @@ true $(MSBuildThisFileDirectory)strongname.snk + COMPANY-PLACEHOLDER COMPANY-PLACEHOLDER © COMPANY-PLACEHOLDER. All rights reserved. @@ -50,8 +51,7 @@ - - + $(PackageProjectUrl)/releases/tag/v$(Version) From 07df47ef04adb71c6d6a3e6bf8b560e5ff4c96db Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 22 Jan 2023 13:29:41 -0700 Subject: [PATCH 558/889] Bump Microsoft.CodeCoverage to 17.5.0-release-20230106-01 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 1acbd174..02f1d707 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From 7c9e1620b7af1570fb0b5ffb838efe1e94aa36f2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 27 Jan 2023 07:23:40 -0700 Subject: [PATCH 559/889] Bump MicroBuildVersion from 2.0.93 to 2.0.107 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 34bd522c..97ed7feb 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 2.0.93 + 2.0.107 From f7f6ed362751d7a3fd9d11026a0a42ec10e1cf0b Mon Sep 17 00:00:00 2001 From: Kartheek Penagamuri <52756182+kartheekp-ms@users.noreply.github.com> Date: Tue, 31 Jan 2023 17:32:49 -0800 Subject: [PATCH 560/889] Use latest NuGet.exe version (#188) * Use latest NuGet.exe version * Use 6.4.0 NuGet.exe version --- azure-pipelines/Get-NuGetTool.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/Get-NuGetTool.ps1 b/azure-pipelines/Get-NuGetTool.ps1 index 4431adb9..3097c873 100644 --- a/azure-pipelines/Get-NuGetTool.ps1 +++ b/azure-pipelines/Get-NuGetTool.ps1 @@ -6,7 +6,7 @@ #> Param( [Parameter()] - [string]$NuGetVersion='5.2.0' + [string]$NuGetVersion='6.4.0' ) $toolsPath = & "$PSScriptRoot\Get-TempToolsPath.ps1" From 4de45d4b12398d099da69b59a2a18dcb4782ba87 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Feb 2023 10:39:21 -0700 Subject: [PATCH 561/889] Bump Microsoft.CodeCoverage (#189) Bumps [Microsoft.CodeCoverage](https://github.com/microsoft/vstest) from 17.5.0-release-20230106-01 to 17.5.0-release-20230131-04. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/commits) --- updated-dependencies: - dependency-name: Microsoft.CodeCoverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 02f1d707..a46323fa 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From 2bf28739e8302b517e3be5c3747942cc4059ad57 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 1 Feb 2023 17:37:59 -0700 Subject: [PATCH 562/889] Fix working directory assumption made in init --- init.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.ps1 b/init.ps1 index 4a576ac2..3ea5f210 100755 --- a/init.ps1 +++ b/init.ps1 @@ -106,7 +106,7 @@ try { } } - $InstallNuGetPkgScriptPath = ".\azure-pipelines\Install-NuGetPackage.ps1" + $InstallNuGetPkgScriptPath = "$PSScriptRoot\azure-pipelines\Install-NuGetPackage.ps1" $nugetVerbosity = 'quiet' if ($Verbose) { $nugetVerbosity = 'normal' } $MicroBuildPackageSource = 'https://pkgs.dev.azure.com/devdiv/_packaging/MicroBuildToolset%40Local/nuget/v3/index.json' From eed2e31372eab822b4b920e6f702491595f3c17e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 2 Feb 2023 12:35:41 -0700 Subject: [PATCH 563/889] Skip generating the NOTICE file on PR builds NOTICE generation fails frequently due to throttling, so this will both help keep PRs going, and reduce the demand on the network resource. --- azure-pipelines/microbuild.before.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index a27cf36b..9320b1c2 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -7,6 +7,7 @@ steps: inputs: outputfile: $(System.DefaultWorkingDirectory)/obj/NOTICE outputformat: text + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - task: MicroBuildSigningPlugin@3 inputs: From f17518be33e4b76fafc8f4b3a6096aa00ca8ceb1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 9 Feb 2023 16:46:32 -0700 Subject: [PATCH 564/889] Update the dotnet-install.ps1 script This enables downloading newer SDK versions. --- tools/Install-DotNetSdk.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 2bac3b9b..a71ff3fd 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -234,10 +234,10 @@ if ($IncludeX86) { } if ($IsMacOS -or $IsLinux) { - $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/781752509a890ca7520f1182e8bae71f9a53d754/src/dotnet-install.sh" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/88bd34f089b8a023e3523f22c92abd0ab88e4409/src/dotnet-install.sh" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" } else { - $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/781752509a890ca7520f1182e8bae71f9a53d754/src/dotnet-install.ps1" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/88bd34f089b8a023e3523f22c92abd0ab88e4409/src/dotnet-install.ps1" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1" } From 551183c1e900d30e0e8b7623c910be160a690b4e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 9 Feb 2023 16:52:41 -0700 Subject: [PATCH 565/889] Improve error message for unsupported versions --- tools/Install-DotNetSdk.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index a71ff3fd..14f4c8c4 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -98,7 +98,12 @@ Function Get-InstallerExe( [string]$sku ) { # Get the latest/actual version for the specified one - $TypedVersion = [Version]$Version + $TypedVersion = $null + if (![Version]::TryParse($Version, [ref] $TypedVersion)) { + Write-Error "Unable to parse $Version into an a.b.c.d version. This version cannot be installed machine-wide." + exit 1 + } + if ($TypedVersion.Build -eq -1) { $versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sku/$Version/latest.version" -UseBasicParsing) $Version = $versionInfo[-1] From 8381192a53608e7a655dfaf4f58a6edf64f8fa76 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 9 Feb 2023 17:00:31 -0700 Subject: [PATCH 566/889] Remove references to "Core" in .NET Core --- tools/Install-DotNetSdk.ps1 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 14f4c8c4..47ccf22e 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -3,7 +3,7 @@ <# .SYNOPSIS Installs the .NET SDK specified in the global.json file at the root of this repository, - along with supporting .NET Core runtimes used for testing. + along with supporting .NET runtimes used for testing. .DESCRIPTION This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location, unless `-InstallLocality machine` is specified. @@ -43,7 +43,7 @@ if (!$arch) { # Windows Powershell leaves this blank if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { $arch = 'ARM64' } } -# Search for all .NET Core runtime versions referenced from MSBuild projects and arrange to install them. +# Search for all .NET runtime versions referenced from MSBuild projects and arrange to install them. $runtimeVersions = @() $windowsDesktopRuntimeVersions = @() Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$PSScriptRoot\..\Directory.Build.props" -Recurse |% { @@ -145,9 +145,9 @@ Function Get-InstallerExe( } Function Install-DotNet($Version, $Architecture, [ValidateSet('Sdk','Runtime','WindowsDesktop')][string]$sku = 'Sdk') { - Write-Host "Downloading .NET Core $sku $Version..." + Write-Host "Downloading .NET $sku $Version..." $Installer = Get-InstallerExe -Version $Version -Architecture $Architecture -sku $sku - Write-Host "Installing .NET Core $sku $Version..." + Write-Host "Installing .NET $sku $Version..." cmd /c start /wait $Installer /install /passive /norestart if ($LASTEXITCODE -eq 3010) { Write-Verbose "Restart required" @@ -290,7 +290,7 @@ if ($IncludeX86) { $dotnetRuntimeSwitches = $switches + '-Runtime','dotnet' $runtimeVersions | Sort-Object -Unique |% { - if ($PSCmdlet.ShouldProcess(".NET Core $Arch runtime $_", "Install")) { + if ($PSCmdlet.ShouldProcess(".NET $Arch runtime $_", "Install")) { $anythingInstalled = $true Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $dotnetRuntimeSwitches" @@ -303,7 +303,7 @@ $runtimeVersions | Sort-Object -Unique |% { } if ($IncludeX86) { - if ($PSCmdlet.ShouldProcess(".NET Core x86 runtime $_", "Install")) { + if ($PSCmdlet.ShouldProcess(".NET x86 runtime $_", "Install")) { $anythingInstalled = $true Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $dotnetRuntimeSwitches" @@ -320,7 +320,7 @@ $runtimeVersions | Sort-Object -Unique |% { $windowsDesktopRuntimeSwitches = $switches + '-Runtime','windowsdesktop' $windowsDesktopRuntimeVersions | Sort-Object -Unique |% { - if ($PSCmdlet.ShouldProcess(".NET Core WindowsDesktop $arch runtime $_", "Install")) { + if ($PSCmdlet.ShouldProcess(".NET WindowsDesktop $arch runtime $_", "Install")) { $anythingInstalled = $true Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $windowsDesktopRuntimeSwitches" @@ -333,7 +333,7 @@ $windowsDesktopRuntimeVersions | Sort-Object -Unique |% { } if ($IncludeX86) { - if ($PSCmdlet.ShouldProcess(".NET Core WindowsDesktop x86 runtime $_", "Install")) { + if ($PSCmdlet.ShouldProcess(".NET WindowsDesktop x86 runtime $_", "Install")) { $anythingInstalled = $true Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $windowsDesktopRuntimeSwitches" @@ -352,5 +352,5 @@ if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these } if ($anythingInstalled -and ($InstallLocality -ne 'machine') -and !$env:TF_BUILD -and !$env:GITHUB_ACTIONS) { - Write-Warning ".NET Core runtimes or SDKs were installed to a non-machine location. Perform your builds or open Visual Studio from this same environment in order for tools to discover the location of these dependencies." + Write-Warning ".NET runtimes or SDKs were installed to a non-machine location. Perform your builds or open Visual Studio from this same environment in order for tools to discover the location of these dependencies." } From d19033347c00cf09ef9201a6a4d25a19673d8de4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 9 Feb 2023 17:07:26 -0700 Subject: [PATCH 567/889] Add -SdkOnly switch --- tools/Install-DotNetSdk.ps1 | 53 ++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 47ccf22e..39e47eb6 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -15,6 +15,8 @@ When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. +.PARAMETER SdkOnly + Skips installing the runtime. .PARAMETER IncludeX86 Installs a x86 SDK and runtimes in addition to the x64 ones. Only supported on Windows. Ignored on others. #> @@ -22,6 +24,7 @@ Param ( [ValidateSet('repo','user','machine')] [string]$InstallLocality='user', + [switch]$SdkOnly, [switch]$IncludeX86 ) @@ -46,34 +49,36 @@ if (!$arch) { # Windows Powershell leaves this blank # Search for all .NET runtime versions referenced from MSBuild projects and arrange to install them. $runtimeVersions = @() $windowsDesktopRuntimeVersions = @() -Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$PSScriptRoot\..\Directory.Build.props" -Recurse |% { - $projXml = [xml](Get-Content -Path $_) - $pg = $projXml.Project.PropertyGroup - if ($pg) { - $targetFrameworks = @() - $tf = $pg.TargetFramework - $targetFrameworks += $tf - $tfs = $pg.TargetFrameworks - if ($tfs) { - $targetFrameworks = $tfs -Split ';' +if (!$SdkOnly) { + Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$PSScriptRoot\..\Directory.Build.props" -Recurse |% { + $projXml = [xml](Get-Content -Path $_) + $pg = $projXml.Project.PropertyGroup + if ($pg) { + $targetFrameworks = @() + $tf = $pg.TargetFramework + $targetFrameworks += $tf + $tfs = $pg.TargetFrameworks + if ($tfs) { + $targetFrameworks = $tfs -Split ';' + } } - } - $targetFrameworks |? { $_ -match 'net(?:coreapp)?(\d+\.\d+)' } |% { - $v = $Matches[1] - $runtimeVersions += $v - if ($v -ge '3.0' -and -not ($IsMacOS -or $IsLinux)) { - $windowsDesktopRuntimeVersions += $v + $targetFrameworks |? { $_ -match 'net(?:coreapp)?(\d+\.\d+)' } |% { + $v = $Matches[1] + $runtimeVersions += $v + if ($v -ge '3.0' -and -not ($IsMacOS -or $IsLinux)) { + $windowsDesktopRuntimeVersions += $v + } } - } - # Add target frameworks of the form: netXX - $targetFrameworks |? { $_ -match 'net(\d+\.\d+)' } |% { - $v = $Matches[1] - $runtimeVersions += $v - if (-not ($IsMacOS -or $IsLinux)) { - $windowsDesktopRuntimeVersions += $v + # Add target frameworks of the form: netXX + $targetFrameworks |? { $_ -match 'net(\d+\.\d+)' } |% { + $v = $Matches[1] + $runtimeVersions += $v + if (-not ($IsMacOS -or $IsLinux)) { + $windowsDesktopRuntimeVersions += $v + } } - } + } } Function Get-FileFromWeb([Uri]$Uri, $OutDir) { From dcd78387fdbb4176e69cf725bf51bea0cccfcadc Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 10 Feb 2023 12:45:25 -0700 Subject: [PATCH 568/889] Add emojis to insertion pipeline steps --- azure-pipelines/prepare-insertion-stages.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index a707454c..dcd1e6d8 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -9,17 +9,17 @@ stages: - checkout: none - download: current artifact: Variables-Windows - displayName: Download Variables-Windows artifact + displayName: 🔻 Download Variables-Windows artifact - task: PowerShell@2 - displayName: Set pipeline variables based on artifacts + displayName: ⚙️ Set pipeline variables based on artifacts inputs: targetType: filePath filePath: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 - download: current artifact: symbols-legacy - displayName: Download symbols-legacy artifact + displayName: 🔻 Download symbols-legacy artifact - task: MicroBuildArchiveSymbols@1 - displayName: Archive symbols to Symweb + displayName: 🔣 Archive symbols to Symweb inputs: SymbolsFeatureName: $(SymbolsFeatureName) SymbolsSymwebProject: VS @@ -27,7 +27,7 @@ stages: SymbolsEmailContacts: vsidemicrobuild SymbolsAgentPath: $(Pipeline.Workspace)/symbols-legacy - task: MicroBuildCleanup@1 - displayName: Send Telemetry + displayName: ☎️ Send Telemetry # - stage: azure_public_vsimpl_feed # displayName: azure-public/vs-impl feed @@ -41,16 +41,16 @@ stages: # - checkout: none # - download: current # artifact: deployables-Windows -# displayName: Download deployables-Windows artifact +# displayName: 🔻 Download deployables-Windows artifact # - task: UseDotNet@2 -# displayName: Install .NET SDK +# displayName: ⚙️ Install .NET SDK # inputs: # packageType: sdk # version: 6.x # - task: NuGetAuthenticate@1 -# displayName: Authenticate NuGet feeds +# displayName: 🔏 Authenticate NuGet feeds # inputs: # nuGetServiceConnections: azure-public/vs-impl # forceReinstallCredentialProvider: true # - script: dotnet nuget push $(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg -s https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json --api-key azdo --skip-duplicate -# displayName: Push nuget packages +# displayName: 📦 Push nuget packages From c01126d8e995b239a17341ecec2e85bd0e02129b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 13 Feb 2023 16:19:46 -0700 Subject: [PATCH 569/889] Simplify Version cast in ps1 script --- tools/Install-DotNetSdk.ps1 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 2bac3b9b..a8635f49 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -92,19 +92,18 @@ Function Get-FileFromWeb([Uri]$Uri, $OutDir) { } Function Get-InstallerExe( - $Version, + [Version]$Version, $Architecture, [ValidateSet('Sdk','Runtime','WindowsDesktop')] [string]$sku ) { # Get the latest/actual version for the specified one - $TypedVersion = [Version]$Version - if ($TypedVersion.Build -eq -1) { + if ($Version.Build -eq -1) { $versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sku/$Version/latest.version" -UseBasicParsing) $Version = $versionInfo[-1] } - $majorMinor = "$($TypedVersion.Major).$($TypedVersion.Minor)" + $majorMinor = "$($Version.Major).$($Version.Minor)" $ReleasesFile = Join-Path $DotNetInstallScriptRoot "$majorMinor\releases.json" if (!(Test-Path $ReleasesFile)) { Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/$majorMinor/releases.json" -OutDir (Split-Path $ReleasesFile) | Out-Null From 0fc6c4f57e3b180da230264669a3c24be17903e9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 15 Feb 2023 09:49:03 -0700 Subject: [PATCH 570/889] Add more emojis and use simpler powershell task syntax --- azure-pipelines/prepare-insertion-stages.yml | 5 +---- azure-pipelines/release-deployment-prep.yml | 9 +++----- azure-pipelines/vs-insertion.yml | 16 +++++++------- azure-pipelines/vs-validation.yml | 23 +++++++++----------- 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index dcd1e6d8..bb955d68 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -10,11 +10,8 @@ stages: - download: current artifact: Variables-Windows displayName: 🔻 Download Variables-Windows artifact - - task: PowerShell@2 + - powershell: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 displayName: ⚙️ Set pipeline variables based on artifacts - inputs: - targetType: filePath - filePath: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 - download: current artifact: symbols-legacy displayName: 🔻 Download symbols-legacy artifact diff --git a/azure-pipelines/release-deployment-prep.yml b/azure-pipelines/release-deployment-prep.yml index 059fd1d0..d9a9ffd3 100644 --- a/azure-pipelines/release-deployment-prep.yml +++ b/azure-pipelines/release-deployment-prep.yml @@ -1,9 +1,6 @@ steps: - download: CI artifact: Variables-Windows - displayName: Download Variables-Windows artifact -- task: PowerShell@2 - displayName: Set pipeline variables based on artifacts - inputs: - targetType: filePath - filePath: $(Pipeline.Workspace)/CI/Variables-Windows/_pipelines.ps1 + displayName: 🔻 Download Variables-Windows artifact +- powershell: $(Pipeline.Workspace)/CI/Variables-Windows/_pipelines.ps1 + displayName: ⚙️ Set pipeline variables based on artifacts diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 112dd92f..c7524559 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -19,24 +19,24 @@ jobs: steps: - checkout: none - powershell: Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" - displayName: Set pipeline name + displayName: ⚙️ Set pipeline name - task: UseDotNet@2 - displayName: Install .NET SDK + displayName: ⚙️ Install .NET SDK inputs: packageType: sdk version: 6.x - task: NuGetAuthenticate@1 - displayName: Authenticate NuGet feeds + displayName: 🔏 Authenticate NuGet feeds inputs: forceReinstallCredentialProvider: true - template: release-deployment-prep.yml - download: CI artifact: VSInsertion-Windows - displayName: Download VSInsertion-Windows artifact + displayName: 🔻 Download VSInsertion-Windows artifact - script: dotnet nuget push $(Pipeline.Workspace)\CI\VSInsertion-windows\*.nupkg -s https://pkgs.dev.azure.com/devdiv/_packaging/VS/nuget/v3/index.json -k azdo --skip-duplicate - displayName: Push CoreXT packages to VS feed + displayName: 📦 Push CoreXT packages to VS feed - task: MicroBuildInsertVsPayload@4 - displayName: Insert VS Payload + displayName: 🏭 Insert VS Payload inputs: TeamName: $(TeamName) TeamEmail: $(TeamEmail) @@ -45,7 +45,7 @@ jobs: AutoCompletePR: true AutoCompleteMergeStrategy: Squash - task: MicroBuildCleanup@1 - displayName: Send Telemetry + displayName: ☎️ Send Telemetry - powershell: | $contentType = 'application/json'; $headers = @{ Authorization = 'Bearer $(System.AccessToken)' }; @@ -54,4 +54,4 @@ jobs: Write-Host $request $uri = "$(System.CollectionUri)$(System.TeamProject)/_apis/build/retention/leases?api-version=6.0-preview.1"; Invoke-RestMethod -uri $uri -method POST -Headers $headers -ContentType $contentType -Body $request; - displayName: Retain inserted builds + displayName: 🗻 Retain inserted builds diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index 3cbc196e..82a82aa0 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -36,30 +36,27 @@ stages: clean: true fetchDepth: 1 - task: UseDotNet@2 - displayName: Install .NET SDK + displayName: ⚙️ Install .NET SDK inputs: packageType: sdk version: 6.x - task: NuGetAuthenticate@1 - displayName: Authenticate NuGet feeds + displayName: 🔏 Authenticate NuGet feeds inputs: forceReinstallCredentialProvider: true - download: current artifact: Variables-Windows - displayName: Download Variables-Windows artifact - - task: PowerShell@2 - displayName: Set pipeline variables based on artifacts - inputs: - targetType: filePath - filePath: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 + displayName: 🔻 Download Variables-Windows artifact + - powershell: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 + displayName: ⚙️ Set pipeline variables based on artifacts - download: current artifact: VSInsertion-Windows - displayName: Download VSInsertion-Windows artifact + displayName: 🔻 Download VSInsertion-Windows artifact - script: dotnet nuget push VSInsertion-windows\*.nupkg -s https://pkgs.dev.azure.com/devdiv/_packaging/VS/nuget/v3/index.json -k azdo --skip-duplicate - displayName: Push CoreXT packages to VS feed + displayName: 📦 Push CoreXT packages to VS feed workingDirectory: $(Pipeline.Workspace) - task: MicroBuildInsertVsPayload@4 - displayName: Insert VS Payload + displayName: 🏭 Insert VS Payload inputs: TeamName: $(TeamName) TeamEmail: $(TeamEmail) @@ -78,7 +75,7 @@ stages: Remember to Abandon and (if allowed) to Delete Source Branch on that insertion PR when validation is complete. "@ azure-pipelines/PostPRMessage.ps1 -AccessToken '$(System.AccessToken)' -Markdown $Markdown -Verbose - displayName: Comment on pull request + displayName: ✏️ Comment on pull request condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) - task: MicroBuildCleanup@1 - displayName: Send Telemetry + displayName: ☎️ Send Telemetry From b3a68a9e4a6c37996ef969a54ac059ab62eae3d2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 16 Feb 2023 13:02:03 -0700 Subject: [PATCH 571/889] Use LF line endings for plist files The mac tools that read these files are sticklers for LF endings. --- .gitattributes | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitattributes b/.gitattributes index c22a129e..1f35e683 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,6 +7,9 @@ *.sh eol=lf *.ps1 eol=lf +# The macOS codesign tool is extremely picky, and requires LF line endings. +*.plist eol=lf + ############################################################################### # Set default behavior for command prompt diff. # From b579c7cabdad15c7b0b86446309f5297bd71cbb4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 16 Feb 2023 13:04:55 -0700 Subject: [PATCH 572/889] Add `-interactive` switch to init.ps1 --- init.ps1 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/init.ps1 b/init.ps1 index 774ead58..ad3b4145 100755 --- a/init.ps1 +++ b/init.ps1 @@ -30,6 +30,8 @@ Skips the package restore step. .PARAMETER AccessToken An optional access token for authenticating to Azure Artifacts authenticated feeds. +.PARAMETER Interactive + Runs NuGet restore in interactive mode. This can turn authentication failures into authentication challenges. #> [CmdletBinding(SupportsShouldProcess = $true)] Param ( @@ -44,7 +46,9 @@ Param ( [Parameter()] [switch]$NoRestore, [Parameter()] - [string]$AccessToken + [string]$AccessToken, + [Parameter()] + [switch]$Interactive ) $EnvVars = @{} @@ -76,8 +80,14 @@ try { $HeaderColor = 'Green' if (!$NoRestore -and $PSCmdlet.ShouldProcess("NuGet packages", "Restore")) { + $RestoreArguments = @() + if ($Interactive) + { + $RestoreArguments += '--interactive' + } + Write-Host "Restoring NuGet packages" -ForegroundColor $HeaderColor - dotnet restore + dotnet restore @RestoreArguments if ($lastexitcode -ne 0) { throw "Failure while restoring packages." } From c6b825e9e71cc57c7275e81f8281cb74a1d41f57 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 22 Feb 2023 07:54:46 -0700 Subject: [PATCH 573/889] Bump MicroBuild to 2.0.112 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index ae621d84..e1bd2e7d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 2.0.107 + 2.0.112 From 8b342da2060fe53954b1630d00a6c02a2b923383 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 23 Feb 2023 15:12:36 -0700 Subject: [PATCH 574/889] Remove certain tasks on non-Windows agents --- azure-pipelines/microbuild.after.yml | 3 ++- azure-pipelines/microbuild.before.yml | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 4c3554ab..3dbbad9c 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -8,6 +8,7 @@ steps: inputs: TargetFolders: | $(Build.SourcesDirectory)/bin/Packages/$(BuildConfiguration)/NuGet + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - task: MicroBuildCleanup@1 condition: succeededOrFailed() @@ -23,7 +24,7 @@ steps: /repoName:$(Build.Repository.Name) /additionalCodexArguments:-bld /additionalCodexArguments:$(Build.ArtifactStagingDirectory)/build_logs - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables['Build.Reason'], 'PullRequest')) + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Agent.OS'], 'Windows_NT')) continueOnError: true - ${{ if eq(parameters.EnableCompliance, 'true') }}: diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index 9320b1c2..d048af4b 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -14,6 +14,8 @@ steps: signType: $(SignType) zipSources: false displayName: 🔧 Install MicroBuild Signing Plugin + condition: and(succeeded(), or(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['SignType'], 'real'))) - task: MicroBuildSbomPlugin@1 displayName: 🔧 Install MicroBuild Sbom Plugin + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) From 6415323a89947e6d5d2229cd606cb02d18c1c474 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 24 Feb 2023 13:07:15 -0700 Subject: [PATCH 575/889] Bump dependencies to 17.5.0 versions --- Directory.Packages.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index a46323fa..b792f3f6 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,8 +5,8 @@ true - - + + From 34f1344df70ea081e1875a83bf852c7bc4709954 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 27 Feb 2023 09:28:14 -0700 Subject: [PATCH 576/889] Add msbuild extension for VS Code --- .vscode/extensions.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 4ca01616..ca3a2aa9 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -11,7 +11,8 @@ "davidanson.vscode-markdownlint", "dotjoshjohnson.xml", "ms-vscode-remote.remote-containers", - "ms-azuretools.vscode-docker" + "ms-azuretools.vscode-docker", + "tintoy.msbuild-project-tools" ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [] From fb2395d9a7cc483f5f1a37a82b104fde93883b34 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 27 Feb 2023 09:46:58 -0700 Subject: [PATCH 577/889] Add dotnet CLI tools --- .config/dotnet-tools.json | 18 ++++++++++++++++++ init.ps1 | 5 +++++ 2 files changed, 23 insertions(+) create mode 100644 .config/dotnet-tools.json diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 00000000..2599e26a --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,18 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "powershell": { + "version": "7.3.3", + "commands": [ + "pwsh" + ] + }, + "dotnet-format": { + "version": "5.1.250801", + "commands": [ + "dotnet-format" + ] + } + } +} \ No newline at end of file diff --git a/init.ps1 b/init.ps1 index ad3b4145..5bace1e6 100755 --- a/init.ps1 +++ b/init.ps1 @@ -91,6 +91,11 @@ try { if ($lastexitcode -ne 0) { throw "Failure while restoring packages." } + + dotnet tool restore @RestoreArguments + if ($lastexitcode -ne 0) { + throw "Failure while restoring dotnet CLI tools." + } } & "$PSScriptRoot/tools/Set-EnvVars.ps1" -Variables $EnvVars -PrependPath $PrependPath | Out-Null From 0bfecd61cceeeb70cbe038c00fd8aac38b7ce32e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 27 Feb 2023 15:23:55 -0700 Subject: [PATCH 578/889] Drop test-tools as a nuget feed source We don't need it now that we're using stable Microsoft.CodeCoverage package versions. --- nuget.config | 9 --------- 1 file changed, 9 deletions(-) diff --git a/nuget.config b/nuget.config index 6ce7cfd0..22f7b809 100644 --- a/nuget.config +++ b/nuget.config @@ -7,18 +7,9 @@ - - - - - - - - - From 81fccf20e373f07d5ff6f94fb33334bb35bbea0f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 27 Feb 2023 15:44:04 -0700 Subject: [PATCH 579/889] Bump MicroBuild version --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 880aec41..a3769e31 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 2.0.112 + 2.0.113 From 3eb1436057301cf295b4a895fa2e2d5fe87339c1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 10 Mar 2023 08:32:03 -0700 Subject: [PATCH 580/889] Bump MicroBuildVersion to 2.0.115 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index a3769e31..62d2ccc0 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 2.0.113 + 2.0.115 From 5132c2206f248cc3ff0e65c0a087a74b6d734d77 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 11 Mar 2023 16:30:55 -0700 Subject: [PATCH 581/889] Add ASP.NET Core runtime installation support --- tools/Install-DotNetSdk.ps1 | 59 ++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 39e47eb6..6bff5c27 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -19,13 +19,16 @@ Skips installing the runtime. .PARAMETER IncludeX86 Installs a x86 SDK and runtimes in addition to the x64 ones. Only supported on Windows. Ignored on others. +.PARAMETER IncludeAspNetCore + Installs the ASP.NET Core runtime along with the .NET runtime. #> [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] Param ( [ValidateSet('repo','user','machine')] [string]$InstallLocality='user', [switch]$SdkOnly, - [switch]$IncludeX86 + [switch]$IncludeX86, + [switch]$IncludeAspNetCore ) $DotNetInstallScriptRoot = "$PSScriptRoot/../obj/tools" @@ -49,6 +52,7 @@ if (!$arch) { # Windows Powershell leaves this blank # Search for all .NET runtime versions referenced from MSBuild projects and arrange to install them. $runtimeVersions = @() $windowsDesktopRuntimeVersions = @() +$aspnetRuntimeVersions = @() if (!$SdkOnly) { Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$PSScriptRoot\..\Directory.Build.props" -Recurse |% { $projXml = [xml](Get-Content -Path $_) @@ -65,6 +69,7 @@ if (!$SdkOnly) { $targetFrameworks |? { $_ -match 'net(?:coreapp)?(\d+\.\d+)' } |% { $v = $Matches[1] $runtimeVersions += $v + $aspnetRuntimeVersions += $v if ($v -ge '3.0' -and -not ($IsMacOS -or $IsLinux)) { $windowsDesktopRuntimeVersions += $v } @@ -74,6 +79,7 @@ if (!$SdkOnly) { $targetFrameworks |? { $_ -match 'net(\d+\.\d+)' } |% { $v = $Matches[1] $runtimeVersions += $v + $aspnetRuntimeVersions += $v if (-not ($IsMacOS -or $IsLinux)) { $windowsDesktopRuntimeVersions += $v } @@ -81,6 +87,10 @@ if (!$SdkOnly) { } } +if (!$IncludeAspNetCore) { + $aspnetRuntimeVersions = @() +} + Function Get-FileFromWeb([Uri]$Uri, $OutDir) { $OutFile = Join-Path $OutDir $Uri.Segments[-1] if (!(Test-Path $OutFile)) { @@ -149,7 +159,7 @@ Function Get-InstallerExe( } } -Function Install-DotNet($Version, $Architecture, [ValidateSet('Sdk','Runtime','WindowsDesktop')][string]$sku = 'Sdk') { +Function Install-DotNet($Version, $Architecture, [ValidateSet('Sdk','Runtime','WindowsDesktop','AspNetCore')][string]$sku = 'Sdk') { Write-Host "Downloading .NET $sku $Version..." $Installer = Get-InstallerExe -Version $Version -Architecture $Architecture -sku $sku Write-Host "Installing .NET $sku $Version..." @@ -206,6 +216,17 @@ if ($InstallLocality -eq 'machine') { } } + $aspnetRuntimeVersions | Sort-Object | Get-Unique |% { + if ($PSCmdlet.ShouldProcess("ASP.NET Core $_", "Install")) { + Install-DotNet -Version $_ -sku AspNetCore -Architecture $arch + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + + if ($IncludeX86) { + Install-DotNet -Version $_ -sku AspNetCore -Architecture x86 + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + } + } + } if ($restartRequired) { Write-Host -ForegroundColor Yellow "System restart required" Exit 3010 @@ -244,10 +265,10 @@ if ($IncludeX86) { } if ($IsMacOS -or $IsLinux) { - $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/88bd34f089b8a023e3523f22c92abd0ab88e4409/src/dotnet-install.sh" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/0b09de9bc136cacb5f849a6957ebd4062173c148/src/dotnet-install.sh" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" } else { - $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/88bd34f089b8a023e3523f22c92abd0ab88e4409/src/dotnet-install.ps1" + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/0b09de9bc136cacb5f849a6957ebd4062173c148/src/dotnet-install.ps1" $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1" } @@ -352,6 +373,36 @@ $windowsDesktopRuntimeVersions | Sort-Object -Unique |% { } } +$aspnetRuntimeSwitches = $switches + '-Runtime','aspnetcore' + +$aspnetRuntimeVersions | Sort-Object -Unique |% { + if ($PSCmdlet.ShouldProcess(".NET ASP.NET Core $arch runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $aspnetRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $aspnetRuntimeSwitches -DryRun" + } + + if ($IncludeX86) { + if ($PSCmdlet.ShouldProcess(".NET ASP.NET Core x86 runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $aspnetRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $aspnetRuntimeSwitches -DryRun" + } + } +} + if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these installed runtimes?")) { & "$PSScriptRoot/Set-EnvVars.ps1" -Variables $envVars -PrependPath $DotNetInstallDir | Out-Null } From a921f8dcaf0ba4f93dfec660f503d17ce19d58ea Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 11 Mar 2023 16:40:50 -0700 Subject: [PATCH 582/889] Drop Microsoft.CodeCoverage reference It's brought in via Microsoft.NET.Test.Sdk anyway. --- Directory.Packages.props | 1 - test/Library.Tests/Library.Tests.csproj | 1 - 2 files changed, 2 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index b792f3f6..b523e5c6 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,6 @@ true - diff --git a/test/Library.Tests/Library.Tests.csproj b/test/Library.Tests/Library.Tests.csproj index d557e4c7..3a6cc044 100644 --- a/test/Library.Tests/Library.Tests.csproj +++ b/test/Library.Tests/Library.Tests.csproj @@ -10,7 +10,6 @@ - From ea48c8eaa182f224ca3ed1a38f2a8034d15dacce Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 13 Mar 2023 15:27:56 -0600 Subject: [PATCH 583/889] Updated SDK installer script to be able to find 7.0.200 --- tools/Install-DotNetSdk.ps1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 6bff5c27..10af5041 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -137,6 +137,14 @@ Function Get-InstallerExe( if ($release.$sku.version -eq $Version) { $filesElement = $release.$sku.files } + if (!$filesElement -and ($sku -eq 'sdk') -and $release.sdks) { + foreach ($sdk in $release.sdks) { + if ($sdk.version -eq $Version) { + $filesElement = $sdk.files + break + } + } + } if ($filesElement) { foreach ($file in $filesElement) { @@ -155,7 +163,7 @@ Function Get-InstallerExe( if ($url) { Get-FileFromWeb -Uri $url -OutDir $DotNetInstallScriptRoot } else { - Write-Error "Unable to find release of $sku v$Version" + throw "Unable to find release of $sku v$Version" } } From 2987b4457b0242e91913e9d9f4b43b5db079fd50 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 13 Mar 2023 15:31:46 -0600 Subject: [PATCH 584/889] Bump SDK version to 7.0.201 --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index cc08211e..cf9eefa6 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.101", + "version": "7.0.201", "rollForward": "patch", "allowPrerelease": false } From b47983de022de491725e8e9d4a27bb90166b9947 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 16 Mar 2023 08:28:44 -0600 Subject: [PATCH 585/889] Update MicroBuild signing plugin version --- azure-pipelines/microbuild.before.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index d048af4b..c933df23 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -9,7 +9,7 @@ steps: outputformat: text condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) -- task: MicroBuildSigningPlugin@3 +- task: MicroBuildSigningPlugin@4 inputs: signType: $(SignType) zipSources: false From 99df8185b1a6aa6abb1cc98aa7f4c0245f8d9012 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 28 Mar 2023 15:53:46 -0600 Subject: [PATCH 586/889] Move `dotnet-coverage` to repo-level tool --- .config/dotnet-tools.json | 8 ++++- azure-pipelines/Merge-CodeCoverage.ps1 | 46 +++++++++++++------------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 2599e26a..610b59c9 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -13,6 +13,12 @@ "commands": [ "dotnet-format" ] + }, + "dotnet-coverage": { + "version": "17.6.11", + "commands": [ + "dotnet-coverage" + ] } } -} \ No newline at end of file +} diff --git a/azure-pipelines/Merge-CodeCoverage.ps1 b/azure-pipelines/Merge-CodeCoverage.ps1 index 02ff12b0..5ecabbc9 100644 --- a/azure-pipelines/Merge-CodeCoverage.ps1 +++ b/azure-pipelines/Merge-CodeCoverage.ps1 @@ -20,32 +20,32 @@ Param( ) $RepoRoot = [string](Resolve-Path $PSScriptRoot/..) - -if (!(Test-Path $RepoRoot/obj/dotnet-coverage*)) { - dotnet tool install --tool-path $RepoRoot/obj dotnet-coverage --version 17.4.3 --configfile $PSScriptRoot/justnugetorg.nuget.config -} - -Write-Verbose "Searching $Path for *.cobertura.xml files" -$reports = Get-ChildItem -Recurse $Path -Filter *.cobertura.xml - -if ($reports) { - $reports |% { $_.FullName } |% { - # In addition to replacing {reporoot}, we also normalize on one kind of slash so that the report aggregates data for a file whether data was collected on Windows or not. - $xml = [xml](Get-Content -Path $_) - $xml.coverage.packages.package.classes.class |? { $_.filename} |% { - $_.filename = $_.filename.Replace('{reporoot}', $RepoRoot).Replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar) +Push-Location $RepoRoot +try { + Write-Verbose "Searching $Path for *.cobertura.xml files" + $reports = Get-ChildItem -Recurse $Path -Filter *.cobertura.xml + + if ($reports) { + $reports |% { $_.FullName } |% { + # In addition to replacing {reporoot}, we also normalize on one kind of slash so that the report aggregates data for a file whether data was collected on Windows or not. + $xml = [xml](Get-Content -Path $_) + $xml.coverage.packages.package.classes.class |? { $_.filename} |% { + $_.filename = $_.filename.Replace('{reporoot}', $RepoRoot).Replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar) + } + + $xml.Save($_) } - $xml.Save($_) - } + $Inputs = $reports |% { Resolve-Path -relative $_.FullName } - $Inputs = $reports |% { Resolve-Path -relative $_.FullName } + if ((Split-Path $OutputFile) -and -not (Test-Path (Split-Path $OutputFile))) { + New-Item -Type Directory -Path (Split-Path $OutputFile) | Out-Null + } - if ((Split-Path $OutputFile) -and -not (Test-Path (Split-Path $OutputFile))) { - New-Item -Type Directory -Path (Split-Path $OutputFile) | Out-Null + & dotnet tool run dotnet-coverage merge $Inputs -o $OutputFile -f cobertura + } else { + Write-Error "No reports found to merge." } - - & "$RepoRoot/obj/dotnet-coverage" merge $Inputs -o $OutputFile -f cobertura -} else { - Write-Error "No reports found to merge." +} finally { + Pop-Location } From 14699417fbde409397e7efec56c1b33268ed3634 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 28 Mar 2023 15:58:33 -0600 Subject: [PATCH 587/889] Move `nbgv` into dotnet-tools.json --- .config/dotnet-tools.json | 6 ++++++ azure-pipelines/Get-nbgv.ps1 | 24 ------------------------ azure-pipelines/build.yml | 2 +- 3 files changed, 7 insertions(+), 25 deletions(-) delete mode 100644 azure-pipelines/Get-nbgv.ps1 diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 610b59c9..5d3dae87 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -19,6 +19,12 @@ "commands": [ "dotnet-coverage" ] + }, + "nbgv": { + "version": "3.5.119", + "commands": [ + "nbgv" + ] } } } diff --git a/azure-pipelines/Get-nbgv.ps1 b/azure-pipelines/Get-nbgv.ps1 deleted file mode 100644 index a5be2cf7..00000000 --- a/azure-pipelines/Get-nbgv.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -<# -.SYNOPSIS - Gets the path to the nbgv CLI tool, installing it if necessary. -#> -Param( -) - -$existingTool = Get-Command "nbgv" -ErrorAction SilentlyContinue -if ($existingTool) { - return $existingTool.Path -} - -$toolInstallDir = & "$PSScriptRoot/Get-TempToolsPath.ps1" - -$toolPath = "$toolInstallDir/nbgv" -if (!(Test-Path $toolInstallDir)) { New-Item -Path $toolInstallDir -ItemType Directory | Out-Null } - -if (!(Get-Command $toolPath -ErrorAction SilentlyContinue)) { - Write-Host "Installing nbgv to $toolInstallDir" - dotnet tool install --tool-path "$toolInstallDir" nbgv --configfile "$PSScriptRoot/justnugetorg.nuget.config" | Out-Null -} - -# Normalize the path on the way out. -return (Get-Command $toolPath).Path diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index c8687859..2e2f426e 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -17,7 +17,7 @@ jobs: clean: true - template: install-dependencies.yml - - powershell: '& (./azure-pipelines/Get-nbgv.ps1) cloud -c' + - script: dotnet tool run nbgv cloud -c displayName: ⚙ Set build number - template: dotnet.yml From 3f1e85823fac9136c058aaf48f4b8febed1d0843 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 28 Mar 2023 16:34:38 -0600 Subject: [PATCH 588/889] Install tools except when `-NoToolRestore` is specified --- init.ps1 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/init.ps1 b/init.ps1 index 5bace1e6..6211304f 100755 --- a/init.ps1 +++ b/init.ps1 @@ -28,6 +28,8 @@ No effect if -NoPrerequisites is specified. .PARAMETER NoRestore Skips the package restore step. +.PARAMETER NoToolRestore + Skips the dotnet tool restore step. .PARAMETER AccessToken An optional access token for authenticating to Azure Artifacts authenticated feeds. .PARAMETER Interactive @@ -46,6 +48,8 @@ Param ( [Parameter()] [switch]$NoRestore, [Parameter()] + [switch]$NoToolRestore, + [Parameter()] [string]$AccessToken, [Parameter()] [switch]$Interactive @@ -91,11 +95,13 @@ try { if ($lastexitcode -ne 0) { throw "Failure while restoring packages." } + } - dotnet tool restore @RestoreArguments - if ($lastexitcode -ne 0) { - throw "Failure while restoring dotnet CLI tools." - } + if (!$NoToolRestore -and $PSCmdlet.ShouldProcess("dotnet tool", "restore")) { + dotnet tool restore @RestoreArguments + if ($lastexitcode -ne 0) { + throw "Failure while restoring dotnet CLI tools." + } } & "$PSScriptRoot/tools/Set-EnvVars.ps1" -Variables $EnvVars -PrependPath $PrependPath | Out-Null From 8ba38742fdc439b8ff55cac69b1e2e0ccd8f0cf5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 3 Apr 2023 13:41:57 -0600 Subject: [PATCH 589/889] Remove Get-NBGV.ps1 references --- azure-pipelines/Archive-SourceCode.ps1 | 2 +- azure-pipelines/archive-sourcecode.yml | 2 ++ azure-pipelines/variables/InsertVersionsValues.ps1 | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/Archive-SourceCode.ps1 b/azure-pipelines/Archive-SourceCode.ps1 index cfc30d2d..0fec3e9b 100644 --- a/azure-pipelines/Archive-SourceCode.ps1 +++ b/azure-pipelines/Archive-SourceCode.ps1 @@ -155,7 +155,7 @@ if (!$RepoUrl) { } Push-Location $PSScriptRoot -$versionsObj = & (& "$PSScriptRoot/Get-nbgv.ps1") get-version -f json | ConvertFrom-Json +$versionsObj = dotnet tool run nbgv get-version -f json | ConvertFrom-Json Pop-Location $ReleaseDateString = $ReleaseDate.ToShortDateString() diff --git a/azure-pipelines/archive-sourcecode.yml b/azure-pipelines/archive-sourcecode.yml index 0c99a236..33705a93 100644 --- a/azure-pipelines/archive-sourcecode.yml +++ b/azure-pipelines/archive-sourcecode.yml @@ -34,6 +34,8 @@ steps: fetchDepth: 0 - powershell: tools/Install-DotNetSdk.ps1 displayName: ⚙ Install .NET SDK +- script: dotnet tool restore + displayName: Restore CLI tools - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true displayName: ⚙ Set pipeline variables based on source diff --git a/azure-pipelines/variables/InsertVersionsValues.ps1 b/azure-pipelines/variables/InsertVersionsValues.ps1 index 515e0571..c3a03559 100644 --- a/azure-pipelines/variables/InsertVersionsValues.ps1 +++ b/azure-pipelines/variables/InsertVersionsValues.ps1 @@ -4,7 +4,6 @@ # your libraries as defined in the src\ProductData\AssemblyVersions.tt file. return -$nbgv = & "$PSScriptRoot\..\Get-nbgv.ps1" [string]::join(',',(@{ - ('LibraryNoDotsVersion') = & { (& $nbgv get-version --project "$PSScriptRoot\..\..\src\LibraryName" --format json | ConvertFrom-Json).AssemblyVersion }; + ('LibraryNoDotsVersion') = & { (dotnet tool run nbgv get-version --project "$PSScriptRoot\..\..\src\LibraryName" --format json | ConvertFrom-Json).AssemblyVersion }; }.GetEnumerator() |% { "$($_.key)=$($_.value)" })) From 2381c7276720eb8084c1006baf16e6ac6aae2c9a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 14 Apr 2023 20:54:34 -0600 Subject: [PATCH 590/889] Fix ARM64 detection on Windows Powershell --- tools/Install-DotNetSdk.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 index 10af5041..e190fcfb 100644 --- a/tools/Install-DotNetSdk.ps1 +++ b/tools/Install-DotNetSdk.ps1 @@ -47,6 +47,7 @@ $arch = [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture if (!$arch) { # Windows Powershell leaves this blank $arch = 'x64' if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { $arch = 'ARM64' } + if (${env:ProgramFiles(Arm)}) { $arch = 'ARM64' } } # Search for all .NET runtime versions referenced from MSBuild projects and arrange to install them. From b3e9f4ee3722b395ea4e3cdae74e812b9884d8aa Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 16 Apr 2023 07:29:40 -0600 Subject: [PATCH 591/889] Bump up SDK and tools versions --- .config/dotnet-tools.json | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 5d3dae87..151689b6 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "powershell": { - "version": "7.3.3", + "version": "7.3.4", "commands": [ "pwsh" ] @@ -15,7 +15,7 @@ ] }, "dotnet-coverage": { - "version": "17.6.11", + "version": "17.7.0", "commands": [ "dotnet-coverage" ] diff --git a/global.json b/global.json index cf9eefa6..c7d7e468 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.201", + "version": "7.0.203", "rollForward": "patch", "allowPrerelease": false } From 05b6c17376c6da127a9b887b2d9a6263717098c1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 17 Apr 2023 12:13:34 -0600 Subject: [PATCH 592/889] Skip symbol archival and checks for val-builds --- azure-pipelines/prepare-insertion-stages.yml | 58 +++++++++++--------- azure-pipelines/vs-validation.yml | 4 +- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index bb955d68..ed6b19c2 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -1,30 +1,36 @@ +parameters: +- name: ArchiveSymbols + type: boolean + default: true + stages: -- stage: symbol_archive - displayName: Symbol archival - condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) - jobs: - - job: archive - pool: VSEng-ReleasePool-1ES - steps: - - checkout: none - - download: current - artifact: Variables-Windows - displayName: 🔻 Download Variables-Windows artifact - - powershell: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 - displayName: ⚙️ Set pipeline variables based on artifacts - - download: current - artifact: symbols-legacy - displayName: 🔻 Download symbols-legacy artifact - - task: MicroBuildArchiveSymbols@1 - displayName: 🔣 Archive symbols to Symweb - inputs: - SymbolsFeatureName: $(SymbolsFeatureName) - SymbolsSymwebProject: VS - SymbolsUncPath: \\cpvsbuild\drops\$(TeamName)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildId)\Symbols.Archival - SymbolsEmailContacts: vsidemicrobuild - SymbolsAgentPath: $(Pipeline.Workspace)/symbols-legacy - - task: MicroBuildCleanup@1 - displayName: ☎️ Send Telemetry +- ${{ if parameters.ArchiveSymbols }}: + - stage: symbol_archive + displayName: Symbol archival + condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) + jobs: + - job: archive + pool: VSEng-ReleasePool-1ES + steps: + - checkout: none + - download: current + artifact: Variables-Windows + displayName: 🔻 Download Variables-Windows artifact + - powershell: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 + displayName: ⚙️ Set pipeline variables based on artifacts + - download: current + artifact: symbols-legacy + displayName: 🔻 Download symbols-legacy artifact + - task: MicroBuildArchiveSymbols@1 + displayName: 🔣 Archive symbols to Symweb + inputs: + SymbolsFeatureName: $(SymbolsFeatureName) + SymbolsSymwebProject: VS + SymbolsUncPath: \\cpvsbuild\drops\$(TeamName)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildId)\Symbols.Archival + SymbolsEmailContacts: vsidemicrobuild + SymbolsAgentPath: $(Pipeline.Workspace)/symbols-legacy + - task: MicroBuildCleanup@1 + displayName: ☎️ Send Telemetry # - stage: azure_public_vsimpl_feed # displayName: azure-public/vs-impl feed diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index 82a82aa0..d32634c7 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -24,6 +24,8 @@ stages: RunTests: false - template: prepare-insertion-stages.yml + parameters: + ArchiveSymbols: false - stage: insertion displayName: VS insertion @@ -60,7 +62,7 @@ stages: inputs: TeamName: $(TeamName) TeamEmail: $(TeamEmail) - InsertionPayloadName: $(Build.Repository.Name) VALIDATION BUILD $(Build.BuildNumber) ($(Build.SourceBranch)) + InsertionPayloadName: $(Build.Repository.Name) VALIDATION BUILD $(Build.BuildNumber) ($(Build.SourceBranch)) [Skip-SymbolCheck] InsertionDescription: | This PR is for **validation purposes only** for !$(System.PullRequest.PullRequestId). **Do not complete**. CustomScriptExecutionCommand: src/VSSDK/NuGet/AllowUnstablePackages.ps1 From 0c36c87330bb89a4b39d69703263dc14f10831ab Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 17 Apr 2023 12:13:59 -0600 Subject: [PATCH 593/889] Copy the .config file when applying the template --- Apply-Template.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/Apply-Template.ps1 b/Apply-Template.ps1 index 12bfaa12..1c773355 100644 --- a/Apply-Template.ps1 +++ b/Apply-Template.ps1 @@ -31,6 +31,7 @@ try { Write-Host "Updating $Path" robocopy /mir $PSScriptRoot/azure-pipelines $Path/azure-pipelines +robocopy /mir $PSScriptRoot/.config $Path/.config robocopy /mir $PSScriptRoot/.devcontainer $Path/.devcontainer robocopy /mir $PSScriptRoot/.github $Path/.github robocopy /mir $PSScriptRoot/.vscode $Path/.vscode From 591d64ee9e9fbe3311308d3c57cdb80f66353086 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 25 Apr 2023 09:50:33 -0600 Subject: [PATCH 594/889] Upgrade `actions/checkout` GitHub action to v3 This resolves a warning about old node.js version based github actions. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7718f84a..3fc278de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,7 @@ jobs: - windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - name: ⚙ Install prerequisites From 30cf33841a0e98dd1901643cb3a5dce277c30a99 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 25 Apr 2023 10:14:19 -0600 Subject: [PATCH 595/889] Fix source archival pipeline nuget auth failures --- azure-pipelines/archive-sourcecode.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azure-pipelines/archive-sourcecode.yml b/azure-pipelines/archive-sourcecode.yml index 33705a93..d9e79441 100644 --- a/azure-pipelines/archive-sourcecode.yml +++ b/azure-pipelines/archive-sourcecode.yml @@ -34,6 +34,10 @@ steps: fetchDepth: 0 - powershell: tools/Install-DotNetSdk.ps1 displayName: ⚙ Install .NET SDK +- task: NuGetAuthenticate@1 + displayName: 🔏 Authenticate NuGet feeds + inputs: + forceReinstallCredentialProvider: true - script: dotnet tool restore displayName: Restore CLI tools - powershell: azure-pipelines/variables/_pipelines.ps1 From 1afa3e42190709e07ef276b076897335e0c87451 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 26 Apr 2023 10:28:56 -0600 Subject: [PATCH 596/889] Fix and simplify BinSkim --- azure-pipelines/archive-sourcecode.yml | 2 +- azure-pipelines/secure-development-tools.yml | 21 +++++++++++--------- azure-pipelines/variables/BinSkimTargets.ps1 | 4 ---- 3 files changed, 13 insertions(+), 14 deletions(-) delete mode 100644 azure-pipelines/variables/BinSkimTargets.ps1 diff --git a/azure-pipelines/archive-sourcecode.yml b/azure-pipelines/archive-sourcecode.yml index d9e79441..db270eb9 100644 --- a/azure-pipelines/archive-sourcecode.yml +++ b/azure-pipelines/archive-sourcecode.yml @@ -39,7 +39,7 @@ steps: inputs: forceReinstallCredentialProvider: true - script: dotnet tool restore - displayName: Restore CLI tools + displayName: ⚙️ Restore CLI tools - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true displayName: ⚙ Set pipeline variables based on source diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index ac540aea..0ca483da 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -16,25 +16,28 @@ steps: targetArgument: $(System.DefaultWorkingDirectory) optionsUEPATH: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml -- task: BinSkim@4 - displayName: 🔍 Run BinSkim - inputs: - InputType: Basic - Function: analyze - TargetPattern: guardianGlob - AnalyzeTargetGlob: $(BinSkimTargets) - - task: CopyFiles@2 - displayName: 🔍 Collect APIScan inputs + displayName: 📂 Collect APIScan/BinSkim inputs inputs: SourceFolder: $(Build.ArtifactStagingDirectory)/Symbols-$(Agent.JobName) # Exclude any patterns from the Contents (e.g. `!**/git2*`) that we have symbols for but do not need to run APIScan on. Contents: | ** !**/arm64/** + !**/win-arm64/** + !**/linux-*/** + !**/osx*/** TargetFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs condition: and(succeeded(), ${{ parameters.EnableAPIScan }}, ne(variables.ApiScanClientId, '')) +- task: BinSkim@4 + displayName: 🔍 Run BinSkim + inputs: + InputType: Basic + Function: analyze + TargetPattern: guardianGlob + AnalyzeTargetGlob: $(Build.ArtifactStagingDirectory)/APIScanInputs/**/*.dll;$(Build.ArtifactStagingDirectory)/APIScanInputs/**/*.exe + - task: APIScan@2 displayName: 🔍 Run APIScan inputs: diff --git a/azure-pipelines/variables/BinSkimTargets.ps1 b/azure-pipelines/variables/BinSkimTargets.ps1 deleted file mode 100644 index 723b28ce..00000000 --- a/azure-pipelines/variables/BinSkimTargets.ps1 +++ /dev/null @@ -1,4 +0,0 @@ -$Path = "$PSScriptRoot\..\..\bin" -if (Test-Path $Path) { - [string]::join(';', (& "$PSScriptRoot\..\Get-SymbolFiles.ps1" -Path $Path)) -} From e45848775d23805e530d9e0475307afc936a6d24 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 29 Apr 2023 12:04:57 -0600 Subject: [PATCH 597/889] Elevate CA1062 for shipping code --- .editorconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.editorconfig b/.editorconfig index 07868777..fce73c07 100644 --- a/.editorconfig +++ b/.editorconfig @@ -176,5 +176,8 @@ dotnet_diagnostic.DOC108.severity = warning dotnet_diagnostic.DOC200.severity = warning dotnet_diagnostic.DOC202.severity = warning +# CA1062: Validate arguments of public methods +dotnet_diagnostic.CA1062.severity = warning + [*.sln] indent_style = tab From c3c23f7e91194f845d8df92755edb6803f6cea47 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 1 May 2023 08:10:45 -0600 Subject: [PATCH 598/889] Bump Nerdbank.GitVersioning to 3.6.128 --- .config/dotnet-tools.json | 2 +- Directory.Packages.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 151689b6..54fc5886 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -21,7 +21,7 @@ ] }, "nbgv": { - "version": "3.5.119", + "version": "3.6.128", "commands": [ "nbgv" ] diff --git a/Directory.Packages.props b/Directory.Packages.props index b523e5c6..5758824b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -12,7 +12,7 @@ - + From dfcf3754d53d0a959c97c14fbfd8696177273aaa Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 1 May 2023 09:40:39 -0600 Subject: [PATCH 599/889] Bump MicroBuild version --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index fc9f6c67..8e2703df 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 2.0.115 + 2.0.117 From e90465acd44c421921f48cca04fc4c7e73dd7034 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 1 May 2023 22:48:46 -0600 Subject: [PATCH 600/889] Update Dockerfile --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 7ffd07ef..01c94a90 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions -FROM mcr.microsoft.com/dotnet/sdk:7.0.101-jammy +FROM mcr.microsoft.com/dotnet/sdk:7.0.203-jammy # Installing mono makes `dotnet test` work without errors even for net472. # But installing it takes a long time, so it's excluded by default. From 46b4f565e380906d043528f2442c0cb1591f585c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 2 May 2023 07:41:53 -0600 Subject: [PATCH 601/889] Fix placement of $RestoreArguments construction --- init.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/init.ps1 b/init.ps1 index 6211304f..00a9589b 100755 --- a/init.ps1 +++ b/init.ps1 @@ -83,13 +83,13 @@ Push-Location $PSScriptRoot try { $HeaderColor = 'Green' - if (!$NoRestore -and $PSCmdlet.ShouldProcess("NuGet packages", "Restore")) { - $RestoreArguments = @() - if ($Interactive) - { - $RestoreArguments += '--interactive' - } + $RestoreArguments = @() + if ($Interactive) + { + $RestoreArguments += '--interactive' + } + if (!$NoRestore -and $PSCmdlet.ShouldProcess("NuGet packages", "Restore")) { Write-Host "Restoring NuGet packages" -ForegroundColor $HeaderColor dotnet restore @RestoreArguments if ($lastexitcode -ne 0) { From 4d4c330486ea2fe98d9ae70ed1c05fb5bba31c92 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 11 May 2023 08:51:17 -0600 Subject: [PATCH 602/889] Switch from `MSBuildTreatWarningsAsErrors` to `-warnaserror` This is per @rainersigwald's suggestion in https://github.com/dotnet/msbuild/issues/8735#issuecomment-1544076504 --- .github/workflows/build.yml | 3 +-- azure-pipelines.yml | 1 - azure-pipelines/dotnet.yml | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3fc278de..33502820 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,6 @@ on: pull_request: env: - MSBuildTreatWarningsAsErrors: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BUILDCONFIGURATION: Release # codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ @@ -44,7 +43,7 @@ jobs: run: azure-pipelines/variables/_pipelines.ps1 shell: pwsh - name: 🛠 build - run: dotnet build -t:build,pack --no-restore -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog" + run: dotnet build -t:build,pack --no-restore -c ${{ env.BUILDCONFIGURATION }} -warnaserror /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog" - name: 🧪 test run: azure-pipelines/dotnet-test-cloud.ps1 -Configuration ${{ env.BUILDCONFIGURATION }} -Agent ${{ runner.os }} shell: pwsh diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 521d4ce6..9867b3db 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -23,7 +23,6 @@ parameters: default: true variables: - MSBuildTreatWarningsAsErrors: true DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 79babd4d..51241549 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -3,7 +3,7 @@ parameters: steps: -- script: dotnet build -t:build,pack --no-restore -c $(BuildConfiguration) /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" +- script: dotnet build -t:build,pack --no-restore -c $(BuildConfiguration) -warnaserror /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" displayName: 🛠 dotnet build - powershell: azure-pipelines/dotnet-test-cloud.ps1 -Configuration $(BuildConfiguration) -Agent $(Agent.JobName) -PublishResults From c84fe06b9701ea6ac7b6bebed8a6f5f0064c9561 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 17 May 2023 07:04:10 -0600 Subject: [PATCH 603/889] Fix BinSkim when ApiScan won't run --- azure-pipelines/secure-development-tools.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index 0ca483da..ce8ac94c 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -28,7 +28,6 @@ steps: !**/linux-*/** !**/osx*/** TargetFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs - condition: and(succeeded(), ${{ parameters.EnableAPIScan }}, ne(variables.ApiScanClientId, '')) - task: BinSkim@4 displayName: 🔍 Run BinSkim From aefd199847243c1e0a6a8224db00ccb25a5bc9e0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 17 May 2023 10:56:28 -0600 Subject: [PATCH 604/889] Bump .NET SDK to 7.0.302 --- .devcontainer/Dockerfile | 2 +- global.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 01c94a90..6d2f30da 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions -FROM mcr.microsoft.com/dotnet/sdk:7.0.203-jammy +FROM mcr.microsoft.com/dotnet/sdk:7.0.302-jammy # Installing mono makes `dotnet test` work without errors even for net472. # But installing it takes a long time, so it's excluded by default. diff --git a/global.json b/global.json index c7d7e468..abde95a8 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.203", + "version": "7.0.302", "rollForward": "patch", "allowPrerelease": false } From 4406d85960e468f19f0868991757aae74fbf7224 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 18 May 2023 06:23:33 -0600 Subject: [PATCH 605/889] Parameterize and add diagnostics to InsertVersionsValues.ps1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's been failing ever since switching from `Get-Nbgv.ps1` to `dotnet tool run nbgv`, but only on Azure Pipelines, and only on certain commits. Quite literally, it fails repeatedly on some particular commit, and if I push a new *empty* commit, it succeeds. This makes me believe that somehow, the git database or git commit id itself or something is causing `nbgv` to fail. I have no idea why it would fail with this output though: ``` Computing InsertVersionsValues variable Option '--project' expects a single argument but 2 were provided. ConvertFrom-Json: /home/vsts/work/1/s/azure-pipelines/variables/InsertVersionsValues.ps1:2 Line | 2 | … oft.VisualStudio.Validation" --format json | ConvertFrom-Json).Assemb … | ~~~~~~~~~~~~~~~~ | Conversion from JSON failed with error: Unexpected character encountered | while parsing value: D. Path '', line 0, position 0. ``` The output suggests a malformed command line, but I simply see no possible way for that to happen. Nor can I repro it locally. --- .../variables/InsertVersionsValues.ps1 | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/variables/InsertVersionsValues.ps1 b/azure-pipelines/variables/InsertVersionsValues.ps1 index c3a03559..9bc7bc83 100644 --- a/azure-pipelines/variables/InsertVersionsValues.ps1 +++ b/azure-pipelines/variables/InsertVersionsValues.ps1 @@ -4,6 +4,30 @@ # your libraries as defined in the src\ProductData\AssemblyVersions.tt file. return -[string]::join(',',(@{ - ('LibraryNoDotsVersion') = & { (dotnet tool run nbgv get-version --project "$PSScriptRoot\..\..\src\LibraryName" --format json | ConvertFrom-Json).AssemblyVersion }; -}.GetEnumerator() |% { "$($_.key)=$($_.value)" })) +$MacroName = 'LibraryNoDotsVersion' +$SampleProject = "$PSScriptRoot\..\..\src\LibraryName" +try { + return [string]::join(',',(@{ + ($MacroName) = & { (dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion }; + }.GetEnumerator() |% { "$($_.key)=$($_.value)" })) +} +catch { + Write-Error $_ + Write-Error "Failed. Diagnostic data proceeds:" + [string]::join(',',(@{ + ($MacroName) = & { + Write-Host "dotnet tool run nbgv get-version --project `"$SampleProject`" --format json" + $result1 = dotnet tool run nbgv get-version --project $SampleProject --format json + Write-Host $result1 + $result2 = dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json + Write-Host $result2 + Write-Host $result2.AssemblyVersion + Write-Host (dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion + Write-Output (dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion + }; + }.GetEnumerator() |% { "$($_.key)=$($_.value)" })) + + Write-Host "one more..." + $r = & { (dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion }; + Write-Host $r +} From b33fad3f1fab1559e672d4cacb92d763568a9bd3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 May 2023 13:32:53 -0600 Subject: [PATCH 606/889] Fix schedule triggered source code archival --- azure-pipelines/Archive-SourceCode.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/Archive-SourceCode.ps1 b/azure-pipelines/Archive-SourceCode.ps1 index 0fec3e9b..9158c9b3 100644 --- a/azure-pipelines/Archive-SourceCode.ps1 +++ b/azure-pipelines/Archive-SourceCode.ps1 @@ -135,7 +135,7 @@ if (!$Requester) { $Requester = $env:USERNAME } if (!$Requester) { - Write-Error "Unable to determine default value for -Requester." + $Requester = $OwnerAlias } } From 8f6c4d6ba6875dc382b4ad7ea148c7871e3e7cc4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 May 2023 16:38:05 -0600 Subject: [PATCH 607/889] Upgrade archive symbols task to v4 --- azure-pipelines/prepare-insertion-stages.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index ed6b19c2..e194ff44 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -10,7 +10,7 @@ stages: condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) jobs: - job: archive - pool: VSEng-ReleasePool-1ES + pool: VSEngSS-MicroBuild2022-1ES steps: - checkout: none - download: current @@ -21,14 +21,13 @@ stages: - download: current artifact: symbols-legacy displayName: 🔻 Download symbols-legacy artifact - - task: MicroBuildArchiveSymbols@1 + - task: MicroBuildArchiveSymbols@4 displayName: 🔣 Archive symbols to Symweb inputs: SymbolsFeatureName: $(SymbolsFeatureName) - SymbolsSymwebProject: VS - SymbolsUncPath: \\cpvsbuild\drops\$(TeamName)\$(Build.DefinitionName)\$(Build.SourceBranchName)\$(Build.BuildId)\Symbols.Archival - SymbolsEmailContacts: vsidemicrobuild + SymbolsProject: VS SymbolsAgentPath: $(Pipeline.Workspace)/symbols-legacy + azureSubscription: Symbols Upload (DevDiv) - task: MicroBuildCleanup@1 displayName: ☎️ Send Telemetry From b46d049fc37c9d0537ddb9b2b8653d2de8c88e14 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 19 May 2023 16:40:50 -0600 Subject: [PATCH 608/889] Consolidate two stages to just one --- azure-pipelines/prepare-insertion-stages.yml | 60 ++++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index e194ff44..bb3a400c 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -4,12 +4,13 @@ parameters: default: true stages: -- ${{ if parameters.ArchiveSymbols }}: - - stage: symbol_archive - displayName: Symbol archival - condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) - jobs: - - job: archive +- stage: release + displayName: Publish + condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) + jobs: + - ${{ if parameters.ArchiveSymbols }}: + - job: symbol_archive + displayName: Archive symbols pool: VSEngSS-MicroBuild2022-1ES steps: - checkout: none @@ -31,28 +32,27 @@ stages: - task: MicroBuildCleanup@1 displayName: ☎️ Send Telemetry -# - stage: azure_public_vsimpl_feed +# - job: push # displayName: azure-public/vs-impl feed -# condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) -# jobs: -# - job: push -# pool: -# name: AzurePipelines-EO -# vmImage: AzurePipelinesUbuntu20.04compliant -# steps: -# - checkout: none -# - download: current -# artifact: deployables-Windows -# displayName: 🔻 Download deployables-Windows artifact -# - task: UseDotNet@2 -# displayName: ⚙️ Install .NET SDK -# inputs: -# packageType: sdk -# version: 6.x -# - task: NuGetAuthenticate@1 -# displayName: 🔏 Authenticate NuGet feeds -# inputs: -# nuGetServiceConnections: azure-public/vs-impl -# forceReinstallCredentialProvider: true -# - script: dotnet nuget push $(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg -s https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json --api-key azdo --skip-duplicate -# displayName: 📦 Push nuget packages +# ${{ if parameters.ArchiveSymbols }}: +# dependsOn: symbol_archive +# pool: +# name: AzurePipelines-EO +# vmImage: AzurePipelinesUbuntu20.04compliant +# steps: +# - checkout: none +# - download: current +# artifact: deployables-Windows +# displayName: 🔻 Download deployables-Windows artifact +# - task: UseDotNet@2 +# displayName: ⚙️ Install .NET SDK +# inputs: +# packageType: sdk +# version: 6.x +# - task: NuGetAuthenticate@1 +# displayName: 🔏 Authenticate NuGet feeds +# inputs: +# nuGetServiceConnections: azure-public/vs-impl +# forceReinstallCredentialProvider: true +# - script: dotnet nuget push $(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg -s https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json --api-key azdo --skip-duplicate +# displayName: 📦 Push nuget packages From 354b522a12ab85fd819356484a63e7cf38ae2579 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 20 May 2023 13:25:55 -0600 Subject: [PATCH 609/889] Bump NB.GV to 3.6.132 --- .config/dotnet-tools.json | 2 +- Directory.Packages.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 54fc5886..93547faf 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -21,7 +21,7 @@ ] }, "nbgv": { - "version": "3.6.128", + "version": "3.6.132", "commands": [ "nbgv" ] diff --git a/Directory.Packages.props b/Directory.Packages.props index 5758824b..7cf54cc1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -12,7 +12,7 @@ - + From 4f2a6d8391ae5f2b9a577bd3c3bbb03a201a4ff8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 20 May 2023 13:28:47 -0600 Subject: [PATCH 610/889] Bump CSharpIsNullAnalyzer from 0.1.329 to 0.1.495 (#204) * Crank up dependabot * Bump CSharpIsNullAnalyzer from 0.1.329 to 0.1.495 Bumps [CSharpIsNullAnalyzer](https://github.com/AArnott/CSharpIsNull) from 0.1.329 to 0.1.495. - [Release notes](https://github.com/AArnott/CSharpIsNull/releases) - [Commits](https://github.com/AArnott/CSharpIsNull/commits) --- updated-dependencies: - dependency-name: CSharpIsNullAnalyzer dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: Andrew Arnott Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/dependabot.yml | 4 ++-- Directory.Packages.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b9b0f54a..63e3e890 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,9 +1,9 @@ # Please see the documentation for all configuration options: -# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file version: 2 updates: - package-ecosystem: nuget directory: / schedule: - interval: monthly + interval: weekly diff --git a/Directory.Packages.props b/Directory.Packages.props index 7cf54cc1..74916ca2 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -10,7 +10,7 @@ - + From 119ce0770abc0ad1a3b8bdab3ca622470579ec92 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 20 May 2023 13:29:01 -0600 Subject: [PATCH 611/889] Bump Microsoft.NET.Test.Sdk from 17.5.0 to 17.6.0 (#202) * Crank up dependabot * Bump Microsoft.NET.Test.Sdk from 17.5.0 to 17.6.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.5.0 to 17.6.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.5.0...v17.6.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: Andrew Arnott Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 74916ca2..061f8ed4 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From 0991fe932a245d50f30ebab193a3cd50dc520939 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 20 May 2023 13:29:13 -0600 Subject: [PATCH 612/889] Bump dotnet-coverage from 17.7.0 to 17.7.1 (#205) * Crank up dependabot * Bump dotnet-coverage from 17.7.0 to 17.7.1 Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.7.0 to 17.7.1. - [Commits](https://github.com/microsoft/codecoverage/commits) --- updated-dependencies: - dependency-name: dotnet-coverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: Andrew Arnott Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 93547faf..5ed46cc1 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "dotnet-coverage": { - "version": "17.7.0", + "version": "17.7.1", "commands": [ "dotnet-coverage" ] From 2e6a2d1c2f93069381266ae7e49a4a4e6bf43b8c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 22 May 2023 08:31:09 -0600 Subject: [PATCH 613/889] (Hopefully) fix `nbgv` failures with `--` argument separator I believe `dotnet tool run` may be stealing the `--project` parameter non-deterministically (perhaps due to string hashing inputs that change in every process). By adding `--` in front of all parameters for the `nbgv` tool, I believe and hope this will resolve the issue by forcing the command line parser to interpret all subsequent command line arguments to be directed to `nbgv`. --- .../variables/InsertVersionsValues.ps1 | 28 ++----------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/azure-pipelines/variables/InsertVersionsValues.ps1 b/azure-pipelines/variables/InsertVersionsValues.ps1 index 9bc7bc83..2eb2fcea 100644 --- a/azure-pipelines/variables/InsertVersionsValues.ps1 +++ b/azure-pipelines/variables/InsertVersionsValues.ps1 @@ -6,28 +6,6 @@ return $MacroName = 'LibraryNoDotsVersion' $SampleProject = "$PSScriptRoot\..\..\src\LibraryName" -try { - return [string]::join(',',(@{ - ($MacroName) = & { (dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion }; - }.GetEnumerator() |% { "$($_.key)=$($_.value)" })) -} -catch { - Write-Error $_ - Write-Error "Failed. Diagnostic data proceeds:" - [string]::join(',',(@{ - ($MacroName) = & { - Write-Host "dotnet tool run nbgv get-version --project `"$SampleProject`" --format json" - $result1 = dotnet tool run nbgv get-version --project $SampleProject --format json - Write-Host $result1 - $result2 = dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json - Write-Host $result2 - Write-Host $result2.AssemblyVersion - Write-Host (dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion - Write-Output (dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion - }; - }.GetEnumerator() |% { "$($_.key)=$($_.value)" })) - - Write-Host "one more..." - $r = & { (dotnet tool run nbgv get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion }; - Write-Host $r -} +[string]::join(',',(@{ + ($MacroName) = & { (dotnet tool run nbgv -- get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion }; +}.GetEnumerator() |% { "$($_.key)=$($_.value)" })) From 6ed5201ef0c74f14f07fa87b3ff1db64187fab2f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 22 May 2023 08:43:08 -0600 Subject: [PATCH 614/889] Fix indentation of commented section --- azure-pipelines/prepare-insertion-stages.yml | 48 ++++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index bb3a400c..a41be032 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -32,27 +32,27 @@ stages: - task: MicroBuildCleanup@1 displayName: ☎️ Send Telemetry -# - job: push -# displayName: azure-public/vs-impl feed -# ${{ if parameters.ArchiveSymbols }}: -# dependsOn: symbol_archive -# pool: -# name: AzurePipelines-EO -# vmImage: AzurePipelinesUbuntu20.04compliant -# steps: -# - checkout: none -# - download: current -# artifact: deployables-Windows -# displayName: 🔻 Download deployables-Windows artifact -# - task: UseDotNet@2 -# displayName: ⚙️ Install .NET SDK -# inputs: -# packageType: sdk -# version: 6.x -# - task: NuGetAuthenticate@1 -# displayName: 🔏 Authenticate NuGet feeds -# inputs: -# nuGetServiceConnections: azure-public/vs-impl -# forceReinstallCredentialProvider: true -# - script: dotnet nuget push $(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg -s https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json --api-key azdo --skip-duplicate -# displayName: 📦 Push nuget packages + # - job: push + # displayName: azure-public/vs-impl feed + # ${{ if parameters.ArchiveSymbols }}: + # dependsOn: symbol_archive + # pool: + # name: AzurePipelines-EO + # vmImage: AzurePipelinesUbuntu20.04compliant + # steps: + # - checkout: none + # - download: current + # artifact: deployables-Windows + # displayName: 🔻 Download deployables-Windows artifact + # - task: UseDotNet@2 + # displayName: ⚙️ Install .NET SDK + # inputs: + # packageType: sdk + # version: 6.x + # - task: NuGetAuthenticate@1 + # displayName: 🔏 Authenticate NuGet feeds + # inputs: + # nuGetServiceConnections: azure-public/vs-impl + # forceReinstallCredentialProvider: true + # - script: dotnet nuget push $(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg -s https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json --api-key azdo --skip-duplicate + # displayName: 📦 Push nuget packages From e50278a744ac29ee6f066b9406d2933c898f3eea Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 27 May 2023 07:48:43 -0600 Subject: [PATCH 615/889] Bump Nerdbank.GitVersioning to 3.6.133 --- .config/dotnet-tools.json | 2 +- Directory.Packages.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 5ed46cc1..fa4ceb59 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -21,7 +21,7 @@ ] }, "nbgv": { - "version": "3.6.132", + "version": "3.6.133", "commands": [ "nbgv" ] diff --git a/Directory.Packages.props b/Directory.Packages.props index 061f8ed4..738a2f99 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -12,7 +12,7 @@ - + From 1579bbaf76e95e700c4aef5311fd5aefc0dd2e18 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 5 Jun 2023 07:21:57 -0600 Subject: [PATCH 616/889] Bump Microsoft.NET.Test.Sdk to 17.6.1 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 738a2f99..386c6eec 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From 0ba0030cbccba29085cb85cfec8702596645a62b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 7 Jun 2023 14:30:51 -0600 Subject: [PATCH 617/889] Enable dependabot for Azure Repos --- .azuredevops/dependabot.yml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .azuredevops/dependabot.yml diff --git a/.azuredevops/dependabot.yml b/.azuredevops/dependabot.yml new file mode 100644 index 00000000..4d848fb5 --- /dev/null +++ b/.azuredevops/dependabot.yml @@ -0,0 +1,9 @@ +# Please see the documentation for all configuration options: +# https://eng.ms/docs/products/dependabot/configuration/version_updates + +version: 2 +updates: +- package-ecosystem: nuget + directory: / + schedule: + interval: monthly From e22efe97b08fa4795d834d7e16310143195345d6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 7 Jun 2023 15:52:58 -0600 Subject: [PATCH 618/889] Bump Microsoft.NET.Test.Sdk to 17.6.2 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 386c6eec..1de33284 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From b077dd9451c6676f9a9a0ad9cda0bee636e49c67 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 12 Jun 2023 08:31:07 -0600 Subject: [PATCH 619/889] Bump MicroBuild to 2.0.125 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 2fe653ee..7c07eff1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 2.0.117 + 2.0.125 From 5a7ce31fa8a9a4aba53bc853529bc7bf308e9111 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 13 Jun 2023 14:17:25 -0600 Subject: [PATCH 620/889] Fix symbol file selection for R2R outputs --- azure-pipelines/Get-SymbolFiles.ps1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/Get-SymbolFiles.ps1 b/azure-pipelines/Get-SymbolFiles.ps1 index 0ce229fc..b5063cec 100644 --- a/azure-pipelines/Get-SymbolFiles.ps1 +++ b/azure-pipelines/Get-SymbolFiles.ps1 @@ -43,8 +43,13 @@ $PDBs |% { } } |% { # Collect the DLLs/EXEs as well. - $dllPath = "$($_.Directory)/$($_.BaseName).dll" - $exePath = "$($_.Directory)/$($_.BaseName).exe" + $rootName = "$($_.Directory)/$($_.BaseName)" + if ($rootName.EndsWith('.ni')) { + $rootName = $rootName.Substring(0, $rootName.Length - 3) + } + + $dllPath = "$rootName.dll" + $exePath = "$rootName.exe" if (Test-Path $dllPath) { $BinaryImagePath = $dllPath } elseif (Test-Path $exePath) { From 0913be2eddc4012c3a3c4eac5b7a4e2d427a2b35 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 14 Jun 2023 07:39:46 -0600 Subject: [PATCH 621/889] Simplify `nbgv` invocation in ps1 scripts This is another attempt to address the mysterious instability. --- azure-pipelines/Archive-SourceCode.ps1 | 2 +- azure-pipelines/Merge-CodeCoverage.ps1 | 2 +- azure-pipelines/variables/InsertVersionsValues.ps1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/Archive-SourceCode.ps1 b/azure-pipelines/Archive-SourceCode.ps1 index 9158c9b3..e44dad00 100644 --- a/azure-pipelines/Archive-SourceCode.ps1 +++ b/azure-pipelines/Archive-SourceCode.ps1 @@ -155,7 +155,7 @@ if (!$RepoUrl) { } Push-Location $PSScriptRoot -$versionsObj = dotnet tool run nbgv get-version -f json | ConvertFrom-Json +$versionsObj = dotnet nbgv get-version -f json | ConvertFrom-Json Pop-Location $ReleaseDateString = $ReleaseDate.ToShortDateString() diff --git a/azure-pipelines/Merge-CodeCoverage.ps1 b/azure-pipelines/Merge-CodeCoverage.ps1 index 5ecabbc9..b126268c 100644 --- a/azure-pipelines/Merge-CodeCoverage.ps1 +++ b/azure-pipelines/Merge-CodeCoverage.ps1 @@ -42,7 +42,7 @@ try { New-Item -Type Directory -Path (Split-Path $OutputFile) | Out-Null } - & dotnet tool run dotnet-coverage merge $Inputs -o $OutputFile -f cobertura + & dotnet dotnet-coverage merge $Inputs -o $OutputFile -f cobertura } else { Write-Error "No reports found to merge." } diff --git a/azure-pipelines/variables/InsertVersionsValues.ps1 b/azure-pipelines/variables/InsertVersionsValues.ps1 index 2eb2fcea..7475f6be 100644 --- a/azure-pipelines/variables/InsertVersionsValues.ps1 +++ b/azure-pipelines/variables/InsertVersionsValues.ps1 @@ -7,5 +7,5 @@ return $MacroName = 'LibraryNoDotsVersion' $SampleProject = "$PSScriptRoot\..\..\src\LibraryName" [string]::join(',',(@{ - ($MacroName) = & { (dotnet tool run nbgv -- get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion }; + ($MacroName) = & { (dotnet nbgv get-version --project $SampleProject --format json | ConvertFrom-Json).AssemblyVersion }; }.GetEnumerator() |% { "$($_.key)=$($_.value)" })) From 3ea9ad353e5975832ef7952f1298ff099e03a7d9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 14 Jun 2023 13:23:29 -0600 Subject: [PATCH 622/889] Skip compliance checks by default for build.yml But it's still on by default for official builds. --- azure-pipelines/build.yml | 4 ++-- azure-pipelines/vs-validation.yml | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 2a50cea9..59d9a987 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -9,10 +9,10 @@ parameters: default: true - name: EnableCompliance type: boolean - default: true + default: false - name: EnableAPIScan type: boolean - default: true + default: false jobs: - job: Windows diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index d32634c7..cb9a2072 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -17,8 +17,6 @@ stages: jobs: - template: build.yml parameters: - EnableCompliance: false - EnableAPIScan: false windowsPool: VSEngSS-MicroBuild2022-1ES includeMacOS: false RunTests: false From 9109dfc1add45b5367ecbcb3c540098f0d4d61d0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 19 Jun 2023 15:40:05 -0600 Subject: [PATCH 623/889] Bump MicroBuild to 2.0.127 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 76b8ab2a..230fe810 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 2.0.125 + 2.0.127 From 18710500489c2cac5d146411be32e3fc8bf79a9e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 19 Jun 2023 15:41:52 -0600 Subject: [PATCH 624/889] Bump dotnet-coverage to 17.7.2 --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index fa4ceb59..a8478486 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "dotnet-coverage": { - "version": "17.7.1", + "version": "17.7.2", "commands": [ "dotnet-coverage" ] From ba056964139aaa2ede6ce37019e1b9f2073c7484 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 17:10:49 -0600 Subject: [PATCH 625/889] Bump StyleCop.Analyzers.Unstable from 1.2.0.435 to 1.2.0.507 (#207) Bumps [StyleCop.Analyzers.Unstable](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) from 1.2.0.435 to 1.2.0.507. - [Release notes](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/releases) - [Changelog](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/KnownChanges.md) - [Commits](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/commits) --- updated-dependencies: - dependency-name: StyleCop.Analyzers.Unstable dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 1de33284..6942b31e 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -14,7 +14,7 @@ - + From 03de5e6821c5b280fcd006eb240486a0df519b49 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 17:10:58 -0600 Subject: [PATCH 626/889] Bump dotnet-coverage from 17.7.2 to 17.7.3 (#208) Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.7.2 to 17.7.3. - [Commits](https://github.com/microsoft/codecoverage/commits) --- updated-dependencies: - dependency-name: dotnet-coverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index a8478486..97074464 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "dotnet-coverage": { - "version": "17.7.2", + "version": "17.7.3", "commands": [ "dotnet-coverage" ] From 2822cf0ca631c2b69a9b01a2f347b61756c86904 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 27 Jun 2023 15:36:49 -0600 Subject: [PATCH 627/889] Bump MicroBuildVersion to 2.0.130 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 6fe0d352..8ce96a8f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 2.0.127 + 2.0.130 From 71f5f3617c3e64c99c0613c700bf227da2af37e6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 28 Jun 2023 06:57:44 -0600 Subject: [PATCH 628/889] Bump Microsoft.NET.Test.Sdk to 17.6.3 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 6942b31e..c15928be 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From 88e70184a887b05249cb829b8cefcca1b834b342 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 28 Jun 2023 07:01:02 -0600 Subject: [PATCH 629/889] Bump powershell to 7.3.5 --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 97074464..e344d8b0 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "powershell": { - "version": "7.3.4", + "version": "7.3.5", "commands": [ "pwsh" ] From b0f343dba369555ef366435a8c7e9181fe98ea88 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 28 Jun 2023 09:06:47 -0600 Subject: [PATCH 630/889] Automatically include a README.md from the project directory --- src/Directory.Build.props | 8 ++++++++ src/Library/Library.csproj | 4 ---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 052fe3ef..5be1dd44 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,3 +1,11 @@ + + + README.md + + + + + diff --git a/src/Library/Library.csproj b/src/Library/Library.csproj index b6b926ab..50aff997 100644 --- a/src/Library/Library.csproj +++ b/src/Library/Library.csproj @@ -1,9 +1,5 @@ net6.0;netstandard2.0 - README.md - - - From 7d92b4ab86281d8f041d79c1b01018c98a211286 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 15:02:28 -0600 Subject: [PATCH 631/889] Bump xunit.runner.visualstudio from 2.4.5 to 2.5.0 (#210) Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.4.5 to 2.5.0. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/v2.4.5...2.5.0) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index c15928be..3ac312f9 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,7 @@ - + From 4822f178831d771c1d28288703651b687e22f593 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 10 Jul 2023 15:07:54 -0600 Subject: [PATCH 632/889] Bump MicroBuildVersion to 2.0.131 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 250a08a5..e5884284 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 2.0.130 + 2.0.131 From 2e19c89761d8d7f934250f4effca22136c48cf39 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 21:08:52 +0000 Subject: [PATCH 633/889] Bump xunit from 2.4.2 to 2.5.0 (#209) --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 3ac312f9..6af95c88 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ - + From 75b0953f6e91e66076030f20fa0bc4a2990ad906 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 10 Jul 2023 15:25:18 -0600 Subject: [PATCH 634/889] Remove `tool run` from `dotnet nbgv` invocation I have an Azure Pipeline where `InsertVersionsValues.ps1` (in the microbuild branch) works but this step fails, and the only difference is that one omits `tool run` from `dotnet nbgv`. I continue to believe this is a bug in the `dotnet tool` command. --- azure-pipelines/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 2e2f426e..9c445f72 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -17,7 +17,7 @@ jobs: clean: true - template: install-dependencies.yml - - script: dotnet tool run nbgv cloud -c + - script: dotnet nbgv cloud -c displayName: ⚙ Set build number - template: dotnet.yml From 442ca7c6e521a55a39351b9ef3a3b81207fa4ef5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 10 Jul 2023 16:12:43 -0600 Subject: [PATCH 635/889] Dependabot to ignore dotnet-format --- .github/dependabot.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 63e3e890..484f2bfc 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,3 +7,7 @@ updates: directory: / schedule: interval: weekly + ignore: + # This package has unlisted versions on nuget.org that are not supported. Avoid them. + - dependency-name: dotnet-format + versions: ["6.x", "7.x", "8.x"] From b379933ef3581bd4904e883d92ebcd72a018a321 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 10 Jul 2023 19:46:17 -0600 Subject: [PATCH 636/889] Set tab settings for .ps1 files --- .editorconfig | 4 ++++ .vscode/settings.json | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index fce73c07..959801c2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -32,6 +32,10 @@ indent_size = 2 indent_size = 2 indent_style = space +[*.ps1] +indent_style = space +indent_size = 4 + # Dotnet code style settings: [*.{cs,vb}] # Sort using and Import directives with System.* appearing first diff --git a/.vscode/settings.json b/.vscode/settings.json index 3ae1371c..54c5c689 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,6 +3,6 @@ "files.insertFinalNewline": true, "files.trimFinalNewlines": true, "omnisharp.enableEditorConfigSupport": true, - "omnisharp.enableImportCompletion": true, - "omnisharp.enableRoslynAnalyzers": true + "omnisharp.enableRoslynAnalyzers": true, + "dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true } From 0f7accdd5ed39690633bba7a7f9f83f3caf0b970 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 07:37:40 -0600 Subject: [PATCH 637/889] Bump powershell from 7.3.5 to 7.3.6 (#212) Bumps [powershell](https://github.com/PowerShell/PowerShell) from 7.3.5 to 7.3.6. - [Release notes](https://github.com/PowerShell/PowerShell/releases) - [Commits](https://github.com/PowerShell/PowerShell/compare/v7.3.5...v7.3.6) --- updated-dependencies: - dependency-name: powershell dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index e344d8b0..f8713e90 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "powershell": { - "version": "7.3.5", + "version": "7.3.6", "commands": [ "pwsh" ] From 05a925a4be9598efcffce2fdd7fb3135d5f7f8be Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 07:38:14 -0600 Subject: [PATCH 638/889] Bump dotnet-coverage from 17.7.3 to 17.8.0 (#211) Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.7.3 to 17.8.0. - [Commits](https://github.com/microsoft/codecoverage/commits) --- updated-dependencies: - dependency-name: dotnet-coverage dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index f8713e90..05b6b5bb 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "dotnet-coverage": { - "version": "17.7.3", + "version": "17.8.0", "commands": [ "dotnet-coverage" ] From 0cc89db1dda3f9c7a436bea77e903f17baf7a989 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sat, 22 Jul 2023 11:14:58 -0600 Subject: [PATCH 639/889] Bump dotnet-coverage to 17.8.2 --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 05b6b5bb..a20f90b9 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "dotnet-coverage": { - "version": "17.8.0", + "version": "17.8.2", "commands": [ "dotnet-coverage" ] From 5c6330dc1ad8a1a4406915d4cfaa2defb08ebeea Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 24 Jul 2023 09:22:56 -0600 Subject: [PATCH 640/889] Bump MicroBuild version to 2.0.134 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 7d021ab8..fa07578d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 2.0.131 + 2.0.134 From 2651c692388aa2e27213c7b89959de56b81f1ecb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Aug 2023 10:09:53 -0600 Subject: [PATCH 641/889] Bump Microsoft.NET.Test.Sdk from 17.6.3 to 17.7.0 (#213) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.6.3 to 17.7.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.6.3...v17.7.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 6af95c88..58a5a265 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From 492d96f3c3c136ba9a504a4524ca8616df222779 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 11 Aug 2023 08:15:54 -0600 Subject: [PATCH 642/889] Bump Microbuild version to 2.0.137 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index fa07578d..fb6c9c8f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 2.0.134 + 2.0.137 From 821514da53b285a41ce1188f98dcb94faaacadff Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 17 Aug 2023 15:51:51 -0600 Subject: [PATCH 643/889] Tolerate NOTICE file task network failures --- azure-pipelines/microbuild.before.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index c933df23..adb5ccc8 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -8,6 +8,7 @@ steps: outputfile: $(System.DefaultWorkingDirectory)/obj/NOTICE outputformat: text condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + retryCountOnTaskFailure: 3 # fails when the cloud service is overloaded - task: MicroBuildSigningPlugin@4 inputs: From f764c84caec60eff9579c03ce16db43b142c2d74 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Aug 2023 09:15:30 -0600 Subject: [PATCH 644/889] Bump Microsoft.NET.Test.Sdk from 17.7.0 to 17.7.1 (#214) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.7.0 to 17.7.1. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.7.0...v17.7.1) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 58a5a265..8d540894 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From 05f9dd77512332bdd8a312db97bd07d26084b935 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Aug 2023 15:18:33 +0000 Subject: [PATCH 645/889] Bump dotnet-coverage from 17.8.2 to 17.8.4 (#215) Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.8.2 to 17.8.4. - [Commits](https://github.com/microsoft/codecoverage/commits) --- updated-dependencies: - dependency-name: dotnet-coverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index a20f90b9..2b62ebce 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "dotnet-coverage": { - "version": "17.8.2", + "version": "17.8.4", "commands": [ "dotnet-coverage" ] From c8abc41f0afd07c570d13d6ac41134da00485d91 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 31 Aug 2023 10:41:26 -0600 Subject: [PATCH 646/889] Align YAML indentation more consistently --- .github/dependabot.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 484f2bfc..a0e8933b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,6 +8,6 @@ updates: schedule: interval: weekly ignore: - # This package has unlisted versions on nuget.org that are not supported. Avoid them. - - dependency-name: dotnet-format - versions: ["6.x", "7.x", "8.x"] + # This package has unlisted versions on nuget.org that are not supported. Avoid them. + - dependency-name: dotnet-format + versions: ["6.x", "7.x", "8.x"] From 295313bfbc59d3c6fe8fa4c9e5f080d86d236f95 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 31 Aug 2023 11:27:21 -0600 Subject: [PATCH 647/889] Bump Microsoft.NET.Test.Sdk from 17.7.1 to 17.7.2 (#218) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.7.1 to 17.7.2. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.7.1...v17.7.2) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 8d540894..76d18e0d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From 0a35e80ec55441fc0c10d2ea68cd03e6b4c64004 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 5 Sep 2023 15:31:49 -0600 Subject: [PATCH 648/889] Fix typo in comment --- src/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 5be1dd44..5e648d5e 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,5 +1,5 @@ - + README.md From 32ad8867b7b3ba1a37772ac82f1da6b939295c14 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 5 Sep 2023 15:42:38 -0600 Subject: [PATCH 649/889] Bump MicroBuildVersion to 2.0.146 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 963ff8fe..d8c93d28 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,7 +4,7 @@ true true - 2.0.137 + 2.0.146 From cf980d71f2dc30d777674b77a1afef6a1e8ddd72 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 8 Sep 2023 10:43:58 -0600 Subject: [PATCH 650/889] Bump dotnet-coverage to 17.8.6 --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 2b62ebce..d93241f4 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "dotnet-coverage": { - "version": "17.8.4", + "version": "17.8.6", "commands": [ "dotnet-coverage" ] From 39bdb37ead87044bad1ae12b4cb8ce8800a863dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Sep 2023 08:50:51 -0600 Subject: [PATCH 651/889] Bump xunit from 2.5.0 to 2.5.1 (#219) Bumps [xunit](https://github.com/xunit/xunit) from 2.5.0 to 2.5.1. - [Commits](https://github.com/xunit/xunit/compare/2.5.0...2.5.1) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 76d18e0d..b3cdf478 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ - + From a7f083d5fa0dd1107a04d6b724b117ac6e3c0eb4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Sep 2023 14:58:32 +0000 Subject: [PATCH 652/889] Bump xunit.runner.visualstudio from 2.5.0 to 2.5.1 (#220) --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index b3cdf478..2cc8fe04 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,7 @@ - + From 5d99f303c0357175a0d1932e9ee5255f2476b5a5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 20 Sep 2023 16:13:36 -0600 Subject: [PATCH 653/889] Bump powershell to 7.3.7 --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index d93241f4..08f5c1eb 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "powershell": { - "version": "7.3.6", + "version": "7.3.7", "commands": [ "pwsh" ] From 7726859b29c1290b01e5c6dc0fa1449664596429 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 21 Sep 2023 11:08:45 -0600 Subject: [PATCH 654/889] Fix LangVersion at 11 Using `latest` allows VS previews to encourage use of syntax that will later fail when built with the SDK prescribed in our global.json file. --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 35fd4f69..22986f2f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,7 +5,7 @@ $(RepoRootPath)obj\$([MSBuild]::MakeRelative($(RepoRootPath), $(MSBuildProjectDirectory)))\ $(RepoRootPath)bin\$(MSBuildProjectName)\ $(RepoRootPath)bin\Packages\$(Configuration)\ - latest + 11 enable enable latest From 9ed3b099a203939b40046d582a795d5a4becfb60 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 27 Sep 2023 05:49:40 -0600 Subject: [PATCH 655/889] Bump dotnet-coverage to 17.8.7 --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 08f5c1eb..3e0ec525 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "dotnet-coverage": { - "version": "17.8.6", + "version": "17.8.7", "commands": [ "dotnet-coverage" ] From 75d85ec086b0c8592941927776f6032fec432148 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 1 Oct 2023 22:26:59 -0600 Subject: [PATCH 656/889] Revert "Bump dotnet-coverage to 17.8.7" This reverts commit 9ed3b099a203939b40046d582a795d5a4becfb60. --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 3e0ec525..08f5c1eb 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "dotnet-coverage": { - "version": "17.8.7", + "version": "17.8.6", "commands": [ "dotnet-coverage" ] From b0d89f938752bb23c4019dd2f2180cababcfbc89 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 8 Oct 2023 08:19:50 -0600 Subject: [PATCH 657/889] Bump .NET SDK to 7.0.401 --- .devcontainer/Dockerfile | 2 +- global.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6d2f30da..cef7ac6f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions -FROM mcr.microsoft.com/dotnet/sdk:7.0.302-jammy +FROM mcr.microsoft.com/dotnet/sdk:7.0.401-jammy # Installing mono makes `dotnet test` work without errors even for net472. # But installing it takes a long time, so it's excluded by default. diff --git a/global.json b/global.json index abde95a8..f153194c 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.302", + "version": "7.0.401", "rollForward": "patch", "allowPrerelease": false } From 2214ca952dbc76efce9af5226a7320803acec85b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 07:47:59 -0600 Subject: [PATCH 658/889] Bump xunit.runner.visualstudio from 2.5.1 to 2.5.3 (#224) Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.1 to 2.5.3. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.1...2.5.3) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 2cc8fe04..536511dc 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,7 @@ - + From 7df665541e0d93f5e9c0e20e5e62a29337619e6f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 07:48:29 -0600 Subject: [PATCH 659/889] Bump dotnet-coverage from 17.8.6 to 17.9.1 (#222) Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.8.6 to 17.9.1. - [Commits](https://github.com/microsoft/codecoverage/commits) --- updated-dependencies: - dependency-name: dotnet-coverage dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 08f5c1eb..e7623fce 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "dotnet-coverage": { - "version": "17.8.6", + "version": "17.9.1", "commands": [ "dotnet-coverage" ] From 646c1791371e7ad5cdb923b8e054dc1b5b93f95d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 07:48:35 -0600 Subject: [PATCH 660/889] Bump powershell from 7.3.7 to 7.3.8 (#221) Bumps [powershell](https://github.com/PowerShell/PowerShell) from 7.3.7 to 7.3.8. - [Release notes](https://github.com/PowerShell/PowerShell/releases) - [Commits](https://github.com/PowerShell/PowerShell/compare/v7.3.7...v7.3.8) --- updated-dependencies: - dependency-name: powershell dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index e7623fce..c13b4c68 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "powershell": { - "version": "7.3.7", + "version": "7.3.8", "commands": [ "pwsh" ] From 125983c0dd2f8fae5171b321f5258b6ebbea4894 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 13:55:23 +0000 Subject: [PATCH 661/889] Bump xunit from 2.5.1 to 2.5.2 (#223) --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 536511dc..6f6fe2ef 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ - + From ba76e6100b9d0586974eb10d15afed3e92d798b5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 20:54:18 -0600 Subject: [PATCH 662/889] Bump xunit from 2.5.2 to 2.5.3 (#226) Bumps [xunit](https://github.com/xunit/xunit) from 2.5.2 to 2.5.3. - [Commits](https://github.com/xunit/xunit/compare/2.5.2...2.5.3) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 6f6fe2ef..47b1fc9c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ - + From 7ef6ca07b8f5c03398958a4e3c7482f7129499cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 20:54:29 -0600 Subject: [PATCH 663/889] Bump dotnet-coverage from 17.9.1 to 17.9.3 (#225) Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.9.1 to 17.9.3. - [Commits](https://github.com/microsoft/codecoverage/commits) --- updated-dependencies: - dependency-name: dotnet-coverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index c13b4c68..b935d933 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "dotnet-coverage": { - "version": "17.9.1", + "version": "17.9.3", "commands": [ "dotnet-coverage" ] From 62691614bbd61856e40986df43f8e9a43274b48f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 12:50:05 -0600 Subject: [PATCH 664/889] Bump powershell from 7.3.8 to 7.3.9 (#227) Bumps [powershell](https://github.com/PowerShell/PowerShell) from 7.3.8 to 7.3.9. - [Release notes](https://github.com/PowerShell/PowerShell/releases) - [Commits](https://github.com/PowerShell/PowerShell/compare/v7.3.8...v7.3.9) --- updated-dependencies: - dependency-name: powershell dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index b935d933..de46e939 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "powershell": { - "version": "7.3.8", + "version": "7.3.9", "commands": [ "pwsh" ] From 2e6c239bbcb193809c4379a7f7797e734d0c988c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 11:09:57 -0700 Subject: [PATCH 665/889] Bump xunit from 2.5.3 to 2.6.1 (#228) Bumps [xunit](https://github.com/xunit/xunit) from 2.5.3 to 2.6.1. - [Commits](https://github.com/xunit/xunit/compare/2.5.3...2.6.1) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 47b1fc9c..c5b4d483 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ - + From 4337ca1c8ebf7bff355d024ab525e9428d8a0bb4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 8 Nov 2023 06:41:30 -0700 Subject: [PATCH 666/889] Ignore `dotnet-format` v9 versions --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a0e8933b..9053ac86 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,4 +10,4 @@ updates: ignore: # This package has unlisted versions on nuget.org that are not supported. Avoid them. - dependency-name: dotnet-format - versions: ["6.x", "7.x", "8.x"] + versions: ["6.x", "7.x", "8.x", "9.x"] From 5a0cd156d0da7a37b76ac60b8c5245494958f51f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 06:49:02 -0700 Subject: [PATCH 667/889] Bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.8.0 (#229) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.7.2 to 17.8.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.7.2...v17.8.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index c5b4d483..faa3fc68 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true - + From 0fcb1d81a073695876aca758d81881c182de864b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 13 Nov 2023 15:26:34 -0700 Subject: [PATCH 668/889] Apply Directory.Packages.props in Apply-Template.ps1 --- Apply-Template.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apply-Template.ps1 b/Apply-Template.ps1 index 1c773355..42ed3362 100644 --- a/Apply-Template.ps1 +++ b/Apply-Template.ps1 @@ -36,7 +36,7 @@ robocopy /mir $PSScriptRoot/.devcontainer $Path/.devcontainer robocopy /mir $PSScriptRoot/.github $Path/.github robocopy /mir $PSScriptRoot/.vscode $Path/.vscode robocopy /mir $PSScriptRoot/tools $Path/tools -robocopy $PSScriptRoot $Path Directory.Build.* global.json init.* azure-pipelines.yml .gitignore .gitattributes .editorconfig +robocopy $PSScriptRoot $Path Directory.Build.* Directory.Packages.props global.json init.* azure-pipelines.yml .gitignore .gitattributes .editorconfig robocopy $PSScriptRoot/src $Path/src Directory.Build.* .editorconfig AssemblyInfo.cs robocopy $PSScriptRoot/test $Path/test Directory.Build.* .editorconfig Remove-Item $Path/azure-pipelines/expand-template.yml From e678b457c03adcff1f5459586095c27a3a88f15d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 14 Nov 2023 21:38:21 -0700 Subject: [PATCH 669/889] Bump to the .NET 8.0.100 SDK --- .devcontainer/Dockerfile | 2 +- Directory.Build.props | 2 +- global.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index cef7ac6f..b680b1db 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions -FROM mcr.microsoft.com/dotnet/sdk:7.0.401-jammy +FROM mcr.microsoft.com/dotnet/sdk:8.0.100-jammy # Installing mono makes `dotnet test` work without errors even for net472. # But installing it takes a long time, so it's excluded by default. diff --git a/Directory.Build.props b/Directory.Build.props index 22986f2f..d3edacc8 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,7 +5,7 @@ $(RepoRootPath)obj\$([MSBuild]::MakeRelative($(RepoRootPath), $(MSBuildProjectDirectory)))\ $(RepoRootPath)bin\$(MSBuildProjectName)\ $(RepoRootPath)bin\Packages\$(Configuration)\ - 11 + 12 enable enable latest diff --git a/global.json b/global.json index f153194c..d24a9b70 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.401", + "version": "8.0.100", "rollForward": "patch", "allowPrerelease": false } From d1ffce8a4b3a570dc97532af7cb7d6cf47ccc82d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 12:36:51 -0700 Subject: [PATCH 670/889] Bump xunit from 2.6.1 to 2.6.2 (#234) Bumps [xunit](https://github.com/xunit/xunit) from 2.6.1 to 2.6.2. - [Commits](https://github.com/xunit/xunit/compare/2.6.1...2.6.2) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index faa3fc68..272353bf 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ - + From ccd2c89fa9aa2e2e991cd15f16827bcbe654fc10 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 12:37:45 -0700 Subject: [PATCH 671/889] Bump Microsoft.SourceLink.GitHub from 1.1.1 to 8.0.0 (#232) Bumps [Microsoft.SourceLink.GitHub](https://github.com/dotnet/sourcelink) from 1.1.1 to 8.0.0. - [Release notes](https://github.com/dotnet/sourcelink/releases) - [Commits](https://github.com/dotnet/sourcelink/compare/1.1.1...8.0.0) --- updated-dependencies: - dependency-name: Microsoft.SourceLink.GitHub dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 272353bf..9ac2f371 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -17,6 +17,6 @@ - + From 42894612a6492693491c9a91b3e314d8f10658e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 12:37:58 -0700 Subject: [PATCH 672/889] Bump powershell from 7.3.9 to 7.4.0 (#231) Bumps [powershell](https://github.com/PowerShell/PowerShell) from 7.3.9 to 7.4.0. - [Release notes](https://github.com/PowerShell/PowerShell/releases) - [Commits](https://github.com/PowerShell/PowerShell/compare/v7.3.9...v7.4.0) --- updated-dependencies: - dependency-name: powershell dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index de46e939..7a4b9444 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "powershell": { - "version": "7.3.9", + "version": "7.4.0", "commands": [ "pwsh" ] From 7e872d33dbd08fce619141103e8c8c7bcf7cd966 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 19:43:19 +0000 Subject: [PATCH 673/889] Bump xunit.runner.visualstudio from 2.5.3 to 2.5.4 (#233) --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 9ac2f371..3ad9b793 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,7 @@ - + From 5da8083e9f0a5f79f906d27e8d8dda3386f02bb1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 22 Nov 2023 11:58:24 -0700 Subject: [PATCH 674/889] Validate formatted code in builds --- azure-pipelines/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 9c445f72..5d1835d5 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -36,6 +36,8 @@ jobs: - template: dotnet.yml parameters: RunTests: ${{ parameters.RunTests }} + - script: dotnet format --verify-no-changes --no-restore + displayName: 💅 Verify formatted code - template: expand-template.yml - job: macOS From c4890509d2ef60e24bbed0ec213882bcead28848 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 22 Nov 2023 13:42:32 -0700 Subject: [PATCH 675/889] Enable auto-format on save in VS and VS Code --- .vscode/settings.json | 3 ++- settings.VisualStudio.json | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 settings.VisualStudio.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 54c5c689..5101737c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,5 +4,6 @@ "files.trimFinalNewlines": true, "omnisharp.enableEditorConfigSupport": true, "omnisharp.enableRoslynAnalyzers": true, - "dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true + "dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true, + "editor.formatOnSave": true } diff --git a/settings.VisualStudio.json b/settings.VisualStudio.json new file mode 100644 index 00000000..7abb4a06 --- /dev/null +++ b/settings.VisualStudio.json @@ -0,0 +1,3 @@ +{ + "textEditor.codeCleanup.profile": "profile1" +} From 41f6d2704083294ec0338f68e2bc54f461177c58 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 22 Nov 2023 14:37:47 -0700 Subject: [PATCH 676/889] Remove `dotnet-format` as a tool It's part of the SDK now, and the version on nuget.org is no longer maintained. --- .config/dotnet-tools.json | 8 +------- .github/dependabot.yml | 4 ---- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 7a4b9444..0e4a7846 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -8,12 +8,6 @@ "pwsh" ] }, - "dotnet-format": { - "version": "5.1.250801", - "commands": [ - "dotnet-format" - ] - }, "dotnet-coverage": { "version": "17.9.3", "commands": [ @@ -27,4 +21,4 @@ ] } } -} +} \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9053ac86..63e3e890 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,7 +7,3 @@ updates: directory: / schedule: interval: weekly - ignore: - # This package has unlisted versions on nuget.org that are not supported. Avoid them. - - dependency-name: dotnet-format - versions: ["6.x", "7.x", "8.x", "9.x"] From ac3f1dff5d485d6e8c56998c87bb3665f0d4bbf9 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 29 Nov 2023 07:09:14 -0700 Subject: [PATCH 677/889] Make symbolic link failures more detectable --- azure-pipelines/artifacts/_stage_all.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/azure-pipelines/artifacts/_stage_all.ps1 b/azure-pipelines/artifacts/_stage_all.ps1 index d81d16d4..b077931c 100644 --- a/azure-pipelines/artifacts/_stage_all.ps1 +++ b/azure-pipelines/artifacts/_stage_all.ps1 @@ -30,6 +30,12 @@ function Create-SymbolicLink { } else { cmd /c "mklink `"$Link`" `"$Target`"" | Out-Null } + + if ($LASTEXITCODE -ne 0) { + # Windows requires admin privileges to create symbolic links + # unless Developer Mode has been enabled. + throw "Failed to create symbolic link at $Link that points to $Target" + } } # Stage all artifacts From d0e3bf5b2a3af31b97b7013bd10cb7ebc065db61 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 30 Nov 2023 11:54:14 -0700 Subject: [PATCH 678/889] Update TeamName comment --- azure-pipelines/variables/TeamName.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/variables/TeamName.ps1 b/azure-pipelines/variables/TeamName.ps1 index 5f2822c5..ba9c8231 100644 --- a/azure-pipelines/variables/TeamName.ps1 +++ b/azure-pipelines/variables/TeamName.ps1 @@ -1,2 +1,2 @@ -# This value is used to craft a \\cpvsbuild\drops path for symbol archival. +# This value is used as an input to the MicroBuild Insert VS task. 'VS IDE' From 41771506014fc409c68858d14c2e061d4c2de665 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 30 Nov 2023 11:56:35 -0700 Subject: [PATCH 679/889] Add xml header to msbuild files MSBuild doesn't need them, but Azure Repos won't recognize .targets and .props files as xml files without it. And recognizing them means syntax coloring, which is worthwhile. --- Directory.Build.props | 1 + Directory.Build.targets | 1 + Directory.Packages.props | 1 + src/Directory.Build.props | 1 + src/Directory.Build.targets | 1 + test/Directory.Build.props | 1 + test/Directory.Build.targets | 1 + 7 files changed, 7 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index d3edacc8..e42ac60a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,3 +1,4 @@ + Debug diff --git a/Directory.Build.targets b/Directory.Build.targets index ea7b6e6f..cc8184aa 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,3 +1,4 @@ + diff --git a/Directory.Packages.props b/Directory.Packages.props index 3ad9b793..6cf06aef 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,3 +1,4 @@ + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 5e648d5e..9ba7818d 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,3 +1,4 @@ + diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index c1d929a5..07f41346 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,3 +1,4 @@ + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index ad4a4b6c..6c7aa71d 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -1,3 +1,4 @@ + diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets index 052fe3ef..a6e0f4ac 100644 --- a/test/Directory.Build.targets +++ b/test/Directory.Build.targets @@ -1,3 +1,4 @@ + From 140a33b14a9c0846c28974745ad70d9d4dbdac75 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 30 Nov 2023 15:42:28 -0700 Subject: [PATCH 680/889] Update Microsoft.SourceLink.AzureRepos.Git to 8.0.0 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index da5ca7c6..a7a2c037 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -21,7 +21,7 @@ - + From db4440205ad8c7adac61bea7aea42a63496599d7 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 1 Dec 2023 12:28:16 -0700 Subject: [PATCH 681/889] Stop VS Code from wrapping xml files --- .vscode/settings.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 5101737c..ce72437c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,8 @@ "omnisharp.enableEditorConfigSupport": true, "omnisharp.enableRoslynAnalyzers": true, "dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true, - "editor.formatOnSave": true + "editor.formatOnSave": true, + "[xml]": { + "editor.wordWrap": "off" + } } From 3a5c8f0ee6540b10f7c58f6489bd0b3ca286c6b2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 11 Dec 2023 13:19:20 -0700 Subject: [PATCH 682/889] Add dotnet_separate_import_directive_groups to .editorconfig This is the default setting in VS, but folks who have changed the setting can cause noise in PRs unless we pin the setting at the repo level. --- .editorconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/.editorconfig b/.editorconfig index 959801c2..ffae180a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -40,6 +40,7 @@ indent_size = 4 [*.{cs,vb}] # Sort using and Import directives with System.* appearing first dotnet_sort_system_directives_first = true +dotnet_separate_import_directive_groups = false dotnet_style_qualification_for_field = true:warning dotnet_style_qualification_for_property = true:warning dotnet_style_qualification_for_method = true:warning From f8f3f9e2501d480a8d313c2e36bdd978c4191813 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 17:12:47 -0700 Subject: [PATCH 683/889] Bump xunit from 2.6.2 to 2.6.3 (#239) Bumps [xunit](https://github.com/xunit/xunit) from 2.6.2 to 2.6.3. - [Commits](https://github.com/xunit/xunit/compare/2.6.2...2.6.3) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 6cf06aef..041ea3d1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -8,7 +8,7 @@ - + From 20c7541a3ca7b7cd4c7fa30335be69e31b1d41a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 17:13:10 -0700 Subject: [PATCH 684/889] Bump dotnet-coverage from 17.9.3 to 17.9.5 (#238) Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.9.3 to 17.9.5. - [Commits](https://github.com/microsoft/codecoverage/commits) --- updated-dependencies: - dependency-name: dotnet-coverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 0e4a7846..c08307f6 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -9,7 +9,7 @@ ] }, "dotnet-coverage": { - "version": "17.9.3", + "version": "17.9.5", "commands": [ "dotnet-coverage" ] From 37705a891a10e45737c3c8d4fb8708141738ec1b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Dec 2023 00:20:18 +0000 Subject: [PATCH 685/889] Bump xunit.runner.visualstudio from 2.5.4 to 2.5.5 (#237) --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 041ea3d1..4cf7998d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ - + From 5af59eca86c56ea86c6027d2231bdf6d1c867ffe Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 12 Dec 2023 18:31:07 -0700 Subject: [PATCH 686/889] Include SBOM in nuget packages --- Directory.Build.targets | 2 ++ azure-pipelines/NuGetSbom.targets | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 azure-pipelines/NuGetSbom.targets diff --git a/Directory.Build.targets b/Directory.Build.targets index cc8184aa..4549a848 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -9,4 +9,6 @@ + + diff --git a/azure-pipelines/NuGetSbom.targets b/azure-pipelines/NuGetSbom.targets new file mode 100644 index 00000000..a2599e88 --- /dev/null +++ b/azure-pipelines/NuGetSbom.targets @@ -0,0 +1,12 @@ + + + true + $(TargetsForTfmSpecificBuildOutput);IncludeSbomInNupkg + + + + + + + + From 4b35644de258b6b4de47d1c9de86a69d0bcb0d3f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 12 Dec 2023 18:32:49 -0700 Subject: [PATCH 687/889] Fix `Install-NuGetPackage` exit code check Somehow, there is a race condition where the exit code can be null then transition to 0 later. This caused the script to inappropriately fail by throwing, aborting installation of microbuild plugins. --- azure-pipelines/Install-NuGetPackage.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/Install-NuGetPackage.ps1 b/azure-pipelines/Install-NuGetPackage.ps1 index cdac7308..9afde055 100644 --- a/azure-pipelines/Install-NuGetPackage.ps1 +++ b/azure-pipelines/Install-NuGetPackage.ps1 @@ -45,7 +45,7 @@ try { if ($PSCmdlet.ShouldProcess($PackageId, 'nuget install')) { $p = Start-Process $nugetPath $nugetArgs -NoNewWindow -Wait -PassThru - if ($p.ExitCode -ne 0) { throw } + if ($null -ne $p.ExitCode -and $p.ExitCode -ne 0) { throw } } # Provide the path to the installed package directory to our caller. From c3e46493fe2de84ece6d1fb0ffd1749ef7ca3a3b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 06:47:41 -0700 Subject: [PATCH 688/889] Bump dotnet-coverage from 17.9.5 to 17.9.6 (#240) Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.9.5 to 17.9.6. - [Commits](https://github.com/microsoft/codecoverage/commits) --- updated-dependencies: - dependency-name: dotnet-coverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index c08307f6..b4673116 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -9,7 +9,7 @@ ] }, "dotnet-coverage": { - "version": "17.9.5", + "version": "17.9.6", "commands": [ "dotnet-coverage" ] From 9198063d425cd079e19d2f0d2bf523de3cbb343d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Dec 2023 08:01:46 -0700 Subject: [PATCH 689/889] Bump xunit.runner.visualstudio from 2.5.5 to 2.5.6 (#243) Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.5 to 2.5.6. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.5...2.5.6) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 4cf7998d..1d02ad28 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ - + From cd53181413c400fa42418b25329764d69ffc758c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Dec 2023 15:08:21 +0000 Subject: [PATCH 690/889] Bump xunit from 2.6.3 to 2.6.4 (#242) --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 1d02ad28..50ea3701 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -8,7 +8,7 @@ - + From b9d62f310b3bcc9d0397a39d64049bc046e63f6c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Dec 2023 11:16:41 -0700 Subject: [PATCH 691/889] Bump StyleCop.Analyzers.Unstable from 1.2.0.507 to 1.2.0.556 (#241) Bumps [StyleCop.Analyzers.Unstable](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) from 1.2.0.507 to 1.2.0.556. - [Release notes](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/releases) - [Changelog](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/KnownChanges.md) - [Commits](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/commits) --- updated-dependencies: - dependency-name: StyleCop.Analyzers.Unstable dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 50ea3701..41167d99 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -15,7 +15,7 @@ - + From e757dc7f608e40ee67d31c3bc358035131d23f70 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 9 Jan 2024 06:43:16 -0700 Subject: [PATCH 692/889] Bump MicroBuild to 2.0.147 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 4152ee85..3fd15a57 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true true - 2.0.146 + 2.0.147 From 130e9c8786fb934a3e1db3adbb480f0a58b72830 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 09:56:35 -0700 Subject: [PATCH 693/889] Bump powershell from 7.4.0 to 7.4.1 (#245) Bumps [powershell](https://github.com/PowerShell/PowerShell) from 7.4.0 to 7.4.1. - [Release notes](https://github.com/PowerShell/PowerShell/releases) - [Commits](https://github.com/PowerShell/PowerShell/compare/v7.4.0...v7.4.1) --- updated-dependencies: - dependency-name: powershell dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index b4673116..589f0604 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "powershell": { - "version": "7.4.0", + "version": "7.4.1", "commands": [ "pwsh" ] From 7fd4b166ea46c8fa4b3a7f0954c9f0f99b6467ac Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 22 Jan 2024 22:36:03 -0700 Subject: [PATCH 694/889] Bump xunit from 2.6.4 to 2.6.6 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 41167d99..1438548b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -8,7 +8,7 @@ - + From 050805e88f48ff2954489c7a795dda28c5282fb5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 25 Jan 2024 14:04:06 -0700 Subject: [PATCH 695/889] Add switch to avoid creating symbolic links Symbolic links present a problem, at least for "1ES PT". --- azure-pipelines/artifacts/_pipelines.ps1 | 5 +++-- azure-pipelines/artifacts/_stage_all.ps1 | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/artifacts/_pipelines.ps1 b/azure-pipelines/artifacts/_pipelines.ps1 index 2d3338b2..47321ed5 100644 --- a/azure-pipelines/artifacts/_pipelines.ps1 +++ b/azure-pipelines/artifacts/_pipelines.ps1 @@ -7,7 +7,8 @@ [CmdletBinding()] param ( [string]$ArtifactNameSuffix, - [switch]$StageOnly + [switch]$StageOnly, + [switch]$AvoidSymbolicLinks ) Function Set-PipelineVariable($name, $value) { @@ -24,7 +25,7 @@ Function Test-ArtifactUploaded($artifactName) { Test-Path "env:$varName" } -& "$PSScriptRoot/_stage_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix |% { +& "$PSScriptRoot/_stage_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix -AvoidSymbolicLinks:$AvoidSymbolicLinks |% { # Set a variable which will out-live this script so that a subsequent attempt to collect and upload artifacts # will skip this one from a check in the _all.ps1 script. Set-PipelineVariable "ARTIFACTSTAGED_$($_.Name.ToUpper())" 'true' diff --git a/azure-pipelines/artifacts/_stage_all.ps1 b/azure-pipelines/artifacts/_stage_all.ps1 index b077931c..74d7a38d 100644 --- a/azure-pipelines/artifacts/_stage_all.ps1 +++ b/azure-pipelines/artifacts/_stage_all.ps1 @@ -7,7 +7,8 @@ [CmdletBinding()] param ( - [string]$ArtifactNameSuffix + [string]$ArtifactNameSuffix, + [switch]$AvoidSymbolicLinks ) $ArtifactStagingFolder = & "$PSScriptRoot/../Get-ArtifactsStagingDirectory.ps1" -CleanIfLocal @@ -48,7 +49,12 @@ $Artifacts |% { if (-not (Test-Path $DestinationFolder)) { New-Item -ItemType Directory -Path $DestinationFolder | Out-Null } if (Test-Path -PathType Leaf $_.Source) { # skip folders - Create-SymbolicLink -Link (Join-Path $DestinationFolder $Name) -Target $_.Source + $TargetPath = Join-Path $DestinationFolder $Name + if ($AvoidSymbolicLinks) { + Copy-Item -Path $_.Source -Destination $TargetPath + } else { + Create-SymbolicLink -Link $TargetPath -Target $_.Source + } } } From 9466f8ed67a86e5fa195c12beb501e2abf0f1446 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 26 Jan 2024 11:05:24 -0700 Subject: [PATCH 696/889] Clarify parameter type in AzP template --- azure-pipelines/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 5d1835d5..3d53ed83 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -4,6 +4,7 @@ parameters: default: vmImage: windows-2022 - name: includeMacOS + type: boolean - name: RunTests type: boolean default: true From 89ada64c57cb0dc31794c4c479f702eec86978ce Mon Sep 17 00:00:00 2001 From: trevors20 <49179298+trevors20@users.noreply.github.com> Date: Fri, 26 Jan 2024 10:33:00 -0800 Subject: [PATCH 697/889] MicroBuild to 1ES PT template transition (#246) Co-authored-by: Andrew Arnott --- .vscode/settings.json | 1 + azure-pipelines/build.yml | 62 +++++++++++++- azure-pipelines/dotnet.yml | 15 +++- azure-pipelines/microbuild.after.yml | 4 - azure-pipelines/official.yml | 89 +++++++++++++++----- azure-pipelines/secure-development-tools.yml | 26 +----- 6 files changed, 141 insertions(+), 56 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ce72437c..1b99a955 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,7 @@ "files.trimTrailingWhitespace": true, "files.insertFinalNewline": true, "files.trimFinalNewlines": true, + "azure-pipelines.1ESPipelineTemplatesSchemaFile": true, "omnisharp.enableEditorConfigSupport": true, "omnisharp.enableRoslynAnalyzers": true, "dotnet.completion.showCompletionItemsFromUnimportedNamespaces": true, diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index ecf2f7c4..64e97cf7 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -3,6 +3,14 @@ parameters: type: object default: vmImage: windows-2022 +- name: linuxPool + type: object + default: + vmImage: ubuntu-20.04 +- name: macOSPool + type: object + default: + vmImage: macOS-12 - name: includeMacOS type: boolean - name: RunTests @@ -14,6 +22,17 @@ parameters: - name: EnableAPIScan type: boolean default: false +- name: artifact_names + type: object + default: + - build_logs + - coverageResults + - deployables + - projectAssetsJson + - symbols + - testResults + - test_symbols + - Variables jobs: - job: Windows @@ -23,6 +42,25 @@ jobs: - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: # https://dev.azure.com/devdiv/DevDiv/_wiki/wikis/DevDiv.wiki/25351/APIScan-step-by-step-guide-to-setting-up-a-Pipeline - group: VSCloudServices-APIScan # Expected to provide ApiScanClientId, ApiScanSecret, ApiScanTenant + ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + templateContext: + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - ${{ each artifact_name in parameters.artifact_names }}: + - output: pipelineArtifact + displayName: 📢 Publish ${{ artifact_name }}-Windows + targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-Windows + artifactName: ${{ artifact_name }}-Windows + - output: pipelineArtifact + displayName: 📢 Publish VSInsertion-Windows + targetPath: $(Build.ArtifactStagingDirectory)/VSInsertion-Windows + artifactName: VSInsertion-Windows + # This is useful when false positives appear so we can copy some of the output into the suppressions file. + - output: pipelineArtifact + displayName: 📢 Publish Guardian failures + targetPath: $(Build.ArtifactStagingDirectory)/guardian_failures_as_suppressions + artifactName: guardian_failures_as_suppressions + condition: failed() steps: - checkout: self fetchDepth: 0 # avoid shallow clone so nbgv can do its work. @@ -52,8 +90,16 @@ jobs: - template: expand-template.yml - job: Linux - pool: - vmImage: Ubuntu 20.04 + pool: ${{ parameters.linuxPool }} + ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + templateContext: + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - ${{ each artifact_name in parameters.artifact_names }}: + - output: pipelineArtifact + displayName: 📢 Publish ${{ artifact_name }}-Linux + targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-Linux + artifactName: ${{ artifact_name }}-Linux steps: - checkout: self fetchDepth: 0 # avoid shallow clone so nbgv can do its work. @@ -68,8 +114,16 @@ jobs: - job: macOS condition: ${{ parameters.includeMacOS }} - pool: - vmImage: macOS-12 + pool: ${{ parameters.macOSPool }} + ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + templateContext: + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - ${{ each artifact_name in parameters.artifact_names }}: + - output: pipelineArtifact + displayName: 📢 Publish ${{ artifact_name }}-macOS + targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-macOS + artifactName: ${{ artifact_name }}-macOS steps: - checkout: self fetchDepth: 0 # avoid shallow clone so nbgv can do its work. diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 51241549..61c96a35 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -15,10 +15,17 @@ steps: displayName: ⚙ Update pipeline variables based on build outputs condition: succeededOrFailed() -- powershell: azure-pipelines/artifacts/_pipelines.ps1 -ArtifactNameSuffix "-$(Agent.JobName)" -Verbose - failOnStderr: true - displayName: 📢 Publish artifacts - condition: succeededOrFailed() +- ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + - powershell: azure-pipelines/artifacts/_pipelines.ps1 -StageOnly -AvoidSymbolicLinks -ArtifactNameSuffix "-$(Agent.JobName)" -Verbose + failOnStderr: true + displayName: 📢 Publish artifacts + condition: succeededOrFailed() + +- ${{ if ne(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + - powershell: azure-pipelines/artifacts/_pipelines.ps1 -ArtifactNameSuffix "-$(Agent.JobName)" -Verbose + failOnStderr: true + displayName: 📢 Publish artifacts + condition: succeededOrFailed() - ${{ if and(ne(variables['codecov_token'], ''), parameters.RunTests) }}: - powershell: | diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 3dbbad9c..7531cf54 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -10,10 +10,6 @@ steps: $(Build.SourcesDirectory)/bin/Packages/$(BuildConfiguration)/NuGet condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) -- task: MicroBuildCleanup@1 - condition: succeededOrFailed() - displayName: ⚙️ MicroBuild Cleanup - - task: Ref12Analyze@0 displayName: 📑 Ref12 (Codex) Analyze inputs: diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 6df6f28b..915c7e76 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -42,24 +42,75 @@ parameters: type: boolean default: true -stages: +resources: + repositories: + - repository: MicroBuildTemplate + type: git + name: 1ESPipelineTemplates/MicroBuildTemplate + ref: refs/tags/release -- stage: Build - variables: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - BuildConfiguration: Release - NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages - SignTypeSelection: ${{ parameters.SignTypeSelection }} - Packaging.EnableSBOMSigning: false - Codeql.Enabled: true - - jobs: - - template: build.yml +extends: + ${{ if parameters.EnableCompliance }}: + template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate parameters: - EnableCompliance: ${{ parameters.EnableCompliance }} - EnableAPIScan: ${{ parameters.EnableAPIScan }} - windowsPool: VSEngSS-MicroBuild2022-1ES - includeMacOS: ${{ parameters.includeMacOS }} - RunTests: ${{ parameters.RunTests }} - -- template: prepare-insertion-stages.yml + sdl: + sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES + stages: + - stage: Build + variables: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + BuildConfiguration: Release + NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages + SignTypeSelection: ${{ parameters.SignTypeSelection }} + Packaging.EnableSBOMSigning: false + Codeql.Enabled: true + jobs: + - template: /azure-pipelines/build.yml@self + parameters: + EnableCompliance: ${{ parameters.EnableCompliance }} + EnableAPIScan: ${{ parameters.EnableAPIScan }} + windowsPool: VSEngSS-MicroBuild2022-1ES + linuxPool: + name: AzurePipelines-EO + demands: + - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT + os: Linux + macOSPool: + name: Azure Pipelines + vmImage: macOS-12 + os: macOS + includeMacOS: ${{ parameters.includeMacOS }} + RunTests: ${{ parameters.RunTests }} + - template: /azure-pipelines/prepare-insertion-stages.yml@self + ${{ else }}: + template: azure-pipelines/MicroBuild.1ES.Unofficial.yml@MicroBuildTemplate + parameters: + sdl: + sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES + stages: + - stage: Build + variables: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + BuildConfiguration: Release + NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages + SignTypeSelection: ${{ parameters.SignTypeSelection }} + Packaging.EnableSBOMSigning: false + Codeql.Enabled: true + jobs: + - template: /azure-pipelines/build.yml@self + parameters: + EnableCompliance: ${{ parameters.EnableCompliance }} + EnableAPIScan: ${{ parameters.EnableAPIScan }} + windowsPool: VSEngSS-MicroBuild2022-1ES + linuxPool: + name: AzurePipelines-EO + demands: + - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT + os: Linux + macOSPool: + name: Azure Pipelines + vmImage: macOS-12 + os: macOS + includeMacOS: ${{ parameters.includeMacOS }} + RunTests: ${{ parameters.RunTests }} + - template: /azure-pipelines/prepare-insertion-stages.yml@self diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index ce8ac94c..1bbacefe 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -6,18 +6,8 @@ steps: - powershell: echo "##vso[build.addbuildtag]compliance" displayName: 🏷️ Tag run with 'compliance' -- task: CredScan@3 - displayName: 🔍 Run CredScan - -- task: PoliCheck@2 - displayName: 🔍 Run PoliCheck - inputs: - targetType: F - targetArgument: $(System.DefaultWorkingDirectory) - optionsUEPATH: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml - - task: CopyFiles@2 - displayName: 📂 Collect APIScan/BinSkim inputs + displayName: 📂 Collect APIScan inputs inputs: SourceFolder: $(Build.ArtifactStagingDirectory)/Symbols-$(Agent.JobName) # Exclude any patterns from the Contents (e.g. `!**/git2*`) that we have symbols for but do not need to run APIScan on. @@ -29,14 +19,6 @@ steps: !**/osx*/** TargetFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs -- task: BinSkim@4 - displayName: 🔍 Run BinSkim - inputs: - InputType: Basic - Function: analyze - TargetPattern: guardianGlob - AnalyzeTargetGlob: $(Build.ArtifactStagingDirectory)/APIScanInputs/**/*.dll;$(Build.ArtifactStagingDirectory)/APIScanInputs/**/*.exe - - task: APIScan@2 displayName: 🔍 Run APIScan inputs: @@ -72,9 +54,3 @@ steps: GdnBreakSuppressionSets: falsepositives GdnBreakOutputSuppressionFile: $(Build.ArtifactStagingDirectory)/guardian_failures_as_suppressions/ GdnBreakOutputSuppressionSet: falsepositives - -# This is useful when false positives appear so we can copy some of the output into the suppressions file. -- publish: $(Build.ArtifactStagingDirectory)/guardian_failures_as_suppressions - artifact: guardian_failures_as_suppressions - displayName: 🔍 Publish Guardian failures - condition: failed() From 5c15e00ac2c63b6ad724d36b5356ee2fef5dad31 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 26 Jan 2024 12:24:30 -0700 Subject: [PATCH 698/889] Update the other 4 entrypoints for 1ES PT --- azure-pipelines/archive-sourcecode.yml | 83 ++++++---- azure-pipelines/prepare-insertion-stages.yml | 2 - azure-pipelines/release.yml | 109 +++++++------ azure-pipelines/vs-insertion.yml | 97 ++++++------ azure-pipelines/vs-validation.yml | 153 ++++++++++--------- 5 files changed, 249 insertions(+), 195 deletions(-) diff --git a/azure-pipelines/archive-sourcecode.yml b/azure-pipelines/archive-sourcecode.yml index db270eb9..afdf0f6b 100644 --- a/azure-pipelines/archive-sourcecode.yml +++ b/azure-pipelines/archive-sourcecode.yml @@ -11,6 +11,13 @@ schedules: include: - main +resources: + repositories: + - repository: MicroBuildTemplate + type: git + name: 1ESPipelineTemplates/MicroBuildTemplate + ref: refs/tags/release + parameters: - name: notes displayName: Notes to include in the SCA request @@ -24,35 +31,47 @@ parameters: variables: - group: VS Core team # Expected to provide ManagerAlias, SourceCodeArchivalUri -pool: - name: AzurePipelines-EO - vmImage: AzurePipelinesUbuntu20.04compliant - -steps: -- checkout: self - clean: true - fetchDepth: 0 -- powershell: tools/Install-DotNetSdk.ps1 - displayName: ⚙ Install .NET SDK -- task: NuGetAuthenticate@1 - displayName: 🔏 Authenticate NuGet feeds - inputs: - forceReinstallCredentialProvider: true -- script: dotnet tool restore - displayName: ⚙️ Restore CLI tools -- powershell: azure-pipelines/variables/_pipelines.ps1 - failOnStderr: true - displayName: ⚙ Set pipeline variables based on source -- powershell: > - $TeamAlias = '$(TeamEmail)'.Substring(0, '$(TeamEmail)'.IndexOf('@')) - - azure-pipelines/Archive-SourceCode.ps1 - -ManagerAlias '$(ManagerAlias)' - -TeamAlias $TeamAlias - -BusinessGroupName '$(BusinessGroupName)' - -ProductName '$(SymbolsFeatureName)' - -ProductLanguage English - -Notes '${{ parameters.notes }}' - -Verbose - -WhatIf:$${{ parameters.whatif }} - displayName: 🗃️ Submit archival request +extends: + template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate + parameters: + sdl: + sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES + + stages: + - stage: archive + jobs: + - job: archive + pool: + name: AzurePipelines-EO + demands: + - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT + os: Linux + + steps: + - checkout: self + clean: true + fetchDepth: 0 + - powershell: tools/Install-DotNetSdk.ps1 + displayName: ⚙ Install .NET SDK + - task: NuGetAuthenticate@1 + displayName: 🔏 Authenticate NuGet feeds + inputs: + forceReinstallCredentialProvider: true + - script: dotnet tool restore + displayName: ⚙️ Restore CLI tools + - powershell: azure-pipelines/variables/_pipelines.ps1 + failOnStderr: true + displayName: ⚙ Set pipeline variables based on source + - powershell: > + $TeamAlias = '$(TeamEmail)'.Substring(0, '$(TeamEmail)'.IndexOf('@')) + + azure-pipelines/Archive-SourceCode.ps1 + -ManagerAlias '$(ManagerAlias)' + -TeamAlias $TeamAlias + -BusinessGroupName '$(BusinessGroupName)' + -ProductName '$(SymbolsFeatureName)' + -ProductLanguage English + -Notes '${{ parameters.notes }}' + -Verbose + -WhatIf:$${{ parameters.whatif }} + displayName: 🗃️ Submit archival request diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index a41be032..f805607e 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -29,8 +29,6 @@ stages: SymbolsProject: VS SymbolsAgentPath: $(Pipeline.Workspace)/symbols-legacy azureSubscription: Symbols Upload (DevDiv) - - task: MicroBuildCleanup@1 - displayName: ☎️ Send Telemetry # - job: push # displayName: azure-public/vs-impl feed diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index 175c37a9..d949958f 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -2,6 +2,11 @@ trigger: none # We only want to trigger manually or based on resources pr: none resources: + repositories: + - repository: MicroBuildTemplate + type: git + name: 1ESPipelineTemplates/MicroBuildTemplate + ref: refs/tags/release pipelines: - pipeline: CI source: Library # TODO: This should match the name of your CI pipeline @@ -12,50 +17,60 @@ resources: variables: - group: VS SDK feeds # Expected to provide NuGetOrgApiKey -jobs: -- job: release - pool: - name: AzurePipelines-EO - vmImage: AzurePipelinesUbuntu20.04compliant - steps: - - checkout: none - - powershell: | - Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" - if ('$(resources.pipeline.CI.runName)'.Contains('-')) { - Write-Host "##vso[task.setvariable variable=IsPrerelease]true" - } else { - Write-Host "##vso[task.setvariable variable=IsPrerelease]false" - } - displayName: ⚙ Set up pipeline - - task: UseDotNet@2 - displayName: ⚙ Install .NET SDK - inputs: - packageType: sdk - version: 6.x - - download: CI - artifact: deployables-Windows - displayName: 🔻 Download deployables-Windows artifact - patterns: 'deployables-Windows/NuGet/*' - - task: GitHubRelease@1 - displayName: 📢 GitHub release (create) - inputs: - gitHubConnection: # TODO: fill in service connection here - repositoryName: $(Build.Repository.Name) - target: $(resources.pipeline.CI.sourceCommit) - tagSource: userSpecifiedTag - tag: v$(resources.pipeline.CI.runName) - title: v$(resources.pipeline.CI.runName) - isDraft: true # After running this step, visit the new draft release, edit, and publish. - isPreRelease: $(IsPrerelease) - assets: $(Pipeline.Workspace)/CI/deployables-Windows/NuGet/*.nupkg - changeLogCompareToRelease: lastNonDraftRelease - changeLogType: issueBased - changeLogLabels: | - [ - { "label" : "breaking change", "displayName" : "Breaking changes", "state" : "closed" }, - { "label" : "bug", "displayName" : "Fixes", "state" : "closed" }, - { "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" } - ] - - script: dotnet nuget push $(Pipeline.Workspace)/CI/deployables-Windows/NuGet/*.nupkg -s https://api.nuget.org/v3/index.json --api-key $(NuGetOrgApiKey) --skip-duplicate - displayName: 📦 Push packages to nuget.org - condition: and(succeeded(), ne(variables['NuGetOrgApiKey'], '')) +extends: + template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate + parameters: + sdl: + sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES + + stages: + - stage: release + jobs: + - job: release + pool: + name: AzurePipelines-EO + demands: + - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT + os: Linux + steps: + - checkout: none + - powershell: | + Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" + if ('$(resources.pipeline.CI.runName)'.Contains('-')) { + Write-Host "##vso[task.setvariable variable=IsPrerelease]true" + } else { + Write-Host "##vso[task.setvariable variable=IsPrerelease]false" + } + displayName: ⚙ Set up pipeline + - task: UseDotNet@2 + displayName: ⚙ Install .NET SDK + inputs: + packageType: sdk + version: 6.x + - download: CI + artifact: deployables-Windows + displayName: 🔻 Download deployables-Windows artifact + patterns: 'deployables-Windows/NuGet/*' + - task: GitHubRelease@1 + displayName: 📢 GitHub release (create) + inputs: + gitHubConnection: # TODO: fill in service connection here + repositoryName: $(Build.Repository.Name) + target: $(resources.pipeline.CI.sourceCommit) + tagSource: userSpecifiedTag + tag: v$(resources.pipeline.CI.runName) + title: v$(resources.pipeline.CI.runName) + isDraft: true # After running this step, visit the new draft release, edit, and publish. + isPreRelease: $(IsPrerelease) + assets: $(Pipeline.Workspace)/CI/deployables-Windows/NuGet/*.nupkg + changeLogCompareToRelease: lastNonDraftRelease + changeLogType: issueBased + changeLogLabels: | + [ + { "label" : "breaking change", "displayName" : "Breaking changes", "state" : "closed" }, + { "label" : "bug", "displayName" : "Fixes", "state" : "closed" }, + { "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" } + ] + - script: dotnet nuget push $(Pipeline.Workspace)/CI/deployables-Windows/NuGet/*.nupkg -s https://api.nuget.org/v3/index.json --api-key $(NuGetOrgApiKey) --skip-duplicate + displayName: 📦 Push packages to nuget.org + condition: and(succeeded(), ne(variables['NuGetOrgApiKey'], '')) diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index c7524559..37257bb2 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -2,6 +2,11 @@ trigger: none # We only want to trigger manually or based on resources pr: none resources: + repositories: + - repository: MicroBuildTemplate + type: git + name: 1ESPipelineTemplates/MicroBuildTemplate + ref: refs/tags/release pipelines: - pipeline: CI source: Library # TODO: This should match the name of your CI pipeline @@ -12,46 +17,52 @@ resources: - Real signed - auto-insertion -jobs: -- job: insertion - displayName: VS insertion - pool: VSEngSS-MicroBuild2022-1ES - steps: - - checkout: none - - powershell: Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" - displayName: ⚙️ Set pipeline name - - task: UseDotNet@2 - displayName: ⚙️ Install .NET SDK - inputs: - packageType: sdk - version: 6.x - - task: NuGetAuthenticate@1 - displayName: 🔏 Authenticate NuGet feeds - inputs: - forceReinstallCredentialProvider: true - - template: release-deployment-prep.yml - - download: CI - artifact: VSInsertion-Windows - displayName: 🔻 Download VSInsertion-Windows artifact - - script: dotnet nuget push $(Pipeline.Workspace)\CI\VSInsertion-windows\*.nupkg -s https://pkgs.dev.azure.com/devdiv/_packaging/VS/nuget/v3/index.json -k azdo --skip-duplicate - displayName: 📦 Push CoreXT packages to VS feed - - task: MicroBuildInsertVsPayload@4 - displayName: 🏭 Insert VS Payload - inputs: - TeamName: $(TeamName) - TeamEmail: $(TeamEmail) - InsertionPayloadName: $(Build.Repository.Name) $(Build.BuildNumber) - InsertionBuildPolicy: Request Perf DDRITs - AutoCompletePR: true - AutoCompleteMergeStrategy: Squash - - task: MicroBuildCleanup@1 - displayName: ☎️ Send Telemetry - - powershell: | - $contentType = 'application/json'; - $headers = @{ Authorization = 'Bearer $(System.AccessToken)' }; - $rawRequest = @{ daysValid = 365 * 2; definitionId = $(resources.pipeline.CI.pipelineID); ownerId = 'User:$(Build.RequestedForId)'; protectPipeline = $false; runId = $(resources.pipeline.CI.runId) }; - $request = ConvertTo-Json @($rawRequest); - Write-Host $request - $uri = "$(System.CollectionUri)$(System.TeamProject)/_apis/build/retention/leases?api-version=6.0-preview.1"; - Invoke-RestMethod -uri $uri -method POST -Headers $headers -ContentType $contentType -Body $request; - displayName: 🗻 Retain inserted builds +extends: + template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate + parameters: + sdl: + sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES + + stages: + - stage: insertion + jobs: + - job: insertion + displayName: VS insertion + pool: VSEngSS-MicroBuild2022-1ES + steps: + - checkout: none + - powershell: Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" + displayName: ⚙️ Set pipeline name + - task: UseDotNet@2 + displayName: ⚙️ Install .NET SDK + inputs: + packageType: sdk + version: 6.x + - task: NuGetAuthenticate@1 + displayName: 🔏 Authenticate NuGet feeds + inputs: + forceReinstallCredentialProvider: true + - template: azure-pipelines/release-deployment-prep.yml@self + - download: CI + artifact: VSInsertion-Windows + displayName: 🔻 Download VSInsertion-Windows artifact + - script: dotnet nuget push $(Pipeline.Workspace)\CI\VSInsertion-windows\*.nupkg -s https://pkgs.dev.azure.com/devdiv/_packaging/VS/nuget/v3/index.json -k azdo --skip-duplicate + displayName: 📦 Push CoreXT packages to VS feed + - task: MicroBuildInsertVsPayload@4 + displayName: 🏭 Insert VS Payload + inputs: + TeamName: $(TeamName) + TeamEmail: $(TeamEmail) + InsertionPayloadName: $(Build.Repository.Name) $(Build.BuildNumber) + InsertionBuildPolicy: Request Perf DDRITs + AutoCompletePR: true + AutoCompleteMergeStrategy: Squash + - powershell: | + $contentType = 'application/json'; + $headers = @{ Authorization = 'Bearer $(System.AccessToken)' }; + $rawRequest = @{ daysValid = 365 * 2; definitionId = $(resources.pipeline.CI.pipelineID); ownerId = 'User:$(Build.RequestedForId)'; protectPipeline = $false; runId = $(resources.pipeline.CI.runId) }; + $request = ConvertTo-Json @($rawRequest); + Write-Host $request + $uri = "$(System.CollectionUri)$(System.TeamProject)/_apis/build/retention/leases?api-version=6.0-preview.1"; + Invoke-RestMethod -uri $uri -method POST -Headers $headers -ContentType $contentType -Body $request; + displayName: 🗻 Retain inserted builds diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index cb9a2072..d60b67cb 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -5,77 +5,88 @@ trigger: none # We only want to trigger manually or based on resources pr: none -stages: -- stage: Build - variables: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages - SignTypeSelection: Real - BuildConfiguration: Release - ValidationBuild: true +resources: + repositories: + - repository: MicroBuildTemplate + type: git + name: 1ESPipelineTemplates/MicroBuildTemplate + ref: refs/tags/release - jobs: - - template: build.yml - parameters: - windowsPool: VSEngSS-MicroBuild2022-1ES - includeMacOS: false - RunTests: false - -- template: prepare-insertion-stages.yml +extends: + template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate parameters: - ArchiveSymbols: false + sdl: + sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES + + stages: + - stage: Build + variables: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages + SignTypeSelection: Real + BuildConfiguration: Release + ValidationBuild: true + + jobs: + - template: /azure-pipelines/build.yml@self + parameters: + windowsPool: VSEngSS-MicroBuild2022-1ES + includeMacOS: false + RunTests: false + + - template: /azure-pipelines/prepare-insertion-stages.yml@self + parameters: + ArchiveSymbols: false -- stage: insertion - displayName: VS insertion - jobs: - - job: insertion - displayName: VS insertion - pool: VSEngSS-MicroBuild2022-1ES - steps: - - checkout: self - clean: true - fetchDepth: 1 - - task: UseDotNet@2 - displayName: ⚙️ Install .NET SDK - inputs: - packageType: sdk - version: 6.x - - task: NuGetAuthenticate@1 - displayName: 🔏 Authenticate NuGet feeds - inputs: - forceReinstallCredentialProvider: true - - download: current - artifact: Variables-Windows - displayName: 🔻 Download Variables-Windows artifact - - powershell: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 - displayName: ⚙️ Set pipeline variables based on artifacts - - download: current - artifact: VSInsertion-Windows - displayName: 🔻 Download VSInsertion-Windows artifact - - script: dotnet nuget push VSInsertion-windows\*.nupkg -s https://pkgs.dev.azure.com/devdiv/_packaging/VS/nuget/v3/index.json -k azdo --skip-duplicate - displayName: 📦 Push CoreXT packages to VS feed - workingDirectory: $(Pipeline.Workspace) - - task: MicroBuildInsertVsPayload@4 - displayName: 🏭 Insert VS Payload - inputs: - TeamName: $(TeamName) - TeamEmail: $(TeamEmail) - InsertionPayloadName: $(Build.Repository.Name) VALIDATION BUILD $(Build.BuildNumber) ($(Build.SourceBranch)) [Skip-SymbolCheck] - InsertionDescription: | - This PR is for **validation purposes only** for !$(System.PullRequest.PullRequestId). **Do not complete**. - CustomScriptExecutionCommand: src/VSSDK/NuGet/AllowUnstablePackages.ps1 - InsertionBuildPolicy: Request Perf DDRITs - InsertionReviewers: $(Build.RequestedForEmail) - AutoCompletePR: false - - powershell: | - $insertionPRId = azure-pipelines/Get-InsertionPRId.ps1 - $Markdown = @" - Validation insertion pull request created: !$insertionPRId - Please check status there before proceeding to merge this PR. - Remember to Abandon and (if allowed) to Delete Source Branch on that insertion PR when validation is complete. - "@ - azure-pipelines/PostPRMessage.ps1 -AccessToken '$(System.AccessToken)' -Markdown $Markdown -Verbose - displayName: ✏️ Comment on pull request - condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) - - task: MicroBuildCleanup@1 - displayName: ☎️ Send Telemetry + - stage: insertion + displayName: VS insertion + jobs: + - job: insertion + displayName: VS insertion + pool: VSEngSS-MicroBuild2022-1ES + steps: + - checkout: self + clean: true + fetchDepth: 1 + - task: UseDotNet@2 + displayName: ⚙️ Install .NET SDK + inputs: + packageType: sdk + version: 6.x + - task: NuGetAuthenticate@1 + displayName: 🔏 Authenticate NuGet feeds + inputs: + forceReinstallCredentialProvider: true + - download: current + artifact: Variables-Windows + displayName: 🔻 Download Variables-Windows artifact + - powershell: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 + displayName: ⚙️ Set pipeline variables based on artifacts + - download: current + artifact: VSInsertion-Windows + displayName: 🔻 Download VSInsertion-Windows artifact + - script: dotnet nuget push VSInsertion-windows\*.nupkg -s https://pkgs.dev.azure.com/devdiv/_packaging/VS/nuget/v3/index.json -k azdo --skip-duplicate + displayName: 📦 Push CoreXT packages to VS feed + workingDirectory: $(Pipeline.Workspace) + - task: MicroBuildInsertVsPayload@4 + displayName: 🏭 Insert VS Payload + inputs: + TeamName: $(TeamName) + TeamEmail: $(TeamEmail) + InsertionPayloadName: $(Build.Repository.Name) VALIDATION BUILD $(Build.BuildNumber) ($(Build.SourceBranch)) [Skip-SymbolCheck] + InsertionDescription: | + This PR is for **validation purposes only** for !$(System.PullRequest.PullRequestId). **Do not complete**. + CustomScriptExecutionCommand: src/VSSDK/NuGet/AllowUnstablePackages.ps1 + InsertionBuildPolicy: Request Perf DDRITs + InsertionReviewers: $(Build.RequestedForEmail) + AutoCompletePR: false + - powershell: | + $insertionPRId = azure-pipelines/Get-InsertionPRId.ps1 + $Markdown = @" + Validation insertion pull request created: !$insertionPRId + Please check status there before proceeding to merge this PR. + Remember to Abandon and (if allowed) to Delete Source Branch on that insertion PR when validation is complete. + "@ + azure-pipelines/PostPRMessage.ps1 -AccessToken '$(System.AccessToken)' -Markdown $Markdown -Verbose + displayName: ✏️ Comment on pull request + condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) From 220142fcadc255a686839652b2f11f5c69204095 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 26 Jan 2024 12:47:22 -0700 Subject: [PATCH 699/889] Switch vs-validation pipeline to Unofficial template --- azure-pipelines/vs-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index d60b67cb..137acbe4 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -13,7 +13,7 @@ resources: ref: refs/tags/release extends: - template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate + template: azure-pipelines/MicroBuild.1ES.Unofficial.yml@MicroBuildTemplate parameters: sdl: sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES From 4d1473c2924f40f02578e70a053ba666e6531ae1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 13:16:00 -0700 Subject: [PATCH 700/889] Bump dotnet-coverage from 17.9.6 to 17.10.1Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.9.6 to 17.10.1.- [Commits](https://github.com/microsoft/codecoverage/commits)---updated-dependencies:- dependency-name: dotnet-coverage dependency-type: direct:production update-type: version-update:semver-minor...Signed-off-by: dependabot[bot] * Bump dotnet-coverage from 17.9.6 to 17.10.1 Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.9.6 to 17.10.1. - [Commits](https://github.com/microsoft/codecoverage/commits) --- updated-dependencies: - dependency-name: dotnet-coverage dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 589f0604..5941f4c8 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -9,7 +9,7 @@ ] }, "dotnet-coverage": { - "version": "17.9.6", + "version": "17.10.1", "commands": [ "dotnet-coverage" ] From ebb0607dd933ae5b44ee473eec4ff8716cd211d6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 29 Jan 2024 17:05:36 -0700 Subject: [PATCH 701/889] Format init.ps1 --- init.ps1 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/init.ps1 b/init.ps1 index 00a9589b..e2849855 100755 --- a/init.ps1 +++ b/init.ps1 @@ -84,8 +84,7 @@ try { $HeaderColor = 'Green' $RestoreArguments = @() - if ($Interactive) - { + if ($Interactive) { $RestoreArguments += '--interactive' } @@ -98,10 +97,10 @@ try { } if (!$NoToolRestore -and $PSCmdlet.ShouldProcess("dotnet tool", "restore")) { - dotnet tool restore @RestoreArguments - if ($lastexitcode -ne 0) { - throw "Failure while restoring dotnet CLI tools." - } + dotnet tool restore @RestoreArguments + if ($lastexitcode -ne 0) { + throw "Failure while restoring dotnet CLI tools." + } } & "$PSScriptRoot/tools/Set-EnvVars.ps1" -Variables $EnvVars -PrependPath $PrependPath | Out-Null From 72b8ba01196c0fcb51db7cf36335d2ce04f15be5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 31 Jan 2024 12:21:32 -0700 Subject: [PATCH 702/889] Fix NUGET_PACKAGES path in pipelines By default the NUGET_PACKAGES path has a trailing slash. In our override, we should do this as well or the msbuild property that gets generated is missing the slash, which can break some builds. This follows the pattern in 9805678248d0fbda63f97982f37e35de71890d2f, which only applied to one of the locations that in the microbuild branch we must change. --- azure-pipelines/official.yml | 4 ++-- azure-pipelines/vs-validation.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 915c7e76..a57cdc34 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -60,7 +60,7 @@ extends: variables: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release - NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages + NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ SignTypeSelection: ${{ parameters.SignTypeSelection }} Packaging.EnableSBOMSigning: false Codeql.Enabled: true @@ -92,7 +92,7 @@ extends: variables: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release - NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages + NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ SignTypeSelection: ${{ parameters.SignTypeSelection }} Packaging.EnableSBOMSigning: false Codeql.Enabled: true diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index 137acbe4..8ca0b33a 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -22,7 +22,7 @@ extends: - stage: Build variables: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages + NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ SignTypeSelection: Real BuildConfiguration: Release ValidationBuild: true From 9f902a1a59452d115c99edf232fbd7635530a755 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 1 Feb 2024 17:06:13 -0700 Subject: [PATCH 703/889] Fix the pool for pushing real-signed packages to be 1ES PT compliant --- azure-pipelines/prepare-insertion-stages.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index f805607e..6b0a91b4 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -36,7 +36,9 @@ stages: # dependsOn: symbol_archive # pool: # name: AzurePipelines-EO - # vmImage: AzurePipelinesUbuntu20.04compliant + # demands: + # - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT + # os: Linux # steps: # - checkout: none # - download: current From 65f2106cda0b367d5471e820458ef73e2206ff68 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 2 Feb 2024 12:14:01 -0700 Subject: [PATCH 704/889] Set TeamName variable in `push` job This avoids a pipeline break due to a Microbuild pipeline template injected telemetry task. --- azure-pipelines/prepare-insertion-stages.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index 6b0a91b4..f1d5ab89 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -42,6 +42,11 @@ stages: # steps: # - checkout: none # - download: current + # artifact: Variables-Windows + # displayName: 🔻 Download Variables-Windows artifact + # - powershell: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 + # displayName: ⚙️ Set pipeline variables based on artifacts + # - download: current # artifact: deployables-Windows # displayName: 🔻 Download deployables-Windows artifact # - task: UseDotNet@2 From bb38a7296be221aa5b81d54cbd28377ae5973d20 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 2 Feb 2024 10:59:02 -0700 Subject: [PATCH 705/889] Fix break when the RunTests parameter is false --- azure-pipelines/build.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 64e97cf7..481447b2 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -47,10 +47,11 @@ jobs: outputParentDirectory: $(Build.ArtifactStagingDirectory) outputs: - ${{ each artifact_name in parameters.artifact_names }}: - - output: pipelineArtifact - displayName: 📢 Publish ${{ artifact_name }}-Windows - targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-Windows - artifactName: ${{ artifact_name }}-Windows + - ${{ if or(ne(artifact_name, 'testResults'), parameters.RunTests) }}: + - output: pipelineArtifact + displayName: 📢 Publish ${{ artifact_name }}-Windows + targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-Windows + artifactName: ${{ artifact_name }}-Windows - output: pipelineArtifact displayName: 📢 Publish VSInsertion-Windows targetPath: $(Build.ArtifactStagingDirectory)/VSInsertion-Windows From 83d4a12c8b03fa109e7608875ee2225c467fb631 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 5 Feb 2024 12:12:53 -0700 Subject: [PATCH 706/889] Push nuget packages in 1ES compliant way --- azure-pipelines/prepare-insertion-stages.yml | 22 +++++++++----------- azure-pipelines/release.yml | 21 +++++++++---------- azure-pipelines/vs-insertion.yml | 16 ++++++-------- azure-pipelines/vs-validation.yml | 17 ++++++--------- 4 files changed, 32 insertions(+), 44 deletions(-) diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index f1d5ab89..98e5232c 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -39,6 +39,16 @@ stages: # demands: # - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT # os: Linux + # templateContext: + # outputParentDirectory: $(Pipeline.Workspace) + # outputs: + # - output: nuget + # displayName: 📦 Push nuget packages + # packagesToPush: '(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg' + # packageParentPath: (Pipeline.Workspace)/deployables-Windows/NuGet + # allowPackageConflicts: true + # nuGetFeedType: external + # publishFeedCredentials: azure-public/vs-impl # steps: # - checkout: none # - download: current @@ -49,15 +59,3 @@ stages: # - download: current # artifact: deployables-Windows # displayName: 🔻 Download deployables-Windows artifact - # - task: UseDotNet@2 - # displayName: ⚙️ Install .NET SDK - # inputs: - # packageType: sdk - # version: 6.x - # - task: NuGetAuthenticate@1 - # displayName: 🔏 Authenticate NuGet feeds - # inputs: - # nuGetServiceConnections: azure-public/vs-impl - # forceReinstallCredentialProvider: true - # - script: dotnet nuget push $(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg -s https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json --api-key azdo --skip-duplicate - # displayName: 📦 Push nuget packages diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index d949958f..8b371771 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -14,9 +14,6 @@ resources: tags: - auto-release -variables: -- group: VS SDK feeds # Expected to provide NuGetOrgApiKey - extends: template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate parameters: @@ -32,6 +29,16 @@ extends: demands: - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT os: Linux + templateContext: + outputParentDirectory: $(Pipeline.Workspace) + outputs: + - output: nuget + displayName: 📦 Push packages to nuget.org + packagesToPush: '$(Pipeline.Workspace)/CI/deployables-Windows/NuGet/*.nupkg' + packageParentPath: $(Pipeline.Workspace)/CI/deployables-Windows/NuGet + allowPackageConflicts: true + nuGetFeedType: external + publishFeedCredentials: VisualStudioExtensibility (nuget.org) steps: - checkout: none - powershell: | @@ -42,11 +49,6 @@ extends: Write-Host "##vso[task.setvariable variable=IsPrerelease]false" } displayName: ⚙ Set up pipeline - - task: UseDotNet@2 - displayName: ⚙ Install .NET SDK - inputs: - packageType: sdk - version: 6.x - download: CI artifact: deployables-Windows displayName: 🔻 Download deployables-Windows artifact @@ -71,6 +73,3 @@ extends: { "label" : "bug", "displayName" : "Fixes", "state" : "closed" }, { "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" } ] - - script: dotnet nuget push $(Pipeline.Workspace)/CI/deployables-Windows/NuGet/*.nupkg -s https://api.nuget.org/v3/index.json --api-key $(NuGetOrgApiKey) --skip-duplicate - displayName: 📦 Push packages to nuget.org - condition: and(succeeded(), ne(variables['NuGetOrgApiKey'], '')) diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 37257bb2..b958134b 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -33,21 +33,17 @@ extends: - checkout: none - powershell: Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" displayName: ⚙️ Set pipeline name - - task: UseDotNet@2 - displayName: ⚙️ Install .NET SDK - inputs: - packageType: sdk - version: 6.x - - task: NuGetAuthenticate@1 - displayName: 🔏 Authenticate NuGet feeds - inputs: - forceReinstallCredentialProvider: true - template: azure-pipelines/release-deployment-prep.yml@self - download: CI artifact: VSInsertion-Windows displayName: 🔻 Download VSInsertion-Windows artifact - - script: dotnet nuget push $(Pipeline.Workspace)\CI\VSInsertion-windows\*.nupkg -s https://pkgs.dev.azure.com/devdiv/_packaging/VS/nuget/v3/index.json -k azdo --skip-duplicate + - task: 1ES.PublishNuget@1 displayName: 📦 Push CoreXT packages to VS feed + inputs: + packagesToPush: '$(Pipeline.Workspace)/CI/VSInsertion-Windows/*.nupkg' + packageParentPath: $(Pipeline.Workspace)/CI/VSInsertion-Windows + allowPackageConflicts: true + publishVstsFeed: VS - task: MicroBuildInsertVsPayload@4 displayName: 🏭 Insert VS Payload inputs: diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index 8ca0b33a..176ec1bb 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -48,15 +48,6 @@ extends: - checkout: self clean: true fetchDepth: 1 - - task: UseDotNet@2 - displayName: ⚙️ Install .NET SDK - inputs: - packageType: sdk - version: 6.x - - task: NuGetAuthenticate@1 - displayName: 🔏 Authenticate NuGet feeds - inputs: - forceReinstallCredentialProvider: true - download: current artifact: Variables-Windows displayName: 🔻 Download Variables-Windows artifact @@ -65,9 +56,13 @@ extends: - download: current artifact: VSInsertion-Windows displayName: 🔻 Download VSInsertion-Windows artifact - - script: dotnet nuget push VSInsertion-windows\*.nupkg -s https://pkgs.dev.azure.com/devdiv/_packaging/VS/nuget/v3/index.json -k azdo --skip-duplicate + - task: 1ES.PublishNuget@1 displayName: 📦 Push CoreXT packages to VS feed - workingDirectory: $(Pipeline.Workspace) + inputs: + packagesToPush: '$(Pipeline.Workspace)/VSInsertion-Windows/*.nupkg' + packageParentPath: $(Pipeline.Workspace)/VSInsertion-Windows + allowPackageConflicts: true + publishVstsFeed: VS - task: MicroBuildInsertVsPayload@4 displayName: 🏭 Insert VS Payload inputs: From fa2fa4a1717ac1f7dfcb3bad56fd24e95a3b7184 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 5 Feb 2024 20:27:23 -0700 Subject: [PATCH 707/889] Fix pipeline failures when tests are turned off Finishes what bb38a7296be221 started --- azure-pipelines/build.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 481447b2..89605d92 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -97,10 +97,11 @@ jobs: outputParentDirectory: $(Build.ArtifactStagingDirectory) outputs: - ${{ each artifact_name in parameters.artifact_names }}: - - output: pipelineArtifact - displayName: 📢 Publish ${{ artifact_name }}-Linux - targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-Linux - artifactName: ${{ artifact_name }}-Linux + - ${{ if or(ne(artifact_name, 'testResults'), parameters.RunTests) }}: + - output: pipelineArtifact + displayName: 📢 Publish ${{ artifact_name }}-Linux + targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-Linux + artifactName: ${{ artifact_name }}-Linux steps: - checkout: self fetchDepth: 0 # avoid shallow clone so nbgv can do its work. @@ -121,10 +122,11 @@ jobs: outputParentDirectory: $(Build.ArtifactStagingDirectory) outputs: - ${{ each artifact_name in parameters.artifact_names }}: - - output: pipelineArtifact - displayName: 📢 Publish ${{ artifact_name }}-macOS - targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-macOS - artifactName: ${{ artifact_name }}-macOS + - ${{ if or(ne(artifact_name, 'testResults'), parameters.RunTests) }}: + - output: pipelineArtifact + displayName: 📢 Publish ${{ artifact_name }}-macOS + targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-macOS + artifactName: ${{ artifact_name }}-macOS steps: - checkout: self fetchDepth: 0 # avoid shallow clone so nbgv can do its work. From 20d7eb1dec040f5a086e783674d1a6c6f76e8070 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 5 Feb 2024 19:55:23 -0700 Subject: [PATCH 708/889] Fix name of stage task --- azure-pipelines/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 61c96a35..546e9083 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -18,7 +18,7 @@ steps: - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - powershell: azure-pipelines/artifacts/_pipelines.ps1 -StageOnly -AvoidSymbolicLinks -ArtifactNameSuffix "-$(Agent.JobName)" -Verbose failOnStderr: true - displayName: 📢 Publish artifacts + displayName: 📢 Stage artifacts condition: succeededOrFailed() - ${{ if ne(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: From aab283cf8435ed07bab3310201f528dbcd49fd36 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 5 Feb 2024 20:08:30 -0700 Subject: [PATCH 709/889] Migrate Microbuild-required variables to a yaml file These need to be set before we have a chance to run our variable ps1 scripts. --- azure-pipelines/GlobalVariables.yml | 4 ++++ azure-pipelines/official.yml | 3 +++ azure-pipelines/variables/TeamEmail.ps1 | 1 - azure-pipelines/variables/TeamName.ps1 | 2 -- azure-pipelines/vs-insertion.yml | 5 +++-- azure-pipelines/vs-validation.yml | 5 +++-- 6 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 azure-pipelines/GlobalVariables.yml delete mode 100644 azure-pipelines/variables/TeamEmail.ps1 delete mode 100644 azure-pipelines/variables/TeamName.ps1 diff --git a/azure-pipelines/GlobalVariables.yml b/azure-pipelines/GlobalVariables.yml new file mode 100644 index 00000000..b2d1d532 --- /dev/null +++ b/azure-pipelines/GlobalVariables.yml @@ -0,0 +1,4 @@ +variables: + # These variables are required for MicroBuild tasks + TeamName: VS IDE + TeamEmail: vsidemicrobuild@microsoft.com diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index a57cdc34..1769431e 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -49,6 +49,9 @@ resources: name: 1ESPipelineTemplates/MicroBuildTemplate ref: refs/tags/release +variables: +- template: GlobalVariables.yml + extends: ${{ if parameters.EnableCompliance }}: template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate diff --git a/azure-pipelines/variables/TeamEmail.ps1 b/azure-pipelines/variables/TeamEmail.ps1 deleted file mode 100644 index 7cf66982..00000000 --- a/azure-pipelines/variables/TeamEmail.ps1 +++ /dev/null @@ -1 +0,0 @@ -'vsidemicrobuild@microsoft.com' diff --git a/azure-pipelines/variables/TeamName.ps1 b/azure-pipelines/variables/TeamName.ps1 deleted file mode 100644 index ba9c8231..00000000 --- a/azure-pipelines/variables/TeamName.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -# This value is used as an input to the MicroBuild Insert VS task. -'VS IDE' diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index b958134b..c948b713 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -17,6 +17,9 @@ resources: - Real signed - auto-insertion +variables: +- template: GlobalVariables.yml + extends: template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate parameters: @@ -47,8 +50,6 @@ extends: - task: MicroBuildInsertVsPayload@4 displayName: 🏭 Insert VS Payload inputs: - TeamName: $(TeamName) - TeamEmail: $(TeamEmail) InsertionPayloadName: $(Build.Repository.Name) $(Build.BuildNumber) InsertionBuildPolicy: Request Perf DDRITs AutoCompletePR: true diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index 176ec1bb..062a5abf 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -12,6 +12,9 @@ resources: name: 1ESPipelineTemplates/MicroBuildTemplate ref: refs/tags/release +variables: +- template: GlobalVariables.yml + extends: template: azure-pipelines/MicroBuild.1ES.Unofficial.yml@MicroBuildTemplate parameters: @@ -66,8 +69,6 @@ extends: - task: MicroBuildInsertVsPayload@4 displayName: 🏭 Insert VS Payload inputs: - TeamName: $(TeamName) - TeamEmail: $(TeamEmail) InsertionPayloadName: $(Build.Repository.Name) VALIDATION BUILD $(Build.BuildNumber) ($(Build.SourceBranch)) [Skip-SymbolCheck] InsertionDescription: | This PR is for **validation purposes only** for !$(System.PullRequest.PullRequestId). **Do not complete**. From 315a51ed3ed287e09d4d72cd4b4e48a285c96b9d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 5 Feb 2024 18:24:12 -0700 Subject: [PATCH 710/889] Migrate SBOM plugin installation to the new template style --- azure-pipelines/build.yml | 3 +++ azure-pipelines/microbuild.before.yml | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 89605d92..64daed4f 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -44,6 +44,9 @@ jobs: - group: VSCloudServices-APIScan # Expected to provide ApiScanClientId, ApiScanSecret, ApiScanTenant ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: templateContext: + mb: + sbom: + enabled: true outputParentDirectory: $(Build.ArtifactStagingDirectory) outputs: - ${{ each artifact_name in parameters.artifact_names }}: diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index adb5ccc8..f5e1047f 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -16,7 +16,3 @@ steps: zipSources: false displayName: 🔧 Install MicroBuild Signing Plugin condition: and(succeeded(), or(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['SignType'], 'real'))) - -- task: MicroBuildSbomPlugin@1 - displayName: 🔧 Install MicroBuild Sbom Plugin - condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) From e4fed75c0386011cd6d4d177ecd1bcc22612c3d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 05:49:52 -0700 Subject: [PATCH 711/889] Bump dotnet-coverage from 17.10.1 to 17.10.2 (#250) Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.10.1 to 17.10.2. - [Commits](https://github.com/microsoft/codecoverage/commits) --- updated-dependencies: - dependency-name: dotnet-coverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 5941f4c8..6eff0445 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -9,7 +9,7 @@ ] }, "dotnet-coverage": { - "version": "17.10.1", + "version": "17.10.2", "commands": [ "dotnet-coverage" ] From 9374605db8f41fb296a391c1b73c0c2adbb06c98 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 5 Feb 2024 18:24:31 -0700 Subject: [PATCH 712/889] Add placeholder for localization plugin It's disabled by default, but is easy to turn on. --- azure-pipelines/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 64daed4f..2ef058bf 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -47,6 +47,10 @@ jobs: mb: sbom: enabled: true + localization: + enabled: false + ${{ if eq(variables['Build.Reason'], 'pullRequest') }}: + languages: ENU,JPN outputParentDirectory: $(Build.ArtifactStagingDirectory) outputs: - ${{ each artifact_name in parameters.artifact_names }}: From 1c3dadb97af9d7211a927c4229ea07db8b7f42cf Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 5 Feb 2024 19:53:56 -0700 Subject: [PATCH 713/889] Migrate signing plugin installation to the new template style By requiring opt-in to sign on mac/linux, we remove the need for signing re-approval on pipelines that are already signing. It also avoids signing binaries that typically will not ship anyway. --- azure-pipelines/build.yml | 20 ++++++++++++++++++++ azure-pipelines/microbuild.before.yml | 7 ------- azure-pipelines/official.yml | 17 ++++++++++------- azure-pipelines/prepare-insertion-stages.yml | 5 ++++- azure-pipelines/variables/SignType.ps1 | 11 ----------- azure-pipelines/vs-validation.yml | 3 ++- 6 files changed, 36 insertions(+), 27 deletions(-) delete mode 100644 azure-pipelines/variables/SignType.ps1 diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 2ef058bf..d110df1d 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -1,4 +1,7 @@ parameters: +- name: RealSign + type: boolean + default: false - name: windowsPool type: object default: @@ -45,6 +48,13 @@ jobs: ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: templateContext: mb: + signing: + enabled: true + zipSources: false + ${{ if or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }}: + signType: real + ${{ else }}: + signType: test sbom: enabled: true localization: @@ -101,6 +111,11 @@ jobs: pool: ${{ parameters.linuxPool }} ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: templateContext: + mb: + ${{ if or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }}: + signing: + enabled: false # enable when building unique artifacts on this agent that must be signed + signType: real outputParentDirectory: $(Build.ArtifactStagingDirectory) outputs: - ${{ each artifact_name in parameters.artifact_names }}: @@ -126,6 +141,11 @@ jobs: pool: ${{ parameters.macOSPool }} ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: templateContext: + mb: + ${{ if or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }}: + signing: + enabled: false # enable when building unique artifacts on this agent that must be signed + signType: real outputParentDirectory: $(Build.ArtifactStagingDirectory) outputs: - ${{ each artifact_name in parameters.artifact_names }}: diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index f5e1047f..8e9c8c6a 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -9,10 +9,3 @@ steps: outputformat: text condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) retryCountOnTaskFailure: 3 # fails when the cloud service is overloaded - -- task: MicroBuildSigningPlugin@4 - inputs: - signType: $(SignType) - zipSources: false - displayName: 🔧 Install MicroBuild Signing Plugin - condition: and(succeeded(), or(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['SignType'], 'real'))) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 1769431e..3a506b91 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -20,11 +20,10 @@ trigger: # - microbuild parameters: -- name: SignTypeSelection - displayName: Sign type - type: string - default: Test - values: [ 'Test', 'Real' ] +- name: RealSign + displayName: Real sign? + type: boolean + default: false - name: includeMacOS displayName: Build on macOS type: boolean @@ -64,12 +63,12 @@ extends: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ - SignTypeSelection: ${{ parameters.SignTypeSelection }} Packaging.EnableSBOMSigning: false Codeql.Enabled: true jobs: - template: /azure-pipelines/build.yml@self parameters: + RealSign: ${{ parameters.RealSign }} EnableCompliance: ${{ parameters.EnableCompliance }} EnableAPIScan: ${{ parameters.EnableAPIScan }} windowsPool: VSEngSS-MicroBuild2022-1ES @@ -85,6 +84,8 @@ extends: includeMacOS: ${{ parameters.includeMacOS }} RunTests: ${{ parameters.RunTests }} - template: /azure-pipelines/prepare-insertion-stages.yml@self + parameters: + RealSign: ${{ parameters.RealSign }} ${{ else }}: template: azure-pipelines/MicroBuild.1ES.Unofficial.yml@MicroBuildTemplate parameters: @@ -96,12 +97,12 @@ extends: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ - SignTypeSelection: ${{ parameters.SignTypeSelection }} Packaging.EnableSBOMSigning: false Codeql.Enabled: true jobs: - template: /azure-pipelines/build.yml@self parameters: + RealSign: ${{ parameters.RealSign }} EnableCompliance: ${{ parameters.EnableCompliance }} EnableAPIScan: ${{ parameters.EnableAPIScan }} windowsPool: VSEngSS-MicroBuild2022-1ES @@ -117,3 +118,5 @@ extends: includeMacOS: ${{ parameters.includeMacOS }} RunTests: ${{ parameters.RunTests }} - template: /azure-pipelines/prepare-insertion-stages.yml@self + parameters: + RealSign: ${{ parameters.RealSign }} diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index 98e5232c..821054aa 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -2,11 +2,14 @@ parameters: - name: ArchiveSymbols type: boolean default: true +- name: RealSign + displayName: Real sign? + type: boolean stages: - stage: release displayName: Publish - condition: and(succeeded(), eq(dependencies.Build.outputs['Windows.SetPipelineVariables.SignType'], 'Real')) + condition: and(succeeded(), eq('${{ parameters.RealSign }}', 'true')) jobs: - ${{ if parameters.ArchiveSymbols }}: - job: symbol_archive diff --git a/azure-pipelines/variables/SignType.ps1 b/azure-pipelines/variables/SignType.ps1 deleted file mode 100644 index 0c1a335a..00000000 --- a/azure-pipelines/variables/SignType.ps1 +++ /dev/null @@ -1,11 +0,0 @@ -if ($env:SYSTEM_COLLECTIONID -eq '011b8bdf-6d56-4f87-be0d-0092136884d9') { - if ($env:BUILD_REASON -eq 'Schedule') { - 'real' - } else { - if ($env:SIGNTYPESELECTION) { - $env:SIGNTYPESELECTION - } else { - 'test' - } - } - } diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index 062a5abf..742b73d7 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -26,13 +26,13 @@ extends: variables: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ - SignTypeSelection: Real BuildConfiguration: Release ValidationBuild: true jobs: - template: /azure-pipelines/build.yml@self parameters: + RealSign: true windowsPool: VSEngSS-MicroBuild2022-1ES includeMacOS: false RunTests: false @@ -40,6 +40,7 @@ extends: - template: /azure-pipelines/prepare-insertion-stages.yml@self parameters: ArchiveSymbols: false + RealSign: ${{ parameters.RealSign }} - stage: insertion displayName: VS insertion From 0ed99f2668434d9f3519cd49791de64a3ba338df Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 6 Feb 2024 12:50:10 -0700 Subject: [PATCH 714/889] Bump MicroBuild to 2.0.149 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index a2ca4d22..649d94cf 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true true - 2.0.147 + 2.0.149 From f8b892b0a524b5bfe70f0dbfd6e34d450bb0d3a4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 6 Feb 2024 18:50:57 -0700 Subject: [PATCH 715/889] Remove compliance tasks These are redundant with those injected by 1ES PT. --- azure-pipelines/build.yml | 6 ----- azure-pipelines/secure-development-tools.yml | 24 -------------------- 2 files changed, 30 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index d110df1d..03fd0ff7 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -73,12 +73,6 @@ jobs: displayName: 📢 Publish VSInsertion-Windows targetPath: $(Build.ArtifactStagingDirectory)/VSInsertion-Windows artifactName: VSInsertion-Windows - # This is useful when false positives appear so we can copy some of the output into the suppressions file. - - output: pipelineArtifact - displayName: 📢 Publish Guardian failures - targetPath: $(Build.ArtifactStagingDirectory)/guardian_failures_as_suppressions - artifactName: guardian_failures_as_suppressions - condition: failed() steps: - checkout: self fetchDepth: 0 # avoid shallow clone so nbgv can do its work. diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index 1bbacefe..ad254e21 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -30,27 +30,3 @@ steps: condition: and(succeeded(), ${{ parameters.EnableAPIScan }}, ne(variables.ApiScanClientId, '')) env: AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) - -- task: SdtReport@2 - displayName: 📃 Create Security Analysis Report - inputs: - GdnExportAllTools: true - -- task: PublishSecurityAnalysisLogs@3 - displayName: 📢 Publish Code Analysis Logs - inputs: - ArtifactName: CodeAnalysisLogs - ArtifactType: Container - PublishProcessedResults: true - AllTools: true - ToolLogsNotFoundAction: Standard - -- task: PostAnalysis@2 - displayName: 🏋️‍♀️ Break on compliance issues - inputs: - GdnBreakAllTools: true - GdnBreakGdnToolBinSkimSeverity: Warning - GdnBreakSuppressionFiles: $(System.DefaultWorkingDirectory)/azure-pipelines/falsepositives.gdnsuppress - GdnBreakSuppressionSets: falsepositives - GdnBreakOutputSuppressionFile: $(Build.ArtifactStagingDirectory)/guardian_failures_as_suppressions/ - GdnBreakOutputSuppressionSet: falsepositives From 1ce395c70e63b9b6ec8464f8adf74828ddc67cf6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 7 Feb 2024 12:17:39 -0700 Subject: [PATCH 716/889] Bring back PoliCheck --- azure-pipelines/secure-development-tools.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index ad254e21..b0c33cf6 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -6,6 +6,13 @@ steps: - powershell: echo "##vso[build.addbuildtag]compliance" displayName: 🏷️ Tag run with 'compliance' +- task: PoliCheck@2 + displayName: 🔍 Run PoliCheck + inputs: + targetType: F + targetArgument: $(System.DefaultWorkingDirectory) + optionsUEPATH: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml + - task: CopyFiles@2 displayName: 📂 Collect APIScan inputs inputs: From 9e2495e991734fed6c5d26df3eb7cc903fa234a6 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 7 Feb 2024 13:54:30 -0700 Subject: [PATCH 717/889] Drop Codeql.Enabled variable CodeQL is injected by default by the 1ES PT templates now, so we don't need this variable. --- azure-pipelines/official.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 3a506b91..68af7f75 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -64,7 +64,6 @@ extends: BuildConfiguration: Release NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ Packaging.EnableSBOMSigning: false - Codeql.Enabled: true jobs: - template: /azure-pipelines/build.yml@self parameters: @@ -98,7 +97,6 @@ extends: BuildConfiguration: Release NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ Packaging.EnableSBOMSigning: false - Codeql.Enabled: true jobs: - template: /azure-pipelines/build.yml@self parameters: From 38502866e53e42f2027474bb97e90f1d0fb8ff68 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 7 Feb 2024 14:30:26 -0700 Subject: [PATCH 718/889] File bugs for APIScan issues --- azure-pipelines/TSAOptions.json | 19 +++++++++++++++++++ azure-pipelines/secure-development-tools.yml | 8 ++++++++ 2 files changed, 27 insertions(+) create mode 100644 azure-pipelines/TSAOptions.json diff --git a/azure-pipelines/TSAOptions.json b/azure-pipelines/TSAOptions.json new file mode 100644 index 00000000..6dfeac4c --- /dev/null +++ b/azure-pipelines/TSAOptions.json @@ -0,0 +1,19 @@ +{ + "tsaVersion": "TsaV2", + "codebase": "NewOrUpdate", + "codebaseName": "LibraryName", + "tsaStamp": "DevDiv", + "tsaEnvironment": "PROD", + "notificationAliases": [ + "vsidemicrobuild@microsoft.com" + ], + "codebaseAdmins": [ + "REDMOND\\andarno" + ], + "instanceUrl": "https://devdiv.visualstudio.com", + "projectName": "DevDiv", + "areaPath": "DevDiv\\VS Core", + "iterationPath": "DevDiv", + "alltools": true, + "repositoryName": "Library.Template" +} diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index b0c33cf6..4ed67dc0 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -37,3 +37,11 @@ steps: condition: and(succeeded(), ${{ parameters.EnableAPIScan }}, ne(variables.ApiScanClientId, '')) env: AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) + +# File bugs when APIScan finds issues +- task: TSAUpload@2 + displayName: 🪳 TSA upload + inputs: + GdnPublishTsaOnboard: True + GdnPublishTsaConfigFile: $(Build.SourcesDirectory)\azure-pipelines\TSAOptions.json + condition: false # enable in individual repos only AFTER updating TSAOptions.json with your own values From 863c52418aea159620ccdba978bf70cff6bfae1f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 7 Feb 2024 14:22:20 -0700 Subject: [PATCH 719/889] Move Policheck to the 1ES PT --- azure-pipelines/official.yml | 10 ++++++++++ azure-pipelines/secure-development-tools.yml | 7 ------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 68af7f75..f48535e4 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -57,6 +57,11 @@ extends: parameters: sdl: sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES + policheck: + enabled: ${{ parameters.EnableCompliance }} + exclusionsFile: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml + suppression: + suppressionFile: $(System.DefaultWorkingDirectory)\azure-pipelines\falsepositives.gdnsuppress stages: - stage: Build variables: @@ -90,6 +95,11 @@ extends: parameters: sdl: sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES + policheck: + enabled: ${{ parameters.EnableCompliance }} + exclusionsFile: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml + suppression: + suppressionFile: $(System.DefaultWorkingDirectory)\azure-pipelines\falsepositives.gdnsuppress stages: - stage: Build variables: diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index 4ed67dc0..9b1aeaa0 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -6,13 +6,6 @@ steps: - powershell: echo "##vso[build.addbuildtag]compliance" displayName: 🏷️ Tag run with 'compliance' -- task: PoliCheck@2 - displayName: 🔍 Run PoliCheck - inputs: - targetType: F - targetArgument: $(System.DefaultWorkingDirectory) - optionsUEPATH: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml - - task: CopyFiles@2 displayName: 📂 Collect APIScan inputs inputs: From 42d183755210479986b9cff6075cddb7f4741e62 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 7 Feb 2024 14:53:54 -0700 Subject: [PATCH 720/889] Disable Policheck on non-compliance runs --- azure-pipelines/official.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index f48535e4..e1a732bb 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -58,7 +58,7 @@ extends: sdl: sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES policheck: - enabled: ${{ parameters.EnableCompliance }} + enabled: true exclusionsFile: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml suppression: suppressionFile: $(System.DefaultWorkingDirectory)\azure-pipelines\falsepositives.gdnsuppress @@ -95,9 +95,6 @@ extends: parameters: sdl: sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES - policheck: - enabled: ${{ parameters.EnableCompliance }} - exclusionsFile: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml suppression: suppressionFile: $(System.DefaultWorkingDirectory)\azure-pipelines\falsepositives.gdnsuppress stages: From 3c87039a3ce8d40e48b9d5f3c3690fba33b8677a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 8 Feb 2024 11:49:42 -0700 Subject: [PATCH 721/889] Fix missing TeamEmail and TeamName in insertVS task --- azure-pipelines/vs-insertion.yml | 2 ++ azure-pipelines/vs-validation.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index c948b713..87166f29 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -50,6 +50,8 @@ extends: - task: MicroBuildInsertVsPayload@4 displayName: 🏭 Insert VS Payload inputs: + TeamName: $(TeamName) + TeamEmail: $(TeamEmail) InsertionPayloadName: $(Build.Repository.Name) $(Build.BuildNumber) InsertionBuildPolicy: Request Perf DDRITs AutoCompletePR: true diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index 742b73d7..5ebf0c71 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -70,6 +70,8 @@ extends: - task: MicroBuildInsertVsPayload@4 displayName: 🏭 Insert VS Payload inputs: + TeamName: $(TeamName) + TeamEmail: $(TeamEmail) InsertionPayloadName: $(Build.Repository.Name) VALIDATION BUILD $(Build.BuildNumber) ($(Build.SourceBranch)) [Skip-SymbolCheck] InsertionDescription: | This PR is for **validation purposes only** for !$(System.PullRequest.PullRequestId). **Do not complete**. From 5e36c8bed0cc5597783a0a71c013e0f4801064f0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 9 Feb 2024 10:06:45 -0700 Subject: [PATCH 722/889] Drop ComponentGovernance from the pipeline 1ES PT includes it already. --- azure-pipelines/microbuild.before.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index 8e9c8c6a..c53ae9a6 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -1,7 +1,4 @@ steps: -- task: ComponentGovernanceComponentDetection@0 - displayName: 🔍 Component Detection - - task: notice@0 displayName: 🛠️ Generate NOTICE file inputs: From 420207fd6383bbcea6408fdaf4f719bf8434913f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 9 Feb 2024 19:54:55 +0000 Subject: [PATCH 723/889] Recommend prettier --- .prettierrc.yaml | 0 .vscode/extensions.json | 1 + 2 files changed, 1 insertion(+) create mode 100644 .prettierrc.yaml diff --git a/.prettierrc.yaml b/.prettierrc.yaml new file mode 100644 index 00000000..e69de29b diff --git a/.vscode/extensions.json b/.vscode/extensions.json index ca3a2aa9..acaf0213 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -7,6 +7,7 @@ "ms-dotnettools.csharp", "k--kato.docomment", "editorconfig.editorconfig", + "esbenp.prettier-vscode", "pflannery.vscode-versionlens", "davidanson.vscode-markdownlint", "dotjoshjohnson.xml", From c70b6560f101b924b4adb85cafab7048ea3e2ee0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 9 Feb 2024 19:55:09 +0000 Subject: [PATCH 724/889] Identify AzP-related YAML files --- .vscode/settings.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ce72437c..efbe74f4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,5 +8,16 @@ "editor.formatOnSave": true, "[xml]": { "editor.wordWrap": "off" - } + }, + // Treat these files as Azure Pipelines files + "files.associations": { + "**/azure-pipelines/**/*.yml": "azure-pipelines", + "azure-pipelines.yml": "azure-pipelines" + }, + // Use Prettier as the default formatter for Azure Pipelines files. + // Needs to be explicitly configured: https://github.com/Microsoft/azure-pipelines-vscode#document-formatting + "[azure-pipelines]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": false // enable this when the conform + }, } From 823f34de13cc1f5a26a7d5186421dbe5461f2c6b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 9 Feb 2024 13:20:43 -0700 Subject: [PATCH 725/889] Add missing $ characters in pipeline --- azure-pipelines/prepare-insertion-stages.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index 821054aa..58218fa6 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -47,8 +47,8 @@ stages: # outputs: # - output: nuget # displayName: 📦 Push nuget packages - # packagesToPush: '(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg' - # packageParentPath: (Pipeline.Workspace)/deployables-Windows/NuGet + # packagesToPush: '$(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg' + # packageParentPath: $(Pipeline.Workspace)/deployables-Windows/NuGet # allowPackageConflicts: true # nuGetFeedType: external # publishFeedCredentials: azure-public/vs-impl From 0f2cb2ea14fda56fbe600733c6698a694d2609c8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 09:03:32 -0700 Subject: [PATCH 726/889] Bump Microsoft.NET.Test.Sdk from 17.8.0 to 17.9.0 (#251) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.8.0 to 17.9.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.8.0...v17.9.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 1438548b..3096e57c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,7 @@ true - + From f301981ff9d11f86ad176fe99b38630452a1d0ca Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 12 Feb 2024 15:42:31 -0700 Subject: [PATCH 727/889] Publish artifacts even on failed pipelines --- azure-pipelines/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 03fd0ff7..1074264f 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -69,6 +69,7 @@ jobs: displayName: 📢 Publish ${{ artifact_name }}-Windows targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-Windows artifactName: ${{ artifact_name }}-Windows + condition: succeededOrFailed() - output: pipelineArtifact displayName: 📢 Publish VSInsertion-Windows targetPath: $(Build.ArtifactStagingDirectory)/VSInsertion-Windows From 09f29b8638ddcd07335f629022012229788e5c6c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 12 Feb 2024 15:52:53 -0700 Subject: [PATCH 728/889] Switch job disabling style This should reduce merge conflicts going forward since the job's content doesn't entirely change just to enable it. --- azure-pipelines/prepare-insertion-stages.yml | 59 ++++++++++---------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index 58218fa6..97e6117f 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -33,32 +33,33 @@ stages: SymbolsAgentPath: $(Pipeline.Workspace)/symbols-legacy azureSubscription: Symbols Upload (DevDiv) - # - job: push - # displayName: azure-public/vs-impl feed - # ${{ if parameters.ArchiveSymbols }}: - # dependsOn: symbol_archive - # pool: - # name: AzurePipelines-EO - # demands: - # - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT - # os: Linux - # templateContext: - # outputParentDirectory: $(Pipeline.Workspace) - # outputs: - # - output: nuget - # displayName: 📦 Push nuget packages - # packagesToPush: '$(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg' - # packageParentPath: $(Pipeline.Workspace)/deployables-Windows/NuGet - # allowPackageConflicts: true - # nuGetFeedType: external - # publishFeedCredentials: azure-public/vs-impl - # steps: - # - checkout: none - # - download: current - # artifact: Variables-Windows - # displayName: 🔻 Download Variables-Windows artifact - # - powershell: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 - # displayName: ⚙️ Set pipeline variables based on artifacts - # - download: current - # artifact: deployables-Windows - # displayName: 🔻 Download deployables-Windows artifact + - ${{ if false }}: # Switch to true to enable, but leave the condition to avoid merge conflicts later. + - job: push + displayName: azure-public/vs-impl feed + ${{ if parameters.ArchiveSymbols }}: + dependsOn: symbol_archive + pool: + name: AzurePipelines-EO + demands: + - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT + os: Linux + templateContext: + outputParentDirectory: $(Pipeline.Workspace) + outputs: + - output: nuget + displayName: 📦 Push nuget packages + packagesToPush: '$(Pipeline.Workspace)/deployables-Windows/NuGet/*.nupkg' + packageParentPath: $(Pipeline.Workspace)/deployables-Windows/NuGet + allowPackageConflicts: true + nuGetFeedType: external + publishFeedCredentials: azure-public/vs-impl + steps: + - checkout: none + - download: current + artifact: Variables-Windows + displayName: 🔻 Download Variables-Windows artifact + - powershell: $(Pipeline.Workspace)/Variables-Windows/_pipelines.ps1 + displayName: ⚙️ Set pipeline variables based on artifacts + - download: current + artifact: deployables-Windows + displayName: 🔻 Download deployables-Windows artifact From 4ac532d55694d202c5bbda47a806121b33bebfae Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 13 Feb 2024 14:52:59 -0700 Subject: [PATCH 729/889] Remove `EnableSBOMSigning` variable --- azure-pipelines/official.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index e1a732bb..79317477 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -68,7 +68,6 @@ extends: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ - Packaging.EnableSBOMSigning: false jobs: - template: /azure-pipelines/build.yml@self parameters: @@ -103,7 +102,6 @@ extends: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true BuildConfiguration: Release NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ - Packaging.EnableSBOMSigning: false jobs: - template: /azure-pipelines/build.yml@self parameters: From 82795963e2a88b40faca81fe9248c63f64e75d36 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 13 Feb 2024 15:03:30 -0700 Subject: [PATCH 730/889] Share variables across all entrypoints --- azure-pipelines.yml | 5 +---- azure-pipelines/BuildStageVariables.yml | 5 +++++ azure-pipelines/official.yml | 8 ++------ 3 files changed, 8 insertions(+), 10 deletions(-) create mode 100644 azure-pipelines/BuildStageVariables.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b4001ab9..6415847e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,10 +24,7 @@ parameters: default: true variables: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - BuildConfiguration: Release - # codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ - NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ +- template: /azure-pipelines/BuildStageVariables.yml@self jobs: - template: azure-pipelines/build.yml diff --git a/azure-pipelines/BuildStageVariables.yml b/azure-pipelines/BuildStageVariables.yml new file mode 100644 index 00000000..2a683569 --- /dev/null +++ b/azure-pipelines/BuildStageVariables.yml @@ -0,0 +1,5 @@ +variables: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + BuildConfiguration: Release + NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ + # codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 79317477..ccb5a4d1 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -65,9 +65,7 @@ extends: stages: - stage: Build variables: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - BuildConfiguration: Release - NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ + - template: /azure-pipelines/BuildStageVariables.yml@self jobs: - template: /azure-pipelines/build.yml@self parameters: @@ -99,9 +97,7 @@ extends: stages: - stage: Build variables: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - BuildConfiguration: Release - NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ + - template: /azure-pipelines/BuildStageVariables.yml@self jobs: - template: /azure-pipelines/build.yml@self parameters: From 1f5f12750e115bcbeef07e4757032c2143235de1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 13 Feb 2024 15:31:35 -0700 Subject: [PATCH 731/889] Fix Expand-Template.ps1 --- Expand-Template.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 8d4c2f4b..3367d240 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -149,12 +149,15 @@ try { "(?m)^\s+- microbuild`r?`n"="" } Replace-Placeholders -Path "azure-pipelines\official.yml" -Replacements $YmlReplacements + Replace-Placeholders -Path "azure-pipelines.yml" -Replacements $YmlReplacements + + $YmlReplacements = @{} if ($CodeCovToken) { $YmlReplacements['(codecov_token: ).*(#.*)'] = "`$1$CodeCovToken" } else { $YmlReplacements['(codecov_token: ).*(#.*)'] = "#`$1`$2" } - Replace-Placeholders -Path "azure-pipelines.yml" -Replacements $YmlReplacements + Replace-Placeholders -Path "azure-pipelines/BuildStageVariables.yml" -Replacements $YmlReplacements Replace-Placeholders -Path "azure-pipelines/variables/InsertVersionsValues.ps1" -Replacements @{ 'LibraryName' = $LibraryName; From 64b2ae3bc6c384919e138cbd3fa50b884e073003 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 13 Feb 2024 17:10:45 -0700 Subject: [PATCH 732/889] Clarify purpose of nuGetServiceConnection --- azure-pipelines/install-dependencies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 0976e548..dc35cece 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -7,7 +7,7 @@ steps: displayName: 🔏 Authenticate NuGet feeds inputs: ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - nuGetServiceConnections: azure-public/msft_consumption + nuGetServiceConnections: azure-public/msft_consumption # Only necessary for GitHub-hosted repos forceReinstallCredentialProvider: true - powershell: | From 4475f937772658ebdb1e9b20752c97ec2b32cd9f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 13 Feb 2024 17:11:33 -0700 Subject: [PATCH 733/889] Drop Ref12Analyze task It publishes to a web site that no longer operates. --- azure-pipelines/microbuild.after.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 7531cf54..d1f322c0 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -10,19 +10,6 @@ steps: $(Build.SourcesDirectory)/bin/Packages/$(BuildConfiguration)/NuGet condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) -- task: Ref12Analyze@0 - displayName: 📑 Ref12 (Codex) Analyze - inputs: - codexoutputroot: $(Build.ArtifactStagingDirectory)\Codex - workflowArguments: | - /sourcesDirectory:$(Build.SourcesDirectory) - /codexRepoUrl:$(Build.Repository.Uri) - /repoName:$(Build.Repository.Name) - /additionalCodexArguments:-bld - /additionalCodexArguments:$(Build.ArtifactStagingDirectory)/build_logs - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Agent.OS'], 'Windows_NT')) - continueOnError: true - - ${{ if eq(parameters.EnableCompliance, 'true') }}: - template: secure-development-tools.yml parameters: From 6dc738bcb5a88209e3b4b3eaec9e0fcaee8955d7 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 14 Feb 2024 13:55:09 -0700 Subject: [PATCH 734/889] Fix publish for scheduled pipeline runs --- azure-pipelines/build.yml | 6 +++--- azure-pipelines/official.yml | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 1074264f..501c6269 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -51,7 +51,7 @@ jobs: signing: enabled: true zipSources: false - ${{ if or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }}: + ${{ if parameters.RealSign }}: signType: real ${{ else }}: signType: test @@ -107,7 +107,7 @@ jobs: ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: templateContext: mb: - ${{ if or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }}: + ${{ if parameters.RealSign }}: signing: enabled: false # enable when building unique artifacts on this agent that must be signed signType: real @@ -137,7 +137,7 @@ jobs: ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: templateContext: mb: - ${{ if or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }}: + ${{ if parameters.RealSign }}: signing: enabled: false # enable when building unique artifacts on this agent that must be signed signType: real diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index ccb5a4d1..c28137f6 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -69,7 +69,7 @@ extends: jobs: - template: /azure-pipelines/build.yml@self parameters: - RealSign: ${{ parameters.RealSign }} + RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} EnableCompliance: ${{ parameters.EnableCompliance }} EnableAPIScan: ${{ parameters.EnableAPIScan }} windowsPool: VSEngSS-MicroBuild2022-1ES @@ -86,7 +86,7 @@ extends: RunTests: ${{ parameters.RunTests }} - template: /azure-pipelines/prepare-insertion-stages.yml@self parameters: - RealSign: ${{ parameters.RealSign }} + RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} ${{ else }}: template: azure-pipelines/MicroBuild.1ES.Unofficial.yml@MicroBuildTemplate parameters: @@ -101,7 +101,7 @@ extends: jobs: - template: /azure-pipelines/build.yml@self parameters: - RealSign: ${{ parameters.RealSign }} + RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} EnableCompliance: ${{ parameters.EnableCompliance }} EnableAPIScan: ${{ parameters.EnableAPIScan }} windowsPool: VSEngSS-MicroBuild2022-1ES @@ -118,4 +118,4 @@ extends: RunTests: ${{ parameters.RunTests }} - template: /azure-pipelines/prepare-insertion-stages.yml@self parameters: - RealSign: ${{ parameters.RealSign }} + RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} From a7dbfbc8acacf7293e3c46e4b7e1466c338b5fc8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 16 Feb 2024 10:15:56 -0700 Subject: [PATCH 735/889] Add missing elements for turnkey localization --- azure-pipelines/artifacts/LocBin.ps1 | 15 +++++++++++++++ azure-pipelines/build.yml | 10 +++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 azure-pipelines/artifacts/LocBin.ps1 diff --git a/azure-pipelines/artifacts/LocBin.ps1 b/azure-pipelines/artifacts/LocBin.ps1 new file mode 100644 index 00000000..85bf5c7b --- /dev/null +++ b/azure-pipelines/artifacts/LocBin.ps1 @@ -0,0 +1,15 @@ +# Identify LCE files and the binary files they describe +$BinRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin") +$FilesToCopy = @() +$FilesToCopy += Get-ChildItem -Recurse -File -Path $BinRoot |? { $_.FullName -match '\\Localize\\' } + +Get-ChildItem -rec "$BinRoot\*.lce" -File | % { + $FilesToCopy += $_ + $FilesToCopy += $_.FullName.SubString(0, $_.FullName.Length - 4) +} + +$FilesToCopy += Get-ChildItem -rec "$BinRoot\*.lcg" -File | % { [xml](Get-Content $_) } | % { $_.lcx.name } + +@{ + "$BinRoot" = $FilesToCopy; +} diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 501c6269..5d3fbd06 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -19,6 +19,9 @@ parameters: - name: RunTests type: boolean default: true +- name: EnableLocalization + type: boolean + default: false - name: EnableCompliance type: boolean default: false @@ -58,7 +61,7 @@ jobs: sbom: enabled: true localization: - enabled: false + enabled: ${{ parameters.EnableLocalization }} ${{ if eq(variables['Build.Reason'], 'pullRequest') }}: languages: ENU,JPN outputParentDirectory: $(Build.ArtifactStagingDirectory) @@ -74,6 +77,11 @@ jobs: displayName: 📢 Publish VSInsertion-Windows targetPath: $(Build.ArtifactStagingDirectory)/VSInsertion-Windows artifactName: VSInsertion-Windows + - ${{ if parameters.EnableLocalization }}: + - output: pipelineArtifact + displayName: 📢 Publish LocBin-Windows + targetPath: $(Build.ArtifactStagingDirectory)/LocBin-Windows + artifactName: LocBin-Windows steps: - checkout: self fetchDepth: 0 # avoid shallow clone so nbgv can do its work. From c7fe3ec5099b2c7648ed53f78b040d9d91adfadf Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 16 Feb 2024 11:36:08 -0700 Subject: [PATCH 736/889] Fix LocBin to not fail before a build occurs --- azure-pipelines/artifacts/LocBin.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines/artifacts/LocBin.ps1 b/azure-pipelines/artifacts/LocBin.ps1 index 85bf5c7b..3b6945f7 100644 --- a/azure-pipelines/artifacts/LocBin.ps1 +++ b/azure-pipelines/artifacts/LocBin.ps1 @@ -1,5 +1,7 @@ # Identify LCE files and the binary files they describe $BinRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin") +if (!(Test-Path $BinRoot)) { return } + $FilesToCopy = @() $FilesToCopy += Get-ChildItem -Recurse -File -Path $BinRoot |? { $_.FullName -match '\\Localize\\' } From 988ff3298ea7d13cd2a4631e2c041d0c53a9e608 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 16 Feb 2024 11:45:52 -0700 Subject: [PATCH 737/889] Drop `outputParentDirectory` from release pipelines Setting it to `$(Pipeline.Workspace)` was problematic because it included other files dropped by 1ES PT that credscan then failed on (go figure). And anyway, these jobs have only one output so there's no reason to specify `outputParentDirectory` as no optimization is applicable. --- azure-pipelines/prepare-insertion-stages.yml | 1 - azure-pipelines/release.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index 97e6117f..6ffff531 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -44,7 +44,6 @@ stages: - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT os: Linux templateContext: - outputParentDirectory: $(Pipeline.Workspace) outputs: - output: nuget displayName: 📦 Push nuget packages diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index 8b371771..7444d7d3 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -30,7 +30,6 @@ extends: - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT os: Linux templateContext: - outputParentDirectory: $(Pipeline.Workspace) outputs: - output: nuget displayName: 📦 Push packages to nuget.org From e5c43bf44a89dc508fc2a48d26359e8fefa23b53 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 16 Feb 2024 11:53:59 -0700 Subject: [PATCH 738/889] Fix release pipeline --- azure-pipelines/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index 7444d7d3..2da6ddf0 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -14,6 +14,9 @@ resources: tags: - auto-release +variables: +- template: GlobalVariables.yml + extends: template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate parameters: From aa19fdde1dbd4cbb0c2ee4f353563481b8f6d2ea Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 19 Feb 2024 07:35:40 -0700 Subject: [PATCH 739/889] Bump .NET SDK from 8.0.100 to 8.0.201 --- .devcontainer/Dockerfile | 2 +- global.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b680b1db..34e56908 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions -FROM mcr.microsoft.com/dotnet/sdk:8.0.100-jammy +FROM mcr.microsoft.com/dotnet/sdk:8.0.201-jammy # Installing mono makes `dotnet test` work without errors even for net472. # But installing it takes a long time, so it's excluded by default. diff --git a/global.json b/global.json index d24a9b70..2565f236 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100", + "version": "8.0.201", "rollForward": "patch", "allowPrerelease": false } From 4d78e3c1af91d81e9ed7baac5f2c92ef81b859ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 07:36:25 -0700 Subject: [PATCH 740/889] Bump xunit.runner.visualstudio from 2.5.6 to 2.5.7 (#254) Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.6 to 2.5.7. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.6...2.5.7) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 3096e57c..32271e50 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ - + From 4540dc53c2e406f83a3a547da0f77d31a04591a6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 07:36:45 -0700 Subject: [PATCH 741/889] Bump dotnet-coverage from 17.10.2 to 17.10.3 (#252) Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.10.2 to 17.10.3. - [Commits](https://github.com/microsoft/codecoverage/commits) --- updated-dependencies: - dependency-name: dotnet-coverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 6eff0445..dfd00e46 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -9,7 +9,7 @@ ] }, "dotnet-coverage": { - "version": "17.10.2", + "version": "17.10.3", "commands": [ "dotnet-coverage" ] From 7dec0100751f801cd01cea01bac5f12db6ecf504 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 14:43:08 +0000 Subject: [PATCH 742/889] Bump xunit from 2.6.6 to 2.7.0 (#253) --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 32271e50..60ffd922 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -8,7 +8,7 @@ - + From 9651284db829b94d40ee6e342fcba7f9873935cb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 20 Feb 2024 12:34:45 -0700 Subject: [PATCH 743/889] Add team as reviewer for insertion PRs --- azure-pipelines/variables/InsertReviewers.ps1 | 12 ------------ azure-pipelines/vs-insertion.yml | 1 + 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 azure-pipelines/variables/InsertReviewers.ps1 diff --git a/azure-pipelines/variables/InsertReviewers.ps1 b/azure-pipelines/variables/InsertReviewers.ps1 deleted file mode 100644 index 6fd6648b..00000000 --- a/azure-pipelines/variables/InsertReviewers.ps1 +++ /dev/null @@ -1,12 +0,0 @@ -# This is a list of AzDO account names or email addresses. -# Add your team DL and/or whoever should be notified of insertion PRs. -$contacts = ,$env:BUILD_REQUESTEDFOREMAIL - -if (Test-Path "$PSScriptRoot\TeamEmail.ps1") { - $contacts += & "$PSScriptRoot\TeamEmail.ps1" -} - -$contacts = $contacts |? { $_ } -if ($contacts) { - [string]::Join(',', $contacts) -} diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 87166f29..9cb597ea 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -54,6 +54,7 @@ extends: TeamEmail: $(TeamEmail) InsertionPayloadName: $(Build.Repository.Name) $(Build.BuildNumber) InsertionBuildPolicy: Request Perf DDRITs + InsertionReviewers: $(TeamEmail),$(Build.RequestedForEmail) AutoCompletePR: true AutoCompleteMergeStrategy: Squash - powershell: | From be633596de5cb11efe41e2094ec61eb7a8a7549f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 20 Feb 2024 13:00:09 -0700 Subject: [PATCH 744/889] Couple APIScan and TSAUpload under the same switch --- azure-pipelines/official.yml | 2 +- azure-pipelines/secure-development-tools.yml | 39 ++++++++++---------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index c28137f6..8cdf3afb 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -39,7 +39,7 @@ parameters: - name: EnableAPIScan displayName: Include APIScan with Compliance tools type: boolean - default: true + default: false # enable in individual repos only AFTER updating TSAOptions.json with your own values resources: repositories: diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml index 9b1aeaa0..409f48d0 100644 --- a/azure-pipelines/secure-development-tools.yml +++ b/azure-pipelines/secure-development-tools.yml @@ -1,5 +1,7 @@ parameters: - EnableAPIScan: +- name: EnableAPIScan + type: boolean + default: false steps: @@ -19,22 +21,21 @@ steps: !**/osx*/** TargetFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs -- task: APIScan@2 - displayName: 🔍 Run APIScan - inputs: - softwareFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs - softwareName: $(SymbolsFeatureName) - softwareVersionNum: $(NBGV_MajorMinorVersion) - isLargeApp: false - toolVersion: Latest - condition: and(succeeded(), ${{ parameters.EnableAPIScan }}, ne(variables.ApiScanClientId, '')) - env: - AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) +- ${{ if parameters.EnableAPIScan }}: + - task: APIScan@2 + displayName: 🔍 Run APIScan + inputs: + softwareFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs + softwareName: $(SymbolsFeatureName) + softwareVersionNum: $(NBGV_MajorMinorVersion) + isLargeApp: false + toolVersion: Latest + env: + AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) -# File bugs when APIScan finds issues -- task: TSAUpload@2 - displayName: 🪳 TSA upload - inputs: - GdnPublishTsaOnboard: True - GdnPublishTsaConfigFile: $(Build.SourcesDirectory)\azure-pipelines\TSAOptions.json - condition: false # enable in individual repos only AFTER updating TSAOptions.json with your own values + # File bugs when APIScan finds issues + - task: TSAUpload@2 + displayName: 🪳 TSA upload + inputs: + GdnPublishTsaOnboard: True + GdnPublishTsaConfigFile: $(Build.SourcesDirectory)\azure-pipelines\TSAOptions.json From 56f91e1ff4c4cd55b059a0842d9317b251845c5c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 13 Feb 2024 17:10:21 -0700 Subject: [PATCH 745/889] Add OptProf support to Library.Template --- Expand-Template.ps1 | 13 ++ azure-pipelines.yml | 1 + .../InsertionMetadataPackage.nuspec | 16 ++ azure-pipelines/OptProf.yml | 112 +++++++++++ azure-pipelines/OptProf_part2.yml | 89 ++++++++ azure-pipelines/ProfilingInputs.props | 5 + azure-pipelines/artifacts/VSInsertion.ps1 | 40 +++- azure-pipelines/build.yml | 190 +++++++++++------- azure-pipelines/dotnet.yml | 24 ++- azure-pipelines/microbuild.after.yml | 36 +++- azure-pipelines/microbuild.before.yml | 37 ++++ azure-pipelines/official.yml | 8 + .../variables/ProfilingInputsDropName.ps1 | 5 + azure-pipelines/vs-validation.yml | 1 + 14 files changed, 484 insertions(+), 93 deletions(-) create mode 100644 azure-pipelines/InsertionMetadataPackage.nuspec create mode 100644 azure-pipelines/OptProf.yml create mode 100644 azure-pipelines/OptProf_part2.yml create mode 100644 azure-pipelines/ProfilingInputs.props create mode 100644 azure-pipelines/variables/ProfilingInputsDropName.ps1 diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 3367d240..da2f6b7e 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -168,6 +168,19 @@ try { 'LibraryName' = $LibraryName; } + Replace-Placeholders -Path "azure-pipelines/InsertionMetadataPackage.nuspec" -Replacements @{ + 'LibraryName' = $LibraryName; + } + Replace-Placeholders -Path "azure-pipelines/artifacts/VSInsertion.ps1" -Replacements @{ + 'LibraryName' = $LibraryName; + } + Replace-Placeholders -Path "azure-pipelines/OptProf.yml" -Replacements @{ + 'LibraryName' = $LibraryName; + } + Replace-Placeholders -Path "azure-pipelines/OptProf_part2.yml" -Replacements @{ + 'LibraryName' = $LibraryName; + } + # Self destruct git rm Expand-Template.* Apply-Template.ps1 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6415847e..e6ceafef 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,5 +29,6 @@ variables: jobs: - template: azure-pipelines/build.yml parameters: + Is1ESPT: false includeMacOS: ${{ parameters.includeMacOS }} RunTests: ${{ parameters.RunTests }} diff --git a/azure-pipelines/InsertionMetadataPackage.nuspec b/azure-pipelines/InsertionMetadataPackage.nuspec new file mode 100644 index 00000000..f7aa3e3f --- /dev/null +++ b/azure-pipelines/InsertionMetadataPackage.nuspec @@ -0,0 +1,16 @@ + + + + LibraryName.VSInsertionMetadata + $version$ + Microsoft + Microsoft + + false + Contains metadata for insertion into VS. + © Microsoft Corporation. All rights reserved. + + + + + diff --git a/azure-pipelines/OptProf.yml b/azure-pipelines/OptProf.yml new file mode 100644 index 00000000..6d81439a --- /dev/null +++ b/azure-pipelines/OptProf.yml @@ -0,0 +1,112 @@ +trigger: none +pr: none +schedules: +- cron: "0 3 * * Fri" # Thu @ 8 or 9 PM Mountain Time (depending on DST) + displayName: Weekly OptProf run + branches: + include: + - 'v*.*' + - main + always: true # we must keep data fresh since optimizationdata drops are purged after 30 days + +# Avoid errant CI builds: https://developercommunity.visualstudio.com/content/problem/1154409/azure-pipeline-is-triggering-due-to-events-that-ne.html +#resources: +# repositories: +# - repository: scripts +# type: git +# name: DeploymentScripts +# ref: refs/heads/test + +variables: +- template: GlobalVariables.yml +- name: PublicRelease + value: false # avoid using nice version since we're building a preliminary/unoptimized package +- name: IsOptProf + value: true + +stages: +- stage: Library + variables: + - name: OptProf + value: true + - template: BuildStageVariables.yml + jobs: + - template: build.yml + parameters: + Is1ESPT: false + RealSign: true + EnableLocalization: false + EnableCompliance: false + windowsPool: VSEngSS-MicroBuild2022-1ES + includeMacOS: false + ShouldSkipOptimize: true + IsOptProf: true + RunTests: false +- stage: QueueVSBuild + jobs: + - job: QueueOptProf + pool: VSEngSS-MicroBuild2022-1ES + variables: + InsertPayloadName: LibraryName + InsertTopicBranch: team/VS-IDE/LibraryName-OptProf-run-$(Build.BuildId) + steps: + - checkout: none # We don't need source from our own repo + clean: true + + # Pipeline YAML does not yet support checking out other repos. So we'll do it by hand. +# - checkout: scripts # We DO need source from the DeploymentScripts repo +# clean: true +# path: $(Agent.TempDirectory)/DeploymentScripts +# fetchDepth: 1 + - script: 'git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" clone https://devdiv.visualstudio.com/DevDiv/_git/DeploymentScripts --depth 1 --branch test "$(Agent.TempDirectory)/DeploymentScripts"' + displayName: Download DeploymentScripts repo + + - task: DownloadBuildArtifacts@0 + displayName: Download insertion artifacts + inputs: + artifactName: VSInsertion-Windows + downloadPath: $(Agent.TempDirectory) + - task: DownloadBuildArtifacts@0 + displayName: Download variables artifacts + inputs: + artifactName: Variables-Windows + downloadPath: $(Agent.TempDirectory) + - task: PowerShell@2 + displayName: Set pipeline variables based on artifacts + inputs: + targetType: filePath + filePath: $(Agent.TempDirectory)/Variables-Windows/_pipelines.ps1 + - task: NuGetCommand@2 + displayName: Push CoreXT packages to VS feed + inputs: + command: push + packagesToPush: $(Agent.TempDirectory)/VSInsertion-Windows/*.nupkg + publishVstsFeed: 97a41293-2972-4f48-8c0e-05493ae82010 # VS feed + allowPackageConflicts: true + - task: MicroBuildInsertVsPayload@4 + displayName: Insert VS Payload + inputs: + SkipCreatePR: true + CustomScriptExecutionCommand: src\VSSDK\NuGet\AllowUnstablePackages.ps1 + - task: benjhuser.tfs-extensions-build-tasks.trigger-build-task.TriggerBuild@3 + displayName: Trigger a new build of DD-CB-TestSignVS-devCI + inputs: + buildDefinition: DD-CB-TestSignVS-devCI + useSameBranch: false + branchToUse: $(InsertTopicBranch) + storeInEnvironmentVariable: true + queueBuildForUserThatTriggeredBuild: false + authenticationMethod: OAuth Token + password: $(System.AccessToken) + - task: PowerShell@2 + displayName: Associate InsertionOutputs artifacts with CloudBuild + inputs: + targetType: filePath + filePath: $(Agent.TempDirectory)/DeploymentScripts/Scripts/Insertion/WriteArtifact.ps1 + arguments: '-oldBuildID $(Build.BuildId) -newBuildID $(TriggeredBuildIds) -artifactName "InsertionOutputs" -accessToken $(System.AccessToken)' + - task: PowerShell@2 + displayName: Tag the build with LibraryName-insertion + inputs: + targetType: filePath + filePath: $(Agent.TempDirectory)/DeploymentScripts/Scripts/Insertion/TagBuild.ps1 + arguments: '-buildID $(TriggeredBuildIds) -tagName "LibraryName-insertion" -accessToken $(System.AccessToken)' diff --git a/azure-pipelines/OptProf_part2.yml b/azure-pipelines/OptProf_part2.yml new file mode 100644 index 00000000..60ac39b8 --- /dev/null +++ b/azure-pipelines/OptProf_part2.yml @@ -0,0 +1,89 @@ +trigger: none +pr: none + +resources: + pipelines: + - pipeline: VisualStudioBuildUnderTest + source: DD-CB-TestSignVS-devCI + trigger: + tags: + - LibraryName-insertion + - pipeline: DartLab + source: DartLab + branch: main + - pipeline: DartLab.OptProf + source: DartLab.OptProf + branch: main + repositories: + - repository: DartLabTemplates + type: git + name: DartLab.Templates + ref: refs/heads/main + - repository: DartLabOptProfTemplates + type: git + name: DartLab.OptProf + ref: refs/heads/main + +parameters: + +# The prefix naming of the OptimizationInputs drop +- name: optimizationDropPrefix + type: string + default: OptimizationInputs/$(System.TeamProject)/$(Build.Repository.Name) + +stages: +- template: \templates\stages\visual-studio\single-runsettings.yml@DartLabOptProfTemplates + parameters: + ##### Required ##### + runSettingsURI: $(Pipeline.Workspace)\VisualStudioBuildUnderTest\BuildArtifacts\runsettings\LibraryName.OptProf.runsettings + visualStudioBootstrapperURI: https://vsdrop.corp.microsoft.com/file/v1/$(VisualStudio.BuildUnderTest.ProductsDropName);bootstrappers/Enterprise/vs_enterprise.exe + ##### Optional ##### + name: OptProfProfilingWorkflow + displayName: OptProf Profiling Workflow + optOptimizationInputsDropName: $(OptimizationInputsDropName) + previousOptimizationInputsDropName: $(PreviousOptimizationInputsDropName) + testLabPoolName: VS-Platform + ##### Step Hooks ##### + preTestMachineConfigurationStepList: + - download: VisualStudioBuildUnderTest + - task: PowerShell@2 + name: SetProductsDropName + displayName: Set 'VisualStudio.BuildUnderTest.ProductsDropName' + inputs: + filePath: $(DartLab.Path)\Scripts\VisualStudio\Build\Get-VisualStudioDropName.ps1 + arguments: -DropNamePrefix 'Products' -VstsDropUrlsJson '$(Pipeline.Workspace)\VisualStudioBuildUnderTest\BuildArtifacts\VstsDropUrls.json' -OutVariableName 'VisualStudio.BuildUnderTest.ProductsDropName' + preDeployAndRunTestsStepList: + - download: VisualStudioBuildUnderTest + prePublishOptimizationInputsDropStepList: + # Set parameter for PreviousOptimizationInputsDropName, MicroBuildCommitID, and OptimizationInputsDropName + - powershell: | + try { + $artifactName = 'InsertionOutputs' + $BuildID = $(resources.pipeline.VisualStudioBuildUnderTest.runID) + $artifact = Get-BuildArtifact -InstanceURL 'https://dev.azure.com/devdiv' -ProjectName 'DevDiv' -BuildID $BuildID -ArtifactName $artifactName -OAuthAccessToken (ConvertTo-SecureString '$(System.AccessToken)' -AsPlainText -Force) + $containerName = $artifact.Resource.Data -Split '/' | Select-Object -Last 1 + $fileName = Join-Path $containerName 'Metadata.json' + $jsonString = Read-BuildArtifactFile -InstanceURL 'https://dev.azure.com/devdiv' -ProjectName 'DevDiv' -BuildID $BuildID -ArtifactName $artifactName -FileName $fileName -OAuthAccessToken (ConvertTo-SecureString '$(System.AccessToken)' -AsPlainText -Force) + $json = $jsonString | ConvertFrom-Json + + Write-Host "The content of the metadata.json file was $json" + + $dropname = $json.OptimizationData + $commitID = $json.CommitID + $OptimizationInputsDropName = "${{parameters.optimizationDropPrefix}}/$($commitID)/$(Build.BuildId)/$(System.StageId)/$(System.StageAttempt)" + + Write-Host "PreviousOptimizationInputsDropName: $dropname" + Set-AzurePipelinesVariable 'PreviousOptimizationInputsDropName' $dropname + + Write-Host "MicroBuildCommitID: $commitID" + Set-AzurePipelinesVariable 'MicroBuildCommitID' $commitID + + Write-Host "OptimizationInputsDropName: $OptimizationInputsDropName" + Set-AzurePipelinesVariable 'OptimizationInputsDropName' $OptimizationInputsDropName + } + catch { + Write-Host $_ + Write-Error "Failed to set OptimizationInputsDropName pipeline variable" + throw + } + displayName: Set MicroBuildCommitID, PreviousOptimizationInputsDropName, and OptimizationInputsDropName diff --git a/azure-pipelines/ProfilingInputs.props b/azure-pipelines/ProfilingInputs.props new file mode 100644 index 00000000..fb19d604 --- /dev/null +++ b/azure-pipelines/ProfilingInputs.props @@ -0,0 +1,5 @@ + + + + + diff --git a/azure-pipelines/artifacts/VSInsertion.ps1 b/azure-pipelines/artifacts/VSInsertion.ps1 index ba6af320..4757c9c2 100644 --- a/azure-pipelines/artifacts/VSInsertion.ps1 +++ b/azure-pipelines/artifacts/VSInsertion.ps1 @@ -16,13 +16,43 @@ if (!$BuildConfiguration) { $BuildConfiguration = 'Debug' } -$PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration/NuGet" +$NuGetPackages = "$RepoRoot/bin/Packages/$BuildConfiguration/NuGet" -if (!(Test-Path $PackagesRoot)) { - Write-Warning "Skipping because packages haven't been built yet." +if (!(Test-Path $NuGetPackages)) { + Write-Warning "Skipping because NuGet packages haven't been built yet." return @{} } -@{ - "$PackagesRoot" = (Get-ChildItem $PackagesRoot -Recurse) +$result = @{ + "$NuGetPackages" = (Get-ChildItem $NuGetPackages -Recurse) } + +if ($env:IsOptProf) { + $CoreXTPackages = "$RepoRoot/bin/Packages/$BuildConfiguration/CoreXT" + + $ArtifactBasePath = "$RepoRoot\obj\_artifacts" + $ArtifactPath = "$ArtifactBasePath\VSInsertion" + if (-not (Test-Path $ArtifactPath)) { New-Item -ItemType Directory -Path $ArtifactPath | Out-Null } + + $profilingInputs = [xml](Get-Content -Path "$PSScriptRoot\..\ProfilingInputs.props") + $profilingInputs.Project.ItemGroup.TestStore.Include = "vstsdrop:" + (& "$PSScriptRoot\..\variables\ProfilingInputsDropName.ps1") + $profilingInputs.Save("$ArtifactPath\ProfilingInputs.props") + + $InsertionMetadataVersion = $(dotnet tool run nbgv get-version -p "$RepoRoot\src" -f json | ConvertFrom-Json).NuGetPackageVersion + if ($env:BUILD_BUILDID) { + # We must ensure unique versions for the insertion metadata package so + # it can contain information that is unique to this build. + # In particular it includes the ProfilingInputsDropName, which contains the BuildId. + # A non-unique package version here may collide with a prior run of this same commit, + # ultimately resulting in a failure of the optprof run. + $InsertionMetadataVersion += '.' + $env:BUILD_BUILDID + } + & (& "$PSScriptRoot\..\Get-NuGetTool.ps1") pack "$PSScriptRoot\..\InsertionMetadataPackage.nuspec" -OutputDirectory $CoreXTPackages -BasePath $ArtifactPath -Version $InsertionMetadataVersion | Out-Null + if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE + } + + $result["$CoreXTPackages"] = (Get-ChildItem "$CoreXTPackages\LibraryName.VSInsertionMetadata.$InsertionMetadataVersion.nupkg"); +} + +$result diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 5d3fbd06..95f3b9d4 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -1,4 +1,6 @@ parameters: +- name: Is1ESPT + type: boolean - name: RealSign type: boolean default: false @@ -16,6 +18,15 @@ parameters: vmImage: macOS-12 - name: includeMacOS type: boolean +- name: EnableOptProf + type: boolean + default: false +- name: IsOptProf + type: boolean + default: false +- name: ShouldSkipOptimize + type: boolean + default: false - name: RunTests type: boolean default: true @@ -64,6 +75,21 @@ jobs: enabled: ${{ parameters.EnableLocalization }} ${{ if eq(variables['Build.Reason'], 'pullRequest') }}: languages: ENU,JPN + optprof: + enabled: ${{ parameters.EnableOptProf }} + ProfilingInputsDropName: $(ProfilingInputsDropName) + OptimizationInputsLookupMethod: DropPrefix + DropNamePrefix: OptimizationInputs/$(System.TeamProject)/$(Build.Repository.Name) + ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} + AccessToken: $(System.AccessToken) + mbpresteps: + - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. + clean: true + - ${{ if parameters.EnableOptProf }}: + - powershell: Write-Host "##vso[task.setvariable variable=PROFILINGINPUTSDROPNAME]$(azure-pipelines/variables/ProfilingInputsDropName.ps1)" + displayName: ⚙ Set ProfilingInputsDropName for optprof + outputParentDirectory: $(Build.ArtifactStagingDirectory) outputs: - ${{ each artifact_name in parameters.artifact_names }}: @@ -83,10 +109,6 @@ jobs: targetPath: $(Build.ArtifactStagingDirectory)/LocBin-Windows artifactName: LocBin-Windows steps: - - checkout: self - fetchDepth: 0 # avoid shallow clone so nbgv can do its work. - clean: true - - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: - template: schedule-only-steps.yml @@ -97,94 +119,106 @@ jobs: - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - template: microbuild.before.yml + parameters: + EnableLocalization: ${{ parameters.EnableLocalization }} + EnableOptProf: ${{ parameters.EnableOptProf }} + IsOptProf: ${{ parameters.IsOptProf }} + ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} - template: dotnet.yml parameters: + Is1ESPT: ${{ parameters.Is1ESPT }} RunTests: ${{ parameters.RunTests }} + IsOptProf: ${{ parameters.IsOptProf }} - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - template: microbuild.after.yml parameters: EnableCompliance: ${{ parameters.EnableCompliance }} EnableAPIScan: ${{ parameters.EnableAPIScan }} + EnableOptProf: ${{ parameters.EnableOptProf }} + IsOptProf: ${{ parameters.IsOptProf }} - template: expand-template.yml -- job: Linux - pool: ${{ parameters.linuxPool }} - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - templateContext: - mb: - ${{ if parameters.RealSign }}: - signing: - enabled: false # enable when building unique artifacts on this agent that must be signed - signType: real - outputParentDirectory: $(Build.ArtifactStagingDirectory) - outputs: - - ${{ each artifact_name in parameters.artifact_names }}: - - ${{ if or(ne(artifact_name, 'testResults'), parameters.RunTests) }}: - - output: pipelineArtifact - displayName: 📢 Publish ${{ artifact_name }}-Linux - targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-Linux - artifactName: ${{ artifact_name }}-Linux - steps: - - checkout: self - fetchDepth: 0 # avoid shallow clone so nbgv can do its work. - clean: true - - template: install-dependencies.yml - - template: dotnet.yml - parameters: - RunTests: ${{ parameters.RunTests }} - - script: dotnet format --verify-no-changes --no-restore - displayName: 💅 Verify formatted code - - template: expand-template.yml +- ${{ if not(parameters.IsOptProf) }}: + - job: Linux + pool: ${{ parameters.linuxPool }} + ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + templateContext: + mb: + ${{ if parameters.RealSign }}: + signing: + enabled: false # enable when building unique artifacts on this agent that must be signed + signType: real + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - ${{ each artifact_name in parameters.artifact_names }}: + - ${{ if or(ne(artifact_name, 'testResults'), parameters.RunTests) }}: + - output: pipelineArtifact + displayName: 📢 Publish ${{ artifact_name }}-Linux + targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-Linux + artifactName: ${{ artifact_name }}-Linux + steps: + - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. + clean: true + - template: install-dependencies.yml + - template: dotnet.yml + parameters: + Is1ESPT: ${{ parameters.Is1ESPT }} + RunTests: ${{ parameters.RunTests }} + - script: dotnet format --verify-no-changes --no-restore + displayName: 💅 Verify formatted code + - template: expand-template.yml -- job: macOS - condition: ${{ parameters.includeMacOS }} - pool: ${{ parameters.macOSPool }} - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - templateContext: - mb: - ${{ if parameters.RealSign }}: - signing: - enabled: false # enable when building unique artifacts on this agent that must be signed - signType: real - outputParentDirectory: $(Build.ArtifactStagingDirectory) - outputs: - - ${{ each artifact_name in parameters.artifact_names }}: - - ${{ if or(ne(artifact_name, 'testResults'), parameters.RunTests) }}: - - output: pipelineArtifact - displayName: 📢 Publish ${{ artifact_name }}-macOS - targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-macOS - artifactName: ${{ artifact_name }}-macOS - steps: - - checkout: self - fetchDepth: 0 # avoid shallow clone so nbgv can do its work. - clean: true - - template: install-dependencies.yml - - template: dotnet.yml - parameters: - RunTests: ${{ parameters.RunTests }} - - template: expand-template.yml + - job: macOS + condition: ${{ parameters.includeMacOS }} + pool: ${{ parameters.macOSPool }} + ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + templateContext: + mb: + ${{ if parameters.RealSign }}: + signing: + enabled: false # enable when building unique artifacts on this agent that must be signed + signType: real + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - ${{ each artifact_name in parameters.artifact_names }}: + - ${{ if or(ne(artifact_name, 'testResults'), parameters.RunTests) }}: + - output: pipelineArtifact + displayName: 📢 Publish ${{ artifact_name }}-macOS + targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-macOS + artifactName: ${{ artifact_name }}-macOS + steps: + - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. + clean: true + - template: install-dependencies.yml + - template: dotnet.yml + parameters: + Is1ESPT: ${{ parameters.Is1ESPT }} + RunTests: ${{ parameters.RunTests }} + - template: expand-template.yml -- job: WrapUp - dependsOn: - - Windows - - Linux - - macOS - pool: ${{ parameters.windowsPool }} # Use Windows agent because PublishSymbols task requires it (https://github.com/microsoft/azure-pipelines-tasks/issues/13821). - condition: succeededOrFailed() - steps: - - checkout: self - fetchDepth: 0 # avoid shallow clone so nbgv can do its work. - clean: true - - template: install-dependencies.yml - parameters: - initArgs: -NoRestore - - template: publish-symbols.yml - parameters: - includeMacOS: ${{ parameters.includeMacOS }} - - ${{ if parameters.RunTests }}: - - template: publish-codecoverage.yml + - job: WrapUp + dependsOn: + - Windows + - Linux + - macOS + pool: ${{ parameters.windowsPool }} # Use Windows agent because PublishSymbols task requires it (https://github.com/microsoft/azure-pipelines-tasks/issues/13821). + condition: succeededOrFailed() + steps: + - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. + clean: true + - template: install-dependencies.yml + parameters: + initArgs: -NoRestore + - template: publish-symbols.yml parameters: includeMacOS: ${{ parameters.includeMacOS }} + - ${{ if parameters.RunTests }}: + - template: publish-codecoverage.yml + parameters: + includeMacOS: ${{ parameters.includeMacOS }} diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 546e9083..3f4ac753 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -1,27 +1,37 @@ parameters: - RunTests: +- name: RunTests +- name: IsOptProf + type: boolean + default: false +- name: Is1ESPT + type: boolean steps: - script: dotnet build -t:build,pack --no-restore -c $(BuildConfiguration) -warnaserror /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" displayName: 🛠 dotnet build -- powershell: azure-pipelines/dotnet-test-cloud.ps1 -Configuration $(BuildConfiguration) -Agent $(Agent.JobName) -PublishResults - displayName: 🧪 dotnet test - condition: and(succeeded(), ${{ parameters.RunTests }}) +- ${{ if not(parameters.IsOptProf) }}: + - powershell: azure-pipelines/dotnet-test-cloud.ps1 -Configuration $(BuildConfiguration) -Agent $(Agent.JobName) -PublishResults + displayName: 🧪 dotnet test + condition: and(succeeded(), ${{ parameters.RunTests }}) + +- ${{ if parameters.IsOptProf }}: + # We have to artifically run this script so that the extra .nupkg is produced for variables/InsertConfigValues.ps1 to notice. + - powershell: azure-pipelines\artifacts\VSInsertion.ps1 + displayName: 🔧 Prepare VSInsertion artifact - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true displayName: ⚙ Update pipeline variables based on build outputs condition: succeededOrFailed() -- ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: +- ${{ if parameters.Is1ESPT }}: - powershell: azure-pipelines/artifacts/_pipelines.ps1 -StageOnly -AvoidSymbolicLinks -ArtifactNameSuffix "-$(Agent.JobName)" -Verbose failOnStderr: true displayName: 📢 Stage artifacts condition: succeededOrFailed() - -- ${{ if ne(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: +- ${{ else }}: - powershell: azure-pipelines/artifacts/_pipelines.ps1 -ArtifactNameSuffix "-$(Agent.JobName)" -Verbose failOnStderr: true displayName: 📢 Publish artifacts diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index d1f322c0..f9698e3e 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -1,6 +1,16 @@ parameters: - EnableCompliance: - EnableAPIScan: +- name: EnableCompliance + type: boolean + default: false +- name: EnableAPIScan + type: boolean + default: false +- name: EnableOptProf + type: boolean + default: false +- name: IsOptProf + type: boolean + default: false steps: - task: MicroBuildCodesignVerify@3 @@ -10,7 +20,27 @@ steps: $(Build.SourcesDirectory)/bin/Packages/$(BuildConfiguration)/NuGet condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) -- ${{ if eq(parameters.EnableCompliance, 'true') }}: +- ${{ if parameters.EnableOptProf }}: + - task: ms-vscs-artifact.build-tasks.artifactDropTask-1.artifactDropTask@0 + inputs: + dropServiceURI: https://devdiv.artifacts.visualstudio.com + buildNumber: $(ProfilingInputsDropName) + sourcePath: $(Build.ArtifactStagingDirectory)\OptProf\ProfilingInputs + toLowerCase: false + usePat: true + displayName: 📢 Publish to Artifact Services - ProfilingInputs + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + continueOnError: true + + - ${{ if parameters.IsOptProf }}: + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/InsertionOutputs + ArtifactName: InsertionOutputs + ArtifactType: Container + displayName: 📢 Publish InsertionOutputs as Azure DevOps artifacts + +- ${{ if parameters.EnableCompliance }}: - template: secure-development-tools.yml parameters: EnableAPIScan: ${{ parameters.EnableAPIScan }} diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index c53ae9a6..949b1b47 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -1,3 +1,17 @@ +parameters: +- name: EnableLocalization + type: boolean + default: false +- name: EnableOptProf + type: boolean + default: false +- name: IsOptProf + type: boolean + default: false +- name: ShouldSkipOptimize + type: boolean + default: false + steps: - task: notice@0 displayName: 🛠️ Generate NOTICE file @@ -6,3 +20,26 @@ steps: outputformat: text condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) retryCountOnTaskFailure: 3 # fails when the cloud service is overloaded + +- ${{ if parameters.IsOptProf }}: + # We have to install these plugins ourselves for Optprof runs because those pipelines haven't migrated to 1ES PT yet. + - task: MicroBuildOptProfPlugin@6 + inputs: + ProfilingInputsDropName: $(ProfilingInputsDropName) + OptimizationInputsLookupMethod: DropPrefix + DropNamePrefix: OptimizationInputs/$(System.TeamProject)/$(Build.Repository.Name) + ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} + AccessToken: $(System.AccessToken) + displayName: 🔧 Install OptProf Plugin + + - task: MicroBuildSigningPlugin@4 + inputs: + signType: Real + zipSources: false + displayName: 🔧 Install MicroBuild Signing Plugin + + - ${{ if parameters.EnableLocalization }}: + - task: MicroBuildLocalizationPlugin@4 + inputs: + languages: $(LocLanguages) + displayName: 🔧 Install MicroBuild Localization Plugin diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index c28137f6..ed9a0aca 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -24,6 +24,10 @@ parameters: displayName: Real sign? type: boolean default: false +# - name: ShouldSkipOptimize # Enable this when setting EnableOptProf to true in build.yml. +# displayName: Skip OptProf optimization +# type: boolean +# default: false - name: includeMacOS displayName: Build on macOS type: boolean @@ -69,7 +73,9 @@ extends: jobs: - template: /azure-pipelines/build.yml@self parameters: + Is1ESPT: true RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} + ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} EnableCompliance: ${{ parameters.EnableCompliance }} EnableAPIScan: ${{ parameters.EnableAPIScan }} windowsPool: VSEngSS-MicroBuild2022-1ES @@ -101,7 +107,9 @@ extends: jobs: - template: /azure-pipelines/build.yml@self parameters: + Is1ESPT: true RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} + ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} EnableCompliance: ${{ parameters.EnableCompliance }} EnableAPIScan: ${{ parameters.EnableAPIScan }} windowsPool: VSEngSS-MicroBuild2022-1ES diff --git a/azure-pipelines/variables/ProfilingInputsDropName.ps1 b/azure-pipelines/variables/ProfilingInputsDropName.ps1 new file mode 100644 index 00000000..88d21f69 --- /dev/null +++ b/azure-pipelines/variables/ProfilingInputsDropName.ps1 @@ -0,0 +1,5 @@ +if ($env:SYSTEM_TEAMPROJECT) { + "ProfilingInputs/$env:SYSTEM_TEAMPROJECT/$env:BUILD_REPOSITORY_NAME/$env:BUILD_SOURCEBRANCHNAME/$env:BUILD_BUILDID" +} else { + Write-Warning "No Azure Pipelines build detected. No Azure Pipelines drop name will be computed." +} diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index 5ebf0c71..195bfff3 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -32,6 +32,7 @@ extends: jobs: - template: /azure-pipelines/build.yml@self parameters: + Is1ESPT: true RealSign: true windowsPool: VSEngSS-MicroBuild2022-1ES includeMacOS: false From 3dd7fab92b6aa1a7c7b9796900ce6bc525c01372 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 20 Feb 2024 13:05:15 -0700 Subject: [PATCH 746/889] Disable NOTICE file generation for OptProf runs Just a little something to make optprof runs a little more reliable. --- azure-pipelines/build.yml | 1 + azure-pipelines/microbuild.before.yml | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 95f3b9d4..2a69192e 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -124,6 +124,7 @@ jobs: EnableOptProf: ${{ parameters.EnableOptProf }} IsOptProf: ${{ parameters.IsOptProf }} ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} + RealSign: ${{ parameters.RealSign }} - template: dotnet.yml parameters: diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index 949b1b47..ce711a0a 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -11,15 +11,19 @@ parameters: - name: ShouldSkipOptimize type: boolean default: false +- name: RealSign + type: boolean steps: -- task: notice@0 - displayName: 🛠️ Generate NOTICE file - inputs: - outputfile: $(System.DefaultWorkingDirectory)/obj/NOTICE - outputformat: text - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - retryCountOnTaskFailure: 3 # fails when the cloud service is overloaded +- ${{ if not(parameters.IsOptProf) }}: + - task: notice@0 + displayName: 🛠️ Generate NOTICE file + inputs: + outputfile: $(System.DefaultWorkingDirectory)/obj/NOTICE + outputformat: text + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + retryCountOnTaskFailure: 5 # fails when the cloud service is overloaded + continueOnError: ${{ not(parameters.RealSign) }} # Tolerate failures when we're not building something that may ship. - ${{ if parameters.IsOptProf }}: # We have to install these plugins ourselves for Optprof runs because those pipelines haven't migrated to 1ES PT yet. From 5a329c4011165e861af9a9724f394b1ec0f4e710 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 20 Feb 2024 14:00:26 -0700 Subject: [PATCH 747/889] Update ubuntu image names --- azure-pipelines/archive-sourcecode.yml | 2 +- azure-pipelines/official.yml | 4 ++-- azure-pipelines/prepare-insertion-stages.yml | 2 +- azure-pipelines/release.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/azure-pipelines/archive-sourcecode.yml b/azure-pipelines/archive-sourcecode.yml index afdf0f6b..c550e2c2 100644 --- a/azure-pipelines/archive-sourcecode.yml +++ b/azure-pipelines/archive-sourcecode.yml @@ -44,7 +44,7 @@ extends: pool: name: AzurePipelines-EO demands: - - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT + - ImageOverride -equals 1ESPT-Ubuntu22.04 os: Linux steps: diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 8cdf3afb..a3d64e68 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -76,7 +76,7 @@ extends: linuxPool: name: AzurePipelines-EO demands: - - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT + - ImageOverride -equals 1ESPT-Ubuntu22.04 os: Linux macOSPool: name: Azure Pipelines @@ -108,7 +108,7 @@ extends: linuxPool: name: AzurePipelines-EO demands: - - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT + - ImageOverride -equals 1ESPT-Ubuntu22.04 os: Linux macOSPool: name: Azure Pipelines diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index 6ffff531..da163c76 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -41,7 +41,7 @@ stages: pool: name: AzurePipelines-EO demands: - - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT + - ImageOverride -equals 1ESPT-Ubuntu22.04 os: Linux templateContext: outputs: diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml index 2da6ddf0..0f425fb6 100644 --- a/azure-pipelines/release.yml +++ b/azure-pipelines/release.yml @@ -30,7 +30,7 @@ extends: pool: name: AzurePipelines-EO demands: - - ImageOverride -equals AzurePipelinesUbuntu20.04compliantGPT + - ImageOverride -equals 1ESPT-Ubuntu22.04 os: Linux templateContext: outputs: From 1eba738358ff53acd1ffa70f7b11b9c102d61b97 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 20 Feb 2024 15:51:50 -0700 Subject: [PATCH 748/889] Publish logs on build/test failures for mac/linux We were already doing this right on Windows. --- azure-pipelines/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 5d3fbd06..4b6aa164 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -127,6 +127,7 @@ jobs: displayName: 📢 Publish ${{ artifact_name }}-Linux targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-Linux artifactName: ${{ artifact_name }}-Linux + condition: succeededOrFailed() steps: - checkout: self fetchDepth: 0 # avoid shallow clone so nbgv can do its work. @@ -157,6 +158,7 @@ jobs: displayName: 📢 Publish ${{ artifact_name }}-macOS targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-macOS artifactName: ${{ artifact_name }}-macOS + condition: succeededOrFailed() steps: - checkout: self fetchDepth: 0 # avoid shallow clone so nbgv can do its work. From 1d3bd2b944838856145805c77d12b19a71d3c3e1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 20 Feb 2024 14:22:55 -0700 Subject: [PATCH 749/889] OptProf pipeline fixes --- azure-pipelines/OptProf.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/OptProf.yml b/azure-pipelines/OptProf.yml index 6d81439a..dc0e4435 100644 --- a/azure-pipelines/OptProf.yml +++ b/azure-pipelines/OptProf.yml @@ -35,7 +35,6 @@ stages: parameters: Is1ESPT: false RealSign: true - EnableLocalization: false EnableCompliance: false windowsPool: VSEngSS-MicroBuild2022-1ES includeMacOS: false @@ -86,6 +85,8 @@ stages: - task: MicroBuildInsertVsPayload@4 displayName: Insert VS Payload inputs: + TeamName: $(TeamName) + TeamEmail: $(TeamEmail) SkipCreatePR: true CustomScriptExecutionCommand: src\VSSDK\NuGet\AllowUnstablePackages.ps1 - task: benjhuser.tfs-extensions-build-tasks.trigger-build-task.TriggerBuild@3 From 891d82b51df52818793084ab6f5e74053ef2648a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 20 Feb 2024 16:02:03 -0700 Subject: [PATCH 750/889] Fix `notice@0` task on non-default branches --- azure-pipelines/microbuild.before.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/microbuild.before.yml b/azure-pipelines/microbuild.before.yml index ce711a0a..05acd319 100644 --- a/azure-pipelines/microbuild.before.yml +++ b/azure-pipelines/microbuild.before.yml @@ -15,14 +15,18 @@ parameters: type: boolean steps: -- ${{ if not(parameters.IsOptProf) }}: +- ${{ if and(not(parameters.IsOptProf), ne(variables['Build.Reason'], 'PullRequest')) }}: + # notice@0 requires CG detection to run first, and non-default branches don't inject it automatically. + - ${{ if ne(variables['Build.SourceBranch'], 'refs/heads/main') }}: + - task: ComponentGovernanceComponentDetection@0 + displayName: 🔍 Component Detection + - task: notice@0 displayName: 🛠️ Generate NOTICE file inputs: outputfile: $(System.DefaultWorkingDirectory)/obj/NOTICE outputformat: text - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - retryCountOnTaskFailure: 5 # fails when the cloud service is overloaded + retryCountOnTaskFailure: 3 # fails when the cloud service is overloaded continueOnError: ${{ not(parameters.RealSign) }} # Tolerate failures when we're not building something that may ship. - ${{ if parameters.IsOptProf }}: From e5e41d4a503ef08a0a0f8e68232e76e5325ba7e6 Mon Sep 17 00:00:00 2001 From: Matteo Prosperi <41970398+matteo-prosperi@users.noreply.github.com> Date: Tue, 20 Feb 2024 17:02:18 -0800 Subject: [PATCH 751/889] Disable the generation of SBOMs for artifacts in unsigned builds --- azure-pipelines/official.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index a3d64e68..610900b7 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -62,6 +62,8 @@ extends: exclusionsFile: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml suppression: suppressionFile: $(System.DefaultWorkingDirectory)\azure-pipelines\falsepositives.gdnsuppress + sbom: + enabled: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} # Disable the generation for SBOMs for artifacts in unsigned builds since it's slow stages: - stage: Build variables: From d92acd3528bc80128b2a6b6cbc628ffa2b4f7067 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 21 Feb 2024 12:43:59 -0700 Subject: [PATCH 752/889] Fix `ShouldSkipOptimize` parameter references --- azure-pipelines/official.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 3caa9f9d..72dcb4f0 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -24,7 +24,7 @@ parameters: displayName: Real sign? type: boolean default: false -# - name: ShouldSkipOptimize # Enable this when setting EnableOptProf to true in build.yml. +# - name: ShouldSkipOptimize # Enable this and references to it below when setting EnableOptProf to true in build.yml. # displayName: Skip OptProf optimization # type: boolean # default: false @@ -75,7 +75,7 @@ extends: parameters: Is1ESPT: true RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} - ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} + # ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} EnableCompliance: ${{ parameters.EnableCompliance }} EnableAPIScan: ${{ parameters.EnableAPIScan }} windowsPool: VSEngSS-MicroBuild2022-1ES @@ -109,7 +109,7 @@ extends: parameters: Is1ESPT: true RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} - ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} + # ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} EnableCompliance: ${{ parameters.EnableCompliance }} EnableAPIScan: ${{ parameters.EnableAPIScan }} windowsPool: VSEngSS-MicroBuild2022-1ES From 214c048692cc64ff58481c963ceda59d13ad029b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 21 Feb 2024 13:44:49 -0700 Subject: [PATCH 753/889] Make mac/linux agents trivially excludable --- azure-pipelines.yml | 4 +- azure-pipelines/OptProf.yml | 2 +- azure-pipelines/build.yml | 145 +++++++++++++---------- azure-pipelines/official.yml | 6 +- azure-pipelines/publish-codecoverage.yml | 24 ++-- azure-pipelines/publish-symbols.yml | 59 ++++----- azure-pipelines/vs-validation.yml | 2 +- 7 files changed, 134 insertions(+), 108 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e6ceafef..79f69c22 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -14,7 +14,7 @@ trigger: - azure-pipelines/release.yml parameters: -- name: includeMacOS +- name: EnableMacOSBuild displayName: Build on macOS type: boolean default: false # macOS is often bogged down in Azure Pipelines @@ -30,5 +30,5 @@ jobs: - template: azure-pipelines/build.yml parameters: Is1ESPT: false - includeMacOS: ${{ parameters.includeMacOS }} + EnableMacOSBuild: ${{ parameters.EnableMacOSBuild }} RunTests: ${{ parameters.RunTests }} diff --git a/azure-pipelines/OptProf.yml b/azure-pipelines/OptProf.yml index dc0e4435..0f4ba24f 100644 --- a/azure-pipelines/OptProf.yml +++ b/azure-pipelines/OptProf.yml @@ -37,7 +37,7 @@ stages: RealSign: true EnableCompliance: false windowsPool: VSEngSS-MicroBuild2022-1ES - includeMacOS: false + EnableMacOSBuild: false ShouldSkipOptimize: true IsOptProf: true RunTests: false diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 215512c9..f82afad6 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -16,8 +16,12 @@ parameters: type: object default: vmImage: macOS-12 -- name: includeMacOS +- name: EnableLinuxBuild type: boolean + default: true +- name: EnableMacOSBuild + type: boolean + default: true - name: EnableOptProf type: boolean default: false @@ -39,6 +43,9 @@ parameters: - name: EnableAPIScan type: boolean default: false +- name: EnableDotNetFormatCheck + type: boolean + default: true - name: artifact_names type: object default: @@ -132,6 +139,10 @@ jobs: RunTests: ${{ parameters.RunTests }} IsOptProf: ${{ parameters.IsOptProf }} + - ${{ if and(parameters.EnableDotNetFormatCheck, not(parameters.EnableLinuxBuild)) }}: + - script: dotnet format --verify-no-changes --no-restore + displayName: 💅 Verify formatted code + - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - template: microbuild.after.yml parameters: @@ -143,72 +154,76 @@ jobs: - template: expand-template.yml - ${{ if not(parameters.IsOptProf) }}: - - job: Linux - pool: ${{ parameters.linuxPool }} - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - templateContext: - mb: - ${{ if parameters.RealSign }}: - signing: - enabled: false # enable when building unique artifacts on this agent that must be signed - signType: real - outputParentDirectory: $(Build.ArtifactStagingDirectory) - outputs: - - ${{ each artifact_name in parameters.artifact_names }}: - - ${{ if or(ne(artifact_name, 'testResults'), parameters.RunTests) }}: - - output: pipelineArtifact - displayName: 📢 Publish ${{ artifact_name }}-Linux - targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-Linux - artifactName: ${{ artifact_name }}-Linux - condition: succeededOrFailed() - steps: - - checkout: self - fetchDepth: 0 # avoid shallow clone so nbgv can do its work. - clean: true - - template: install-dependencies.yml - - template: dotnet.yml - parameters: - Is1ESPT: ${{ parameters.Is1ESPT }} - RunTests: ${{ parameters.RunTests }} - - script: dotnet format --verify-no-changes --no-restore - displayName: 💅 Verify formatted code - - template: expand-template.yml + - ${{ if parameters.EnableLinuxBuild }}: + - job: Linux + pool: ${{ parameters.linuxPool }} + ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + templateContext: + mb: + ${{ if parameters.RealSign }}: + signing: + enabled: false # enable when building unique artifacts on this agent that must be signed + signType: real + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - ${{ each artifact_name in parameters.artifact_names }}: + - ${{ if or(ne(artifact_name, 'testResults'), parameters.RunTests) }}: + - output: pipelineArtifact + displayName: 📢 Publish ${{ artifact_name }}-Linux + targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-Linux + artifactName: ${{ artifact_name }}-Linux + condition: succeededOrFailed() + steps: + - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. + clean: true + - template: install-dependencies.yml + - template: dotnet.yml + parameters: + Is1ESPT: ${{ parameters.Is1ESPT }} + RunTests: ${{ parameters.RunTests }} + - ${{ if parameters.EnableDotNetFormatCheck }}: + - script: dotnet format --verify-no-changes --no-restore + displayName: 💅 Verify formatted code + - template: expand-template.yml - - job: macOS - condition: ${{ parameters.includeMacOS }} - pool: ${{ parameters.macOSPool }} - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - templateContext: - mb: - ${{ if parameters.RealSign }}: - signing: - enabled: false # enable when building unique artifacts on this agent that must be signed - signType: real - outputParentDirectory: $(Build.ArtifactStagingDirectory) - outputs: - - ${{ each artifact_name in parameters.artifact_names }}: - - ${{ if or(ne(artifact_name, 'testResults'), parameters.RunTests) }}: - - output: pipelineArtifact - displayName: 📢 Publish ${{ artifact_name }}-macOS - targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-macOS - artifactName: ${{ artifact_name }}-macOS - condition: succeededOrFailed() - steps: - - checkout: self - fetchDepth: 0 # avoid shallow clone so nbgv can do its work. - clean: true - - template: install-dependencies.yml - - template: dotnet.yml - parameters: - Is1ESPT: ${{ parameters.Is1ESPT }} - RunTests: ${{ parameters.RunTests }} - - template: expand-template.yml + - ${{ if parameters.EnableMacOSBuild }}: + - job: macOS + pool: ${{ parameters.macOSPool }} + ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + templateContext: + mb: + ${{ if parameters.RealSign }}: + signing: + enabled: false # enable when building unique artifacts on this agent that must be signed + signType: real + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - ${{ each artifact_name in parameters.artifact_names }}: + - ${{ if or(ne(artifact_name, 'testResults'), parameters.RunTests) }}: + - output: pipelineArtifact + displayName: 📢 Publish ${{ artifact_name }}-macOS + targetPath: $(Build.ArtifactStagingDirectory)/${{ artifact_name }}-macOS + artifactName: ${{ artifact_name }}-macOS + condition: succeededOrFailed() + steps: + - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. + clean: true + - template: install-dependencies.yml + - template: dotnet.yml + parameters: + Is1ESPT: ${{ parameters.Is1ESPT }} + RunTests: ${{ parameters.RunTests }} + - template: expand-template.yml - job: WrapUp dependsOn: - Windows - - Linux - - macOS + - ${{ if parameters.EnableLinuxBuild }}: + - Linux + - ${{ if parameters.EnableMacOSBuild }}: + - macOS pool: ${{ parameters.windowsPool }} # Use Windows agent because PublishSymbols task requires it (https://github.com/microsoft/azure-pipelines-tasks/issues/13821). condition: succeededOrFailed() steps: @@ -220,8 +235,10 @@ jobs: initArgs: -NoRestore - template: publish-symbols.yml parameters: - includeMacOS: ${{ parameters.includeMacOS }} + EnableLinuxBuild: ${{ parameters.EnableLinuxBuild }} + EnableMacOSBuild: ${{ parameters.EnableMacOSBuild }} - ${{ if parameters.RunTests }}: - template: publish-codecoverage.yml parameters: - includeMacOS: ${{ parameters.includeMacOS }} + EnableLinuxBuild: ${{ parameters.EnableLinuxBuild }} + EnableMacOSBuild: ${{ parameters.EnableMacOSBuild }} diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 72dcb4f0..1bd088b1 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -28,7 +28,7 @@ parameters: # displayName: Skip OptProf optimization # type: boolean # default: false -- name: includeMacOS +- name: EnableMacOSBuild displayName: Build on macOS type: boolean default: false # macOS is often bogged down in Azure Pipelines @@ -88,7 +88,7 @@ extends: name: Azure Pipelines vmImage: macOS-12 os: macOS - includeMacOS: ${{ parameters.includeMacOS }} + EnableMacOSBuild: ${{ parameters.EnableMacOSBuild }} RunTests: ${{ parameters.RunTests }} - template: /azure-pipelines/prepare-insertion-stages.yml@self parameters: @@ -122,7 +122,7 @@ extends: name: Azure Pipelines vmImage: macOS-12 os: macOS - includeMacOS: ${{ parameters.includeMacOS }} + EnableMacOSBuild: ${{ parameters.EnableMacOSBuild }} RunTests: ${{ parameters.RunTests }} - template: /azure-pipelines/prepare-insertion-stages.yml@self parameters: diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index fbb6a39a..c6247a11 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -1,20 +1,24 @@ parameters: - includeMacOS: +- name: EnableMacOSBuild + type: boolean +- name: EnableLinuxBuild + type: boolean steps: - download: current artifact: coverageResults-Windows displayName: 🔻 Download Windows code coverage results continueOnError: true -- download: current - artifact: coverageResults-Linux - displayName: 🔻 Download Linux code coverage results - continueOnError: true -- download: current - artifact: coverageResults-macOS - displayName: 🔻 Download macOS code coverage results - continueOnError: true - condition: and(succeeded(), ${{ parameters.includeMacOS }}) +- ${{ if parameters.EnableLinuxBuild }}: + - download: current + artifact: coverageResults-Linux + displayName: 🔻 Download Linux code coverage results + continueOnError: true +- ${{ if parameters.EnableMacOSBuild }}: + - download: current + artifact: coverageResults-macOS + displayName: 🔻 Download macOS code coverage results + continueOnError: true - powershell: azure-pipelines/Merge-CodeCoverage.ps1 -Path '$(Pipeline.Workspace)' -OutputFile coveragereport/merged.cobertura.xml -Format Cobertura -Verbose displayName: ⚙ Merge coverage - task: PublishCodeCoverageResults@1 diff --git a/azure-pipelines/publish-symbols.yml b/azure-pipelines/publish-symbols.yml index 00b5a3a6..ddf82352 100644 --- a/azure-pipelines/publish-symbols.yml +++ b/azure-pipelines/publish-symbols.yml @@ -1,5 +1,8 @@ parameters: - includeMacOS: +- name: EnableMacOSBuild + type: boolean +- name: EnableLinuxBuild + type: boolean steps: - task: DownloadPipelineArtifact@2 @@ -8,19 +11,20 @@ steps: path: $(Pipeline.Workspace)/symbols/Windows displayName: 🔻 Download Windows symbols continueOnError: true -- task: DownloadPipelineArtifact@2 - inputs: - artifact: symbols-Linux - path: $(Pipeline.Workspace)/symbols/Linux - displayName: 🔻 Download Linux symbols - continueOnError: true -- task: DownloadPipelineArtifact@2 - inputs: - artifact: symbols-macOS - path: $(Pipeline.Workspace)/symbols/macOS - displayName: 🔻 Download macOS symbols - continueOnError: true - condition: ${{ parameters.includeMacOS }} +- ${{ if parameters.EnableLinuxBuild }}: + - task: DownloadPipelineArtifact@2 + inputs: + artifact: symbols-Linux + path: $(Pipeline.Workspace)/symbols/Linux + displayName: 🔻 Download Linux symbols + continueOnError: true +- ${{ if parameters.EnableMacOSBuild }}: + - task: DownloadPipelineArtifact@2 + inputs: + artifact: symbols-macOS + path: $(Pipeline.Workspace)/symbols/macOS + displayName: 🔻 Download macOS symbols + continueOnError: true - task: DownloadPipelineArtifact@2 inputs: @@ -28,19 +32,20 @@ steps: path: $(Pipeline.Workspace)/test_symbols/Windows displayName: 🔻 Download Windows test symbols continueOnError: true -- task: DownloadPipelineArtifact@2 - inputs: - artifact: test_symbols-Linux - path: $(Pipeline.Workspace)/test_symbols/Linux - displayName: 🔻 Download Linux test symbols - continueOnError: true -- task: DownloadPipelineArtifact@2 - inputs: - artifact: test_symbols-macOS - path: $(Pipeline.Workspace)/test_symbols/macOS - displayName: 🔻 Download macOS test symbols - continueOnError: true - condition: ${{ parameters.includeMacOS }} +- ${{ if parameters.EnableLinuxBuild }}: + - task: DownloadPipelineArtifact@2 + inputs: + artifact: test_symbols-Linux + path: $(Pipeline.Workspace)/test_symbols/Linux + displayName: 🔻 Download Linux test symbols + continueOnError: true +- ${{ if parameters.EnableMacOSBuild }}: + - task: DownloadPipelineArtifact@2 + inputs: + artifact: test_symbols-macOS + path: $(Pipeline.Workspace)/test_symbols/macOS + displayName: 🔻 Download macOS test symbols + continueOnError: true - task: PublishSymbols@2 inputs: diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index 195bfff3..c541be60 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -35,7 +35,7 @@ extends: Is1ESPT: true RealSign: true windowsPool: VSEngSS-MicroBuild2022-1ES - includeMacOS: false + EnableMacOSBuild: false RunTests: false - template: /azure-pipelines/prepare-insertion-stages.yml@self From c7d1dd3f26d3d24dee6471114fb7f4381bf10283 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 21 Feb 2024 14:35:54 -0700 Subject: [PATCH 754/889] Clarify code comment --- azure-pipelines/official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 1bd088b1..cabae2d2 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -24,7 +24,7 @@ parameters: displayName: Real sign? type: boolean default: false -# - name: ShouldSkipOptimize # Enable this and references to it below when setting EnableOptProf to true in build.yml. +# - name: ShouldSkipOptimize # Uncomment this and references to it below when setting EnableOptProf to true in build.yml. # displayName: Skip OptProf optimization # type: boolean # default: false From f38dd307bfdaf94863b877b085f1ee24ca0d893d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 21 Feb 2024 14:42:12 -0700 Subject: [PATCH 755/889] Fix assigning reviewers to insertion PRs --- azure-pipelines/vs-insertion.yml | 2 +- azure-pipelines/vs-validation.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 9cb597ea..8a6ffa0e 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -54,7 +54,7 @@ extends: TeamEmail: $(TeamEmail) InsertionPayloadName: $(Build.Repository.Name) $(Build.BuildNumber) InsertionBuildPolicy: Request Perf DDRITs - InsertionReviewers: $(TeamEmail),$(Build.RequestedForEmail) + InsertionReviewers: $(Build.RequestedFor) # Append `,Your team name` (without quotes) AutoCompletePR: true AutoCompleteMergeStrategy: Squash - powershell: | diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index c541be60..4d385796 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -78,7 +78,7 @@ extends: This PR is for **validation purposes only** for !$(System.PullRequest.PullRequestId). **Do not complete**. CustomScriptExecutionCommand: src/VSSDK/NuGet/AllowUnstablePackages.ps1 InsertionBuildPolicy: Request Perf DDRITs - InsertionReviewers: $(Build.RequestedForEmail) + InsertionReviewers: $(Build.RequestedFor) AutoCompletePR: false - powershell: | $insertionPRId = azure-pipelines/Get-InsertionPRId.ps1 From b21987e11f1d74129d02351bc983098706c8a554 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 21 Feb 2024 15:48:10 -0700 Subject: [PATCH 756/889] fix typo --- .vscode/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index efbe74f4..45467326 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,6 +18,6 @@ // Needs to be explicitly configured: https://github.com/Microsoft/azure-pipelines-vscode#document-formatting "[azure-pipelines]": { "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": false // enable this when the conform + "editor.formatOnSave": false // enable this when they conform }, } From aa80117c6126647da771c73d013c0a1614e89bb8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 21 Feb 2024 18:58:30 -0700 Subject: [PATCH 757/889] Avoid shallow cloning for optprof pipelines --- azure-pipelines/build.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index f82afad6..f3b5f2fb 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -116,6 +116,14 @@ jobs: targetPath: $(Build.ArtifactStagingDirectory)/LocBin-Windows artifactName: LocBin-Windows steps: + - ${{ if not(parameters.Is1ESPT) }}: + - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. + clean: true + - ${{ if parameters.EnableOptProf }}: + - powershell: Write-Host "##vso[task.setvariable variable=PROFILINGINPUTSDROPNAME]$(azure-pipelines/variables/ProfilingInputsDropName.ps1)" + displayName: ⚙ Set ProfilingInputsDropName for optprof + - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: - template: schedule-only-steps.yml From 00f463153e4257899c160f2d0df97c6b97d3b569 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 22 Feb 2024 13:36:20 -0700 Subject: [PATCH 758/889] Extract APIScan into its own job --- azure-pipelines/apiscan.yml | 43 ++++++++++++++++++++ azure-pipelines/artifacts/APIScanInputs.ps1 | 24 +++++++++++ azure-pipelines/build.yml | 17 +++++--- azure-pipelines/microbuild.after.yml | 11 ----- azure-pipelines/secure-development-tools.yml | 41 ------------------- 5 files changed, 78 insertions(+), 58 deletions(-) create mode 100644 azure-pipelines/apiscan.yml create mode 100644 azure-pipelines/artifacts/APIScanInputs.ps1 delete mode 100644 azure-pipelines/secure-development-tools.yml diff --git a/azure-pipelines/apiscan.yml b/azure-pipelines/apiscan.yml new file mode 100644 index 00000000..2f482ca1 --- /dev/null +++ b/azure-pipelines/apiscan.yml @@ -0,0 +1,43 @@ +parameters: +- name: windowsPool + type: object + +jobs: +- job: apiscan + displayName: APIScan + dependsOn: Windows + pool: ${{ parameters.windowsPool }} + variables: + - name: SymbolsFeatureName + value: $[ dependencies.Windows.outputs['SetPipelineVariables.SymbolsFeatureName'] ] + - name: NBGV_MajorMinorVersion + value: $[ dependencies.Windows.outputs['nbgv.NBGV_MajorMinorVersion'] ] + - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: + # https://dev.azure.com/devdiv/DevDiv/_wiki/wikis/DevDiv.wiki/25351/APIScan-step-by-step-guide-to-setting-up-a-Pipeline + - group: VSCloudServices-APIScan # Expected to provide ApiScanClientId, ApiScanSecret, ApiScanTenant + steps: + # We need TSAOptions.json + - checkout: self + fetchDepth: 1 + + - download: current + artifact: APIScanInputs + displayName: 🔻 Download APIScanInputs artifact + + - task: APIScan@2 + displayName: 🔍 Run APIScan + inputs: + softwareFolder: $(Pipeline.Workspace)/APIScanInputs + softwareName: $(SymbolsFeatureName) + softwareVersionNum: $(NBGV_MajorMinorVersion) + isLargeApp: false + toolVersion: Latest + env: + AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) + + # File bugs when APIScan finds issues + - task: TSAUpload@2 + displayName: 🪳 TSA upload + inputs: + GdnPublishTsaOnboard: True + GdnPublishTsaConfigFile: $(Build.SourcesDirectory)\azure-pipelines\TSAOptions.json diff --git a/azure-pipelines/artifacts/APIScanInputs.ps1 b/azure-pipelines/artifacts/APIScanInputs.ps1 new file mode 100644 index 00000000..15556413 --- /dev/null +++ b/azure-pipelines/artifacts/APIScanInputs.ps1 @@ -0,0 +1,24 @@ +$inputs = & "$PSScriptRoot/symbols.ps1" + +if (!$inputs) { return } + +# Filter out specific files that APIScan does not support. +# Specifically, APIScan doesn't support Windows ARM64 binaries, nor linux/OSX binaries. +$outputs = @{} +$forbiddenSubPaths = @( + , 'arm64' + , 'win-arm64' + , 'linux-*' + , 'osx*' +) + +$inputs.GetEnumerator() | % { + $list = $_.Value | ? { + $path = $_.Replace('\', '/') + return !($forbiddenSubPaths | ? { $path -like "*/$_/*" }) + } + $outputs[$_.Key] = $list +} + + +$outputs diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index f3b5f2fb..ba6014ff 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -62,10 +62,6 @@ jobs: - job: Windows pool: ${{ parameters.windowsPool }} timeoutInMinutes: 180 # Give plenty of time due to real signing - variables: - - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - # https://dev.azure.com/devdiv/DevDiv/_wiki/wikis/DevDiv.wiki/25351/APIScan-step-by-step-guide-to-setting-up-a-Pipeline - - group: VSCloudServices-APIScan # Expected to provide ApiScanClientId, ApiScanSecret, ApiScanTenant ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: templateContext: mb: @@ -115,6 +111,11 @@ jobs: displayName: 📢 Publish LocBin-Windows targetPath: $(Build.ArtifactStagingDirectory)/LocBin-Windows artifactName: LocBin-Windows + - ${{ if and(parameters.EnableCompliance, parameters.EnableAPIScan) }}: + - output: pipelineArtifact + displayName: 📢 Publish APIScanInputs + targetPath: $(Build.ArtifactStagingDirectory)/APIScanInputs-Windows + artifactName: APIScanInputs steps: - ${{ if not(parameters.Is1ESPT) }}: - checkout: self @@ -131,6 +132,7 @@ jobs: - script: dotnet nbgv cloud -ca displayName: ⚙ Set build number + name: nbgv - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - template: microbuild.before.yml @@ -154,8 +156,6 @@ jobs: - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - template: microbuild.after.yml parameters: - EnableCompliance: ${{ parameters.EnableCompliance }} - EnableAPIScan: ${{ parameters.EnableAPIScan }} EnableOptProf: ${{ parameters.EnableOptProf }} IsOptProf: ${{ parameters.IsOptProf }} @@ -250,3 +250,8 @@ jobs: parameters: EnableLinuxBuild: ${{ parameters.EnableLinuxBuild }} EnableMacOSBuild: ${{ parameters.EnableMacOSBuild }} + + - ${{ if and(parameters.EnableCompliance, parameters.EnableAPIScan) }}: + - template: apiscan.yml + parameters: + windowsPool: ${{ parameters.windowsPool }} diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index f9698e3e..94e83d34 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -1,10 +1,4 @@ parameters: -- name: EnableCompliance - type: boolean - default: false -- name: EnableAPIScan - type: boolean - default: false - name: EnableOptProf type: boolean default: false @@ -39,8 +33,3 @@ steps: ArtifactName: InsertionOutputs ArtifactType: Container displayName: 📢 Publish InsertionOutputs as Azure DevOps artifacts - -- ${{ if parameters.EnableCompliance }}: - - template: secure-development-tools.yml - parameters: - EnableAPIScan: ${{ parameters.EnableAPIScan }} diff --git a/azure-pipelines/secure-development-tools.yml b/azure-pipelines/secure-development-tools.yml deleted file mode 100644 index 409f48d0..00000000 --- a/azure-pipelines/secure-development-tools.yml +++ /dev/null @@ -1,41 +0,0 @@ -parameters: -- name: EnableAPIScan - type: boolean - default: false - -steps: - -- powershell: echo "##vso[build.addbuildtag]compliance" - displayName: 🏷️ Tag run with 'compliance' - -- task: CopyFiles@2 - displayName: 📂 Collect APIScan inputs - inputs: - SourceFolder: $(Build.ArtifactStagingDirectory)/Symbols-$(Agent.JobName) - # Exclude any patterns from the Contents (e.g. `!**/git2*`) that we have symbols for but do not need to run APIScan on. - Contents: | - ** - !**/arm64/** - !**/win-arm64/** - !**/linux-*/** - !**/osx*/** - TargetFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs - -- ${{ if parameters.EnableAPIScan }}: - - task: APIScan@2 - displayName: 🔍 Run APIScan - inputs: - softwareFolder: $(Build.ArtifactStagingDirectory)/APIScanInputs - softwareName: $(SymbolsFeatureName) - softwareVersionNum: $(NBGV_MajorMinorVersion) - isLargeApp: false - toolVersion: Latest - env: - AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) - - # File bugs when APIScan finds issues - - task: TSAUpload@2 - displayName: 🪳 TSA upload - inputs: - GdnPublishTsaOnboard: True - GdnPublishTsaConfigFile: $(Build.SourcesDirectory)\azure-pipelines\TSAOptions.json From 617fb13463952ed613bd17231c346651b3a861f2 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 22 Feb 2024 15:26:49 -0700 Subject: [PATCH 759/889] Skip APIScan on pull requests --- azure-pipelines/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index ba6014ff..08c9e1d4 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -111,7 +111,7 @@ jobs: displayName: 📢 Publish LocBin-Windows targetPath: $(Build.ArtifactStagingDirectory)/LocBin-Windows artifactName: LocBin-Windows - - ${{ if and(parameters.EnableCompliance, parameters.EnableAPIScan) }}: + - ${{ if and(parameters.EnableCompliance, parameters.EnableAPIScan, ne(variables['Build.Reason'], 'pullRequest')) }}: - output: pipelineArtifact displayName: 📢 Publish APIScanInputs targetPath: $(Build.ArtifactStagingDirectory)/APIScanInputs-Windows @@ -251,7 +251,7 @@ jobs: EnableLinuxBuild: ${{ parameters.EnableLinuxBuild }} EnableMacOSBuild: ${{ parameters.EnableMacOSBuild }} - - ${{ if and(parameters.EnableCompliance, parameters.EnableAPIScan) }}: + - ${{ if and(parameters.EnableCompliance, parameters.EnableAPIScan, ne(variables['Build.Reason'], 'pullRequest')) }}: - template: apiscan.yml parameters: windowsPool: ${{ parameters.windowsPool }} From cdb447aac1c5fecf071265ad5c65edff6acc5e18 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 23 Feb 2024 15:05:09 -0700 Subject: [PATCH 760/889] Document pipeline parameters --- azure-pipelines/OptProf.yml | 1 - azure-pipelines/build.yml | 103 +++++++++++++++++++++++------------ azure-pipelines/official.yml | 9 +-- 3 files changed, 73 insertions(+), 40 deletions(-) diff --git a/azure-pipelines/OptProf.yml b/azure-pipelines/OptProf.yml index 0f4ba24f..d95c84c8 100644 --- a/azure-pipelines/OptProf.yml +++ b/azure-pipelines/OptProf.yml @@ -35,7 +35,6 @@ stages: parameters: Is1ESPT: false RealSign: true - EnableCompliance: false windowsPool: VSEngSS-MicroBuild2022-1ES EnableMacOSBuild: false ShouldSkipOptimize: true diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 08c9e1d4..26b731ca 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -1,62 +1,95 @@ parameters: -- name: Is1ESPT +##### The following parameters are not set by other YAML files that import this one, +##### but we use parameters because they support rich types and defaults. +##### Feel free to adjust their default value as needed. + +# Whether this repo uses OptProf to optimize the built binaries. +- name: EnableOptProf type: boolean -- name: RealSign + default: false +# Whether this repo is localized. +- name: EnableLocalization type: boolean default: false -- name: windowsPool - type: object - default: - vmImage: windows-2022 -- name: linuxPool - type: object - default: - vmImage: ubuntu-20.04 -- name: macOSPool +# Whether to run `dotnet format` as part of the build to ensure code style consistency. +# This is just one of a a few mechanisms to enforce code style consistency. +- name: EnableDotNetFormatCheck + type: boolean + default: true +# This lists the names of the artifacts that will be published *from every OS build agent*. +# Any new azure-pipelines/artifacts/*.ps1 script needs to be added to this list. +# If an artifact is only generated or collected on one OS, it should NOT be listed here, +# but should be manually added to the `outputs:` field in the appropriate OS job. +- name: artifact_names type: object default: - vmImage: macOS-12 + - build_logs + - coverageResults + - deployables + - projectAssetsJson + - symbols + - testResults + - test_symbols + - Variables +# The Enable*Build parameters turn non-Windows agents on or off. +# Their default value should be based on whether the build and tests are expected/required to pass on that platform. +# Callers (e.g. Official.yml) *may* expose these parameters at queue-time in order to turn OFF optional agents. - name: EnableLinuxBuild type: boolean default: true - name: EnableMacOSBuild type: boolean default: true -- name: EnableOptProf + +##### 👆🏼 You MAY change the defaults above. +##### 👇🏼 You should NOT change the defaults below. + +##### The following parameters are expected to be set by other YAML files that import this one. +##### Those without defaults require explicit values to be provided by our importers. + +# Indicates whether the entrypoint file is 1ESPT compliant. Use this parameter to switch between publish tasks to fit 1ES or non-1ES needs. +- name: Is1ESPT type: boolean - default: false -- name: IsOptProf + +- name: RealSign type: boolean default: false -- name: ShouldSkipOptimize + +# Whether this particular run is an OptProf profiling run. +# This is used to skip unit tests and other non-essential work to improve reliability of the OptProf pipeline. +- name: IsOptProf type: boolean default: false + - name: RunTests type: boolean default: true -- name: EnableLocalization - type: boolean - default: false -- name: EnableCompliance - type: boolean - default: false + - name: EnableAPIScan type: boolean default: false -- name: EnableDotNetFormatCheck + +# This parameter exists to provide a workaround to get a build out even when no OptProf profiling outputs can be found. +# Entrypoint yaml files like official.yml should expose this as a queue-time setting when EnableOptProf is true in this file. +# The OptProf.yml entrypoint sets this parameter to true so that collecting profile data isn't blocked by a prior lack of profile data. +- name: ShouldSkipOptimize type: boolean - default: true -- name: artifact_names + default: false + +# The pool parameters are set to defaults that work in the azure-public AzDO account. +# They are overridden by callers for the devdiv AzDO account to use 1ES compliant pools. +- name: windowsPool + type: object + default: + vmImage: windows-2022 +- name: linuxPool type: object default: - - build_logs - - coverageResults - - deployables - - projectAssetsJson - - symbols - - testResults - - test_symbols - - Variables + vmImage: ubuntu-20.04 +- name: macOSPool + type: object + default: + vmImage: macOS-12 jobs: - job: Windows @@ -111,7 +144,7 @@ jobs: displayName: 📢 Publish LocBin-Windows targetPath: $(Build.ArtifactStagingDirectory)/LocBin-Windows artifactName: LocBin-Windows - - ${{ if and(parameters.EnableCompliance, parameters.EnableAPIScan, ne(variables['Build.Reason'], 'pullRequest')) }}: + - ${{ if parameters.EnableAPIScan }}: - output: pipelineArtifact displayName: 📢 Publish APIScanInputs targetPath: $(Build.ArtifactStagingDirectory)/APIScanInputs-Windows @@ -251,7 +284,7 @@ jobs: EnableLinuxBuild: ${{ parameters.EnableLinuxBuild }} EnableMacOSBuild: ${{ parameters.EnableMacOSBuild }} - - ${{ if and(parameters.EnableCompliance, parameters.EnableAPIScan, ne(variables['Build.Reason'], 'pullRequest')) }}: + - ${{ if parameters.EnableAPIScan }}: - template: apiscan.yml parameters: windowsPool: ${{ parameters.windowsPool }} diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index ee6dc92c..98e21d22 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -20,6 +20,9 @@ trigger: # - microbuild parameters: +# As an entrypoint pipeline yml file, all parameters here show up in the Queue Run dialog. +# If any paramaters should NOT be queue-time options, they should be removed from here +# and references to them in this file replaced with hard-coded values. - name: RealSign displayName: Real sign? type: boolean @@ -78,8 +81,7 @@ extends: Is1ESPT: true RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} # ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} - EnableCompliance: ${{ parameters.EnableCompliance }} - EnableAPIScan: ${{ parameters.EnableAPIScan }} + EnableAPIScan: ${{ and(parameters.EnableCompliance, parameters.EnableAPIScan, ne(variables['Build.Reason'], 'pullRequest')) }} windowsPool: VSEngSS-MicroBuild2022-1ES linuxPool: name: AzurePipelines-EO @@ -112,8 +114,7 @@ extends: Is1ESPT: true RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} # ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} - EnableCompliance: ${{ parameters.EnableCompliance }} - EnableAPIScan: ${{ parameters.EnableAPIScan }} + EnableAPIScan: ${{ and(parameters.EnableCompliance, parameters.EnableAPIScan, ne(variables['Build.Reason'], 'pullRequest')) }} windowsPool: VSEngSS-MicroBuild2022-1ES linuxPool: name: AzurePipelines-EO From caf95ea5722003e7164c10ca2825d592a53368cb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 26 Feb 2024 15:24:50 -0700 Subject: [PATCH 761/889] Remove artifact publish task from non-OptProf runs --- azure-pipelines/microbuild.after.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 94e83d34..34bdb452 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -14,7 +14,7 @@ steps: $(Build.SourcesDirectory)/bin/Packages/$(BuildConfiguration)/NuGet condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) -- ${{ if parameters.EnableOptProf }}: +- ${{ if parameters.IsOptProf }}: - task: ms-vscs-artifact.build-tasks.artifactDropTask-1.artifactDropTask@0 inputs: dropServiceURI: https://devdiv.artifacts.visualstudio.com @@ -26,10 +26,9 @@ steps: condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) continueOnError: true - - ${{ if parameters.IsOptProf }}: - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/InsertionOutputs - ArtifactName: InsertionOutputs - ArtifactType: Container - displayName: 📢 Publish InsertionOutputs as Azure DevOps artifacts + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)/InsertionOutputs + ArtifactName: InsertionOutputs + ArtifactType: Container + displayName: 📢 Publish InsertionOutputs as Azure DevOps artifacts From 8d19841a37fc725ba37da73bb21d47d5cb3e37ad Mon Sep 17 00:00:00 2001 From: Vivian Lim Date: Mon, 26 Feb 2024 21:42:55 -0800 Subject: [PATCH 762/889] Extend default timeout for APIScan job I've seen it take over an hour on a handful of repos, so it seems like a longer timeout is a reasonable default to specify. --- azure-pipelines/apiscan.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/apiscan.yml b/azure-pipelines/apiscan.yml index 2f482ca1..4e4c0c31 100644 --- a/azure-pipelines/apiscan.yml +++ b/azure-pipelines/apiscan.yml @@ -7,6 +7,7 @@ jobs: displayName: APIScan dependsOn: Windows pool: ${{ parameters.windowsPool }} + timeoutInMinutes: 120 variables: - name: SymbolsFeatureName value: $[ dependencies.Windows.outputs['SetPipelineVariables.SymbolsFeatureName'] ] From 3598bad8c118453bb492198f5809e58c66a17aee Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 27 Feb 2024 13:44:34 -0700 Subject: [PATCH 763/889] Collect APIScan logs as an artifact Also only file bugs when APIScan is run against main. --- azure-pipelines/apiscan.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/azure-pipelines/apiscan.yml b/azure-pipelines/apiscan.yml index 4e4c0c31..554df0eb 100644 --- a/azure-pipelines/apiscan.yml +++ b/azure-pipelines/apiscan.yml @@ -8,6 +8,12 @@ jobs: dependsOn: Windows pool: ${{ parameters.windowsPool }} timeoutInMinutes: 120 + templateContext: + outputs: + - output: pipelineArtifact + displayName: 📢 collect apiscan artifact + targetPath: $(Pipeline.Workspace)/.gdn/.r/apiscan/001/Logs + artifactName: apiscan-logs variables: - name: SymbolsFeatureName value: $[ dependencies.Windows.outputs['SetPipelineVariables.SymbolsFeatureName'] ] @@ -42,3 +48,4 @@ jobs: inputs: GdnPublishTsaOnboard: True GdnPublishTsaConfigFile: $(Build.SourcesDirectory)\azure-pipelines\TSAOptions.json + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) From 7ea6f9cb04b3b56bf6a0a6e487c84fa3fb609bb5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 27 Feb 2024 15:44:32 -0700 Subject: [PATCH 764/889] Fail OptProf pipeline when profilingInputs can't be published --- azure-pipelines/microbuild.after.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 34bdb452..6ec08386 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -24,7 +24,6 @@ steps: usePat: true displayName: 📢 Publish to Artifact Services - ProfilingInputs condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - continueOnError: true - task: PublishBuildArtifacts@1 inputs: From 48d18208f3d24fd090680f7ed4e2e4abc3da1aaa Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 27 Feb 2024 16:08:44 -0700 Subject: [PATCH 765/889] Add missing OptProf.targets file --- azure-pipelines/build.yml | 6 ++++++ src/OptProf.targets | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/OptProf.targets diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 26b731ca..237dd54d 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -4,6 +4,12 @@ parameters: ##### Feel free to adjust their default value as needed. # Whether this repo uses OptProf to optimize the built binaries. +# When enabling this, be sure to update these files: +# - OptProf.targets: InstallationPath and match TestCase selection with what's in the VS repo. +# - The project file(s) for the libraries to optimize must import OptProf.targets. +# - OptProf.yml: Search for LibraryName (or your library's name) and verify that those names are appropriate. +# - OptProf_part2.yml: Search for LibraryName (or your library's name) and verify that those names are appropriate. +# and create pipelines for OptProf.yml, OptProf_part2.yml - name: EnableOptProf type: boolean default: false diff --git a/src/OptProf.targets b/src/OptProf.targets new file mode 100644 index 00000000..d0167d7c --- /dev/null +++ b/src/OptProf.targets @@ -0,0 +1,17 @@ + + + + IBC + Common7\IDE\PrivateAssemblies\$(TargetFileName) + /ExeConfig:"%VisualStudio.InstallationUnderTest.Path%\Common7\IDE\vsn.exe" + + + + + + + + + + + From 9dce0e27cd6a1014f350d22892c8a997bb1e8458 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 27 Feb 2024 16:18:51 -0700 Subject: [PATCH 766/889] Filter VSInsertionMetadata from default.config world --- azure-pipelines/variables/InsertConfigValues.ps1 | 3 ++- azure-pipelines/variables/InsertPropsValues.ps1 | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/variables/InsertConfigValues.ps1 b/azure-pipelines/variables/InsertConfigValues.ps1 index 3ae11de9..ae849697 100644 --- a/azure-pipelines/variables/InsertConfigValues.ps1 +++ b/azure-pipelines/variables/InsertConfigValues.ps1 @@ -3,7 +3,8 @@ $InsertedPkgs = (& "$PSScriptRoot\..\artifacts\VSInsertion.ps1") $icv=@() foreach ($kvp in $InsertedPkgs.GetEnumerator()) { $kvp.Value |% { - if ($_.Name -match "^(.*?)\.(\d+\.\d+\.\d+(?:\.\d+)?(?:-.*?)?)(?:\.symbols)?\.nupkg$") { + # Skip VSInsertionMetadata packages for default.config world, which doesn't use it any more. + if (($_.Name -match "^(.*?)\.(\d+\.\d+\.\d+(?:\.\d+)?(?:-.*?)?)(?:\.symbols)?\.nupkg$") -and $_.Name -notmatch 'VSInsertionMetadata') { $id = $Matches[1] $version = $Matches[2] $icv += "$id=$version" diff --git a/azure-pipelines/variables/InsertPropsValues.ps1 b/azure-pipelines/variables/InsertPropsValues.ps1 index 8d1e70a1..3ae11de9 100644 --- a/azure-pipelines/variables/InsertPropsValues.ps1 +++ b/azure-pipelines/variables/InsertPropsValues.ps1 @@ -1,2 +1,14 @@ -# These values are commonly the same. -& "$PSScriptRoot/InsertConfigValues.ps1" +$InsertedPkgs = (& "$PSScriptRoot\..\artifacts\VSInsertion.ps1") + +$icv=@() +foreach ($kvp in $InsertedPkgs.GetEnumerator()) { + $kvp.Value |% { + if ($_.Name -match "^(.*?)\.(\d+\.\d+\.\d+(?:\.\d+)?(?:-.*?)?)(?:\.symbols)?\.nupkg$") { + $id = $Matches[1] + $version = $Matches[2] + $icv += "$id=$version" + } + } +} + +Write-Output ([string]::join(',',$icv)) From aa44aabb455656e0adf9d0e640fb6979e6277a2e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 27 Feb 2024 18:02:25 -0700 Subject: [PATCH 767/889] Preserve more apiscan logs --- azure-pipelines/apiscan.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/apiscan.yml b/azure-pipelines/apiscan.yml index 554df0eb..c3141d05 100644 --- a/azure-pipelines/apiscan.yml +++ b/azure-pipelines/apiscan.yml @@ -39,6 +39,7 @@ jobs: softwareVersionNum: $(NBGV_MajorMinorVersion) isLargeApp: false toolVersion: Latest + preserveLogsFolder: true env: AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) From 990c095107389e5cc9f88defec36b3c1cc67bea0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 29 Feb 2024 12:37:10 -0700 Subject: [PATCH 768/889] Add comment about multi-targeting projects --- azure-pipelines/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 237dd54d..27a4aed9 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -6,7 +6,7 @@ parameters: # Whether this repo uses OptProf to optimize the built binaries. # When enabling this, be sure to update these files: # - OptProf.targets: InstallationPath and match TestCase selection with what's in the VS repo. -# - The project file(s) for the libraries to optimize must import OptProf.targets. +# - The project file(s) for the libraries to optimize must import OptProf.targets (for multi-targeted projects, only import it for ONE target). # - OptProf.yml: Search for LibraryName (or your library's name) and verify that those names are appropriate. # - OptProf_part2.yml: Search for LibraryName (or your library's name) and verify that those names are appropriate. # and create pipelines for OptProf.yml, OptProf_part2.yml From 36a27d828388373b91d424b196ebda381f9ef2cf Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 4 Mar 2024 14:15:17 -0700 Subject: [PATCH 769/889] Stop filtering out win-arm64 binaries from APIScan --- azure-pipelines/artifacts/APIScanInputs.ps1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/artifacts/APIScanInputs.ps1 b/azure-pipelines/artifacts/APIScanInputs.ps1 index 15556413..b1550bfa 100644 --- a/azure-pipelines/artifacts/APIScanInputs.ps1 +++ b/azure-pipelines/artifacts/APIScanInputs.ps1 @@ -2,12 +2,10 @@ $inputs = & "$PSScriptRoot/symbols.ps1" if (!$inputs) { return } -# Filter out specific files that APIScan does not support. -# Specifically, APIScan doesn't support Windows ARM64 binaries, nor linux/OSX binaries. +# Filter out specific files that target OS's that are not subject to APIScan. +# Files that are subject but are not supported must be scanned and an SEL exception filed. $outputs = @{} $forbiddenSubPaths = @( - , 'arm64' - , 'win-arm64' , 'linux-*' , 'osx*' ) From 2a27d267d990d2a0a7078da1593de322bd051263 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 4 Mar 2024 14:54:06 -0700 Subject: [PATCH 770/889] Document use case for nuspec file --- azure-pipelines/InsertionMetadataPackage.nuspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/InsertionMetadataPackage.nuspec b/azure-pipelines/InsertionMetadataPackage.nuspec index f7aa3e3f..aae33f5c 100644 --- a/azure-pipelines/InsertionMetadataPackage.nuspec +++ b/azure-pipelines/InsertionMetadataPackage.nuspec @@ -1,5 +1,6 @@ - + + LibraryName.VSInsertionMetadata $version$ From 7220c37ffe0189b2e831bdb9fc7b99dd1f28b13d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 15 Mar 2024 11:56:27 -0600 Subject: [PATCH 771/889] Fix validation pipeline --- azure-pipelines/vs-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index 4d385796..ca2a7a68 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -41,7 +41,7 @@ extends: - template: /azure-pipelines/prepare-insertion-stages.yml@self parameters: ArchiveSymbols: false - RealSign: ${{ parameters.RealSign }} + RealSign: true - stage: insertion displayName: VS insertion From dd4956a1b8fecdd7570c49f1cbb5a77fce2d061b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 19 Mar 2024 10:15:18 -0600 Subject: [PATCH 772/889] Switch APIScan to use a managed identity --- azure-pipelines/apiscan.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/apiscan.yml b/azure-pipelines/apiscan.yml index c3141d05..73af5259 100644 --- a/azure-pipelines/apiscan.yml +++ b/azure-pipelines/apiscan.yml @@ -21,7 +21,7 @@ jobs: value: $[ dependencies.Windows.outputs['nbgv.NBGV_MajorMinorVersion'] ] - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: # https://dev.azure.com/devdiv/DevDiv/_wiki/wikis/DevDiv.wiki/25351/APIScan-step-by-step-guide-to-setting-up-a-Pipeline - - group: VSCloudServices-APIScan # Expected to provide ApiScanClientId, ApiScanSecret, ApiScanTenant + - group: VSEng sponsored APIScan # Expected to provide ApiScanClientId steps: # We need TSAOptions.json - checkout: self @@ -41,7 +41,7 @@ jobs: toolVersion: Latest preserveLogsFolder: true env: - AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret) + AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId) # File bugs when APIScan finds issues - task: TSAUpload@2 From e2bf1ceee715d4c2a4ee08e2079a8f0f9b17159b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 19 Mar 2024 12:09:32 -0600 Subject: [PATCH 773/889] Update PublishCodeCoverageResults task to v2 --- azure-pipelines/publish-codecoverage.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml index fbb6a39a..8ec94e64 100644 --- a/azure-pipelines/publish-codecoverage.yml +++ b/azure-pipelines/publish-codecoverage.yml @@ -17,9 +17,8 @@ steps: condition: and(succeeded(), ${{ parameters.includeMacOS }}) - powershell: azure-pipelines/Merge-CodeCoverage.ps1 -Path '$(Pipeline.Workspace)' -OutputFile coveragereport/merged.cobertura.xml -Format Cobertura -Verbose displayName: ⚙ Merge coverage -- task: PublishCodeCoverageResults@1 +- task: PublishCodeCoverageResults@2 displayName: 📢 Publish code coverage results to Azure DevOps inputs: - codeCoverageTool: cobertura summaryFileLocation: coveragereport/merged.cobertura.xml failIfCoverageEmpty: true From 3271c787c892c1c48264f584c0f3e7b9d602b576 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 16:04:38 +0000 Subject: [PATCH 774/889] Bump dotnet-coverage from 17.10.3 to 17.10.4 (#264) --- .config/dotnet-tools.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index dfd00e46..191eceac 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -9,7 +9,7 @@ ] }, "dotnet-coverage": { - "version": "17.10.3", + "version": "17.10.4", "commands": [ "dotnet-coverage" ] From 85dc18ca1748f2c61face07710a93343e6b6e8a0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 5 Apr 2024 17:23:00 -0600 Subject: [PATCH 775/889] Update symbol archival task --- azure-pipelines/prepare-insertion-stages.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index da163c76..ab4507c4 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -25,13 +25,12 @@ stages: - download: current artifact: symbols-legacy displayName: 🔻 Download symbols-legacy artifact - - task: MicroBuildArchiveSymbols@4 + - task: MicroBuildArchiveSymbols@5 displayName: 🔣 Archive symbols to Symweb inputs: SymbolsFeatureName: $(SymbolsFeatureName) SymbolsProject: VS SymbolsAgentPath: $(Pipeline.Workspace)/symbols-legacy - azureSubscription: Symbols Upload (DevDiv) - ${{ if false }}: # Switch to true to enable, but leave the condition to avoid merge conflicts later. - job: push From 27edc6c689a72b677dcc0cf9f596ce27f3d8b7a1 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 18 Apr 2024 05:54:42 -0600 Subject: [PATCH 776/889] Bump dependencies --- .config/dotnet-tools.json | 6 +++--- Directory.Packages.props | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 191eceac..7e8a502a 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,13 +3,13 @@ "isRoot": true, "tools": { "powershell": { - "version": "7.4.1", + "version": "7.4.2", "commands": [ "pwsh" ] }, "dotnet-coverage": { - "version": "17.10.4", + "version": "17.11.0", "commands": [ "dotnet-coverage" ] @@ -21,4 +21,4 @@ ] } } -} \ No newline at end of file +} diff --git a/Directory.Packages.props b/Directory.Packages.props index 60ffd922..525ae9c2 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -8,7 +8,7 @@ - + From dfd8a825c20653ce2e340699571add3f30d65a00 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 24 Apr 2024 11:30:10 -0600 Subject: [PATCH 777/889] Remove InsertConfigValues variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CoreXT is no more! 🎈🙌🏼🥳 --- azure-pipelines/OptProf.yml | 2 +- azure-pipelines/artifacts/VSInsertion.ps1 | 6 +++--- azure-pipelines/dotnet.yml | 2 +- azure-pipelines/variables/InsertConfigValues.ps1 | 14 -------------- azure-pipelines/variables/InsertPropsValues.ps1 | 16 ++++++++++++++-- azure-pipelines/vs-insertion.yml | 2 +- azure-pipelines/vs-validation.yml | 2 +- 7 files changed, 21 insertions(+), 23 deletions(-) delete mode 100644 azure-pipelines/variables/InsertConfigValues.ps1 diff --git a/azure-pipelines/OptProf.yml b/azure-pipelines/OptProf.yml index d95c84c8..059a435c 100644 --- a/azure-pipelines/OptProf.yml +++ b/azure-pipelines/OptProf.yml @@ -75,7 +75,7 @@ stages: targetType: filePath filePath: $(Agent.TempDirectory)/Variables-Windows/_pipelines.ps1 - task: NuGetCommand@2 - displayName: Push CoreXT packages to VS feed + displayName: Push VS-repo packages to VS feed inputs: command: push packagesToPush: $(Agent.TempDirectory)/VSInsertion-Windows/*.nupkg diff --git a/azure-pipelines/artifacts/VSInsertion.ps1 b/azure-pipelines/artifacts/VSInsertion.ps1 index 4757c9c2..4c528f52 100644 --- a/azure-pipelines/artifacts/VSInsertion.ps1 +++ b/azure-pipelines/artifacts/VSInsertion.ps1 @@ -28,7 +28,7 @@ $result = @{ } if ($env:IsOptProf) { - $CoreXTPackages = "$RepoRoot/bin/Packages/$BuildConfiguration/CoreXT" + $VSRepoPackages = "$RepoRoot/bin/Packages/$BuildConfiguration/VSRepo" $ArtifactBasePath = "$RepoRoot\obj\_artifacts" $ArtifactPath = "$ArtifactBasePath\VSInsertion" @@ -47,12 +47,12 @@ if ($env:IsOptProf) { # ultimately resulting in a failure of the optprof run. $InsertionMetadataVersion += '.' + $env:BUILD_BUILDID } - & (& "$PSScriptRoot\..\Get-NuGetTool.ps1") pack "$PSScriptRoot\..\InsertionMetadataPackage.nuspec" -OutputDirectory $CoreXTPackages -BasePath $ArtifactPath -Version $InsertionMetadataVersion | Out-Null + & (& "$PSScriptRoot\..\Get-NuGetTool.ps1") pack "$PSScriptRoot\..\InsertionMetadataPackage.nuspec" -OutputDirectory $VSRepoPackages -BasePath $ArtifactPath -Version $InsertionMetadataVersion | Out-Null if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - $result["$CoreXTPackages"] = (Get-ChildItem "$CoreXTPackages\LibraryName.VSInsertionMetadata.$InsertionMetadataVersion.nupkg"); + $result["$VSRepoPackages"] = (Get-ChildItem "$VSRepoPackages\LibraryName.VSInsertionMetadata.$InsertionMetadataVersion.nupkg"); } $result diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 3f4ac753..828bd7b9 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -17,7 +17,7 @@ steps: condition: and(succeeded(), ${{ parameters.RunTests }}) - ${{ if parameters.IsOptProf }}: - # We have to artifically run this script so that the extra .nupkg is produced for variables/InsertConfigValues.ps1 to notice. + # We have to artifically run this script so that the extra .nupkg is produced for variables/InsertPropsValues.ps1 to notice. - powershell: azure-pipelines\artifacts\VSInsertion.ps1 displayName: 🔧 Prepare VSInsertion artifact diff --git a/azure-pipelines/variables/InsertConfigValues.ps1 b/azure-pipelines/variables/InsertConfigValues.ps1 deleted file mode 100644 index 3ae11de9..00000000 --- a/azure-pipelines/variables/InsertConfigValues.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -$InsertedPkgs = (& "$PSScriptRoot\..\artifacts\VSInsertion.ps1") - -$icv=@() -foreach ($kvp in $InsertedPkgs.GetEnumerator()) { - $kvp.Value |% { - if ($_.Name -match "^(.*?)\.(\d+\.\d+\.\d+(?:\.\d+)?(?:-.*?)?)(?:\.symbols)?\.nupkg$") { - $id = $Matches[1] - $version = $Matches[2] - $icv += "$id=$version" - } - } -} - -Write-Output ([string]::join(',',$icv)) diff --git a/azure-pipelines/variables/InsertPropsValues.ps1 b/azure-pipelines/variables/InsertPropsValues.ps1 index 8d1e70a1..3ae11de9 100644 --- a/azure-pipelines/variables/InsertPropsValues.ps1 +++ b/azure-pipelines/variables/InsertPropsValues.ps1 @@ -1,2 +1,14 @@ -# These values are commonly the same. -& "$PSScriptRoot/InsertConfigValues.ps1" +$InsertedPkgs = (& "$PSScriptRoot\..\artifacts\VSInsertion.ps1") + +$icv=@() +foreach ($kvp in $InsertedPkgs.GetEnumerator()) { + $kvp.Value |% { + if ($_.Name -match "^(.*?)\.(\d+\.\d+\.\d+(?:\.\d+)?(?:-.*?)?)(?:\.symbols)?\.nupkg$") { + $id = $Matches[1] + $version = $Matches[2] + $icv += "$id=$version" + } + } +} + +Write-Output ([string]::join(',',$icv)) diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 8a6ffa0e..084b84eb 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -41,7 +41,7 @@ extends: artifact: VSInsertion-Windows displayName: 🔻 Download VSInsertion-Windows artifact - task: 1ES.PublishNuget@1 - displayName: 📦 Push CoreXT packages to VS feed + displayName: 📦 Push VS-repo packages to VS feed inputs: packagesToPush: '$(Pipeline.Workspace)/CI/VSInsertion-Windows/*.nupkg' packageParentPath: $(Pipeline.Workspace)/CI/VSInsertion-Windows diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index ca2a7a68..4638671c 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -62,7 +62,7 @@ extends: artifact: VSInsertion-Windows displayName: 🔻 Download VSInsertion-Windows artifact - task: 1ES.PublishNuget@1 - displayName: 📦 Push CoreXT packages to VS feed + displayName: 📦 Push VS-repo packages to VS feed inputs: packagesToPush: '$(Pipeline.Workspace)/VSInsertion-Windows/*.nupkg' packageParentPath: $(Pipeline.Workspace)/VSInsertion-Windows From ace939170b10ea63e17fe6c1b3325eb3f143a80a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 30 Apr 2024 06:55:08 -0600 Subject: [PATCH 778/889] Bump xunit to 2.8.0 --- Directory.Packages.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 525ae9c2..382835c3 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,8 +7,8 @@ - - + + From 6d31ebd6d6374e398f7184ea4e057ea3d52398d4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 30 Apr 2024 06:56:12 -0600 Subject: [PATCH 779/889] Bump MicroBuild to 2.0.152 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index b63cecc6..6be4e801 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true true - 2.0.149 + 2.0.152 From 37d34d1e225ad370a4ea2a0f187da6afb1c74337 Mon Sep 17 00:00:00 2001 From: Oscar Obeso Date: Tue, 30 Apr 2024 17:20:13 -0700 Subject: [PATCH 780/889] Always include API Scan Logs --- azure-pipelines/apiscan.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/apiscan.yml b/azure-pipelines/apiscan.yml index 73af5259..af78f15c 100644 --- a/azure-pipelines/apiscan.yml +++ b/azure-pipelines/apiscan.yml @@ -14,6 +14,7 @@ jobs: displayName: 📢 collect apiscan artifact targetPath: $(Pipeline.Workspace)/.gdn/.r/apiscan/001/Logs artifactName: apiscan-logs + condition: succeededOrFailed() variables: - name: SymbolsFeatureName value: $[ dependencies.Windows.outputs['SetPipelineVariables.SymbolsFeatureName'] ] From d6011ee2192e35411266d5bb1e9232a2e6d9987b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 9 May 2024 10:06:27 -0600 Subject: [PATCH 781/889] Add missing TeamName to source code archival pipeline --- azure-pipelines/archive-sourcecode.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines/archive-sourcecode.yml b/azure-pipelines/archive-sourcecode.yml index c550e2c2..12b4d0c9 100644 --- a/azure-pipelines/archive-sourcecode.yml +++ b/azure-pipelines/archive-sourcecode.yml @@ -30,6 +30,7 @@ parameters: variables: - group: VS Core team # Expected to provide ManagerAlias, SourceCodeArchivalUri +- template: GlobalVariables.yml extends: template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate From bc17102e910cd16192d5cec85c72ed8e2852f788 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 15 May 2024 15:13:40 -0600 Subject: [PATCH 782/889] Fix empty optimization inputs drops Skipping optimization in OptProf runs is useful to keep the OptProf pipeline running when no optimization input drops exist (perhaps because they expired, or it's the first run of the optprof pipeline). But skipping optimization breaks the optprof pipeline's LKG feature that reuses older data when a test failure occurs so that the new drop has at least *something* rather than being empty, which breaks the main build pipeline. Lately, empty optimization input drops have broken our pipelines several times. --- azure-pipelines/OptProf.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/azure-pipelines/OptProf.yml b/azure-pipelines/OptProf.yml index 059a435c..db2eead7 100644 --- a/azure-pipelines/OptProf.yml +++ b/azure-pipelines/OptProf.yml @@ -17,6 +17,12 @@ schedules: # name: DeploymentScripts # ref: refs/heads/test +parameters: + - name: ShouldSkipOptimize + displayName: Skip OptProf optimization + type: boolean + default: false # Should usually be false so that optprof LKG can apply when tests fail, but may need to be set to true in a manually queued pipeline run if all drops have expired. + variables: - template: GlobalVariables.yml - name: PublicRelease @@ -37,7 +43,7 @@ stages: RealSign: true windowsPool: VSEngSS-MicroBuild2022-1ES EnableMacOSBuild: false - ShouldSkipOptimize: true + ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} IsOptProf: true RunTests: false - stage: QueueVSBuild From 5cdabd6a84ce28b221dd14857a47d4e58c74681a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 19 May 2024 10:54:37 -0600 Subject: [PATCH 783/889] Use spaces for xml config files --- .editorconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/.editorconfig b/.editorconfig index ffae180a..91809344 100644 --- a/.editorconfig +++ b/.editorconfig @@ -26,6 +26,7 @@ indent_size = 2 # Xml config files [*.{ruleset,config,nuspec,resx,vsixmanifest,vsct,runsettings}] indent_size = 2 +indent_style = space # JSON files [*.json] From c9bb8a56ba2bfaaf1df3984938b80f426cf7cce0 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 20 May 2024 07:47:12 -0600 Subject: [PATCH 784/889] Better logging on source code archival failure --- azure-pipelines/Archive-SourceCode.ps1 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/Archive-SourceCode.ps1 b/azure-pipelines/Archive-SourceCode.ps1 index e44dad00..73f52abd 100644 --- a/azure-pipelines/Archive-SourceCode.ps1 +++ b/azure-pipelines/Archive-SourceCode.ps1 @@ -203,16 +203,25 @@ if ($PSCmdlet.ShouldProcess('source archival request', 'post')) { $Response = Invoke-WebRequest -Uri $SourceCodeArchivalUri -Method POST -Body $RequestJson -ContentType "application/json" -UseBasicParsing -SkipHttpErrorCheck Write-Host "Status Code : " -NoNewline - $responseContent = ConvertFrom-Json ($Response.Content) if ($Response.StatusCode -eq 200) { Write-Host $Response.StatusCode -ForegroundColor Green Write-Host "Ticket ID : " -NoNewline + $responseContent = ConvertFrom-Json ($Response.Content) Write-Host $responseContent } else { - $responseContent = ConvertFrom-Json $Response.Content Write-Host $Response.StatusCode -ForegroundColor Red - Write-Host "Message : $($responseContent.message)" + try { + $responseContent = ConvertFrom-Json $Response.Content + Write-Host "Message : $($responseContent.message)" + } + catch { + Write-Host "JSON Parse Error: $($_.Exception.Message)" + Write-Host "Raw response content:" + Write-Host $Response.Content + } + + exit 2 } } elseif ($SourceCodeArchivalUri) { Write-Host "Would have posted to $SourceCodeArchivalUri" From ca08c0f2dd8d034a52e7775ee1629efb5327575e Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 21 May 2024 14:45:12 -0600 Subject: [PATCH 785/889] Bump .NET SDK to 8.0.300 --- .devcontainer/Dockerfile | 2 +- global.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 34e56908..6ed7f6e7 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # Refer to https://hub.docker.com/_/microsoft-dotnet-sdk for available versions -FROM mcr.microsoft.com/dotnet/sdk:8.0.201-jammy +FROM mcr.microsoft.com/dotnet/sdk:8.0.300-jammy # Installing mono makes `dotnet test` work without errors even for net472. # But installing it takes a long time, so it's excluded by default. diff --git a/global.json b/global.json index 2565f236..c83e939e 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.201", + "version": "8.0.300", "rollForward": "patch", "allowPrerelease": false } From d87da7a0cd7722051fa125f2a33d857442c69b13 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 27 May 2024 12:17:47 -1000 Subject: [PATCH 786/889] Merge test related dependency updates (#271) * Bump xunit from 2.8.0 to 2.8.1 Bumps [xunit](https://github.com/xunit/xunit) from 2.8.0 to 2.8.1. - [Commits](https://github.com/xunit/xunit/compare/2.8.0...2.8.1) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump Microsoft.NET.Test.Sdk from 17.9.0 to 17.10.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.9.0 to 17.10.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.9.0...v17.10.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump xunit.runner.visualstudio from 2.8.0 to 2.8.1 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.8.0 to 2.8.1. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.8.0...2.8.1) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Directory.Packages.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 382835c3..20368168 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,9 +6,9 @@ true - - - + + + From e90be2e755eb204a173daa23e9316f99be1e1f79 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:15:23 -0600 Subject: [PATCH 787/889] Bump dotnet-coverage from 17.11.0 to 17.11.3 (#272) Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.11.0 to 17.11.3. - [Commits](https://github.com/microsoft/codecoverage/commits) --- updated-dependencies: - dependency-name: dotnet-coverage dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 7e8a502a..29710eea 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -9,7 +9,7 @@ ] }, "dotnet-coverage": { - "version": "17.11.0", + "version": "17.11.3", "commands": [ "dotnet-coverage" ] @@ -21,4 +21,4 @@ ] } } -} +} \ No newline at end of file From 48013f00edc27ded210565367038a64366706fdb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 4 Jun 2024 09:50:44 -0600 Subject: [PATCH 788/889] Bump Nerdbank.GitVersioning to 3.6.139 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 20368168..7571fff5 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -13,7 +13,7 @@ - + From 2415b1e21081903457430079e1ff548c4ff9d5a8 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 4 Jun 2024 11:10:20 -0600 Subject: [PATCH 789/889] Bump nbgv to 3.6.139 --- .config/dotnet-tools.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 29710eea..49ac8e66 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,10 +15,10 @@ ] }, "nbgv": { - "version": "3.6.133", + "version": "3.6.139", "commands": [ "nbgv" ] } } -} \ No newline at end of file +} From 61b98b5e7cfdeaaa170fcd037a38a6fbb7cba607 Mon Sep 17 00:00:00 2001 From: Pierson Lee Date: Wed, 5 Jun 2024 16:08:30 -0700 Subject: [PATCH 790/889] Enable ShallowClone for VSInsertion Enabling shallow cloning will make cloning the VS repo faster when creating the PR. --- azure-pipelines/vs-insertion.yml | 1 + azure-pipelines/vs-validation.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/azure-pipelines/vs-insertion.yml b/azure-pipelines/vs-insertion.yml index 084b84eb..bb734915 100644 --- a/azure-pipelines/vs-insertion.yml +++ b/azure-pipelines/vs-insertion.yml @@ -57,6 +57,7 @@ extends: InsertionReviewers: $(Build.RequestedFor) # Append `,Your team name` (without quotes) AutoCompletePR: true AutoCompleteMergeStrategy: Squash + ShallowClone: true - powershell: | $contentType = 'application/json'; $headers = @{ Authorization = 'Bearer $(System.AccessToken)' }; diff --git a/azure-pipelines/vs-validation.yml b/azure-pipelines/vs-validation.yml index 4638671c..e8497f81 100644 --- a/azure-pipelines/vs-validation.yml +++ b/azure-pipelines/vs-validation.yml @@ -80,6 +80,7 @@ extends: InsertionBuildPolicy: Request Perf DDRITs InsertionReviewers: $(Build.RequestedFor) AutoCompletePR: false + ShallowClone: true - powershell: | $insertionPRId = azure-pipelines/Get-InsertionPRId.ps1 $Markdown = @" From 51875f68f788603932a8f05d80a837ede3075002 Mon Sep 17 00:00:00 2001 From: Richard Stanton Date: Fri, 7 Jun 2024 19:46:00 -0700 Subject: [PATCH 791/889] Ensure Expand-Template uses UTF-8 when replacing placeholders. --- Expand-Template.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index da2f6b7e..9cbdee95 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -36,7 +36,7 @@ function Replace-Placeholders { $Path = Resolve-Path $Path Write-Host "Replacing tokens in `"$Path`"" - $content = Get-Content -Path $Path | Out-String + $content = Get-Content -Encoding UTF8 -Path $Path | Out-String $Replacements.GetEnumerator() |% { $modifiedContent = $content -replace $_.Key,$_.Value if ($modifiedContent -eq $content) { From 8028bf78bf4f96963e962e7f8e83662e9544be1f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 14 Jun 2024 10:45:03 -0600 Subject: [PATCH 792/889] Drop SourceLink package reference Per @KirillOsenkov in [this comment](https://github.com/dotnet/sdk/issues/36666#issuecomment-2162173453), SourceLink is now built into the .NET SDK. --- Directory.Packages.props | 3 --- 1 file changed, 3 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 7571fff5..1efd3c08 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -17,7 +17,4 @@ - - - From 6e225a8c19365540a58ace87d912c8287b2c9a82 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 14 Jun 2024 10:51:33 -0600 Subject: [PATCH 793/889] Remove WPF workarounds for bugs fixed years ago --- Directory.Build.props | 19 ------------------- Directory.Build.targets | 5 ----- 2 files changed, 24 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index e42ac60a..1c77d5d6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -55,23 +55,4 @@ $(PackageProjectUrl)/releases/tag/v$(Version) - - - false - true - - - - - false - false - false - false - diff --git a/Directory.Build.targets b/Directory.Build.targets index cc8184aa..b4afce0a 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,10 +1,5 @@ - - - false - - From 267e6f7bcf2b33e070ab4b8adae5c44b58d25e25 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 17 Jun 2024 12:27:42 -0600 Subject: [PATCH 794/889] Enable codeSignValidation and exclude non-shipping files --- azure-pipelines/official.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 98e21d22..98cebaab 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -64,6 +64,10 @@ extends: parameters: sdl: sourceAnalysisPool: VSEngSS-MicroBuild2022-1ES + codeSignValidation: + enabled: true + break: true + additionalTargetsGlobPattern: -|Variables-*\*.ps1;-|APIScanInputs-*\**;-|test_symbols-*\**;-|MicroBuild\** policheck: enabled: true exclusionsFile: $(System.DefaultWorkingDirectory)\azure-pipelines\PoliCheckExclusions.xml From d9450cf5301cbc7e7a9a0082c4eb56442e7ada80 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 17 Jun 2024 13:32:06 -0600 Subject: [PATCH 795/889] Consolidate official build and real sign switches Justification: - Official builds will soon be _required_ to sign everything. - Signing outside of an official build would allow bypassing all compliance checks, defeating the intent of all these checks. Therefore: signing must happen if and only if we are running an official build, and thus we should have only one switch that controls both. --- azure-pipelines/official.yml | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index 98cebaab..48cdc190 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -23,10 +23,10 @@ parameters: # As an entrypoint pipeline yml file, all parameters here show up in the Queue Run dialog. # If any paramaters should NOT be queue-time options, they should be removed from here # and references to them in this file replaced with hard-coded values. -- name: RealSign - displayName: Real sign? +- name: ForceOfficialBuild + displayName: Official build (sign, compliance, etc.) type: boolean - default: false + default: false # this should remain false so PR builds using this pipeline are unofficial # - name: ShouldSkipOptimize # Uncomment this and references to it below when setting EnableOptProf to true in build.yml. # displayName: Skip OptProf optimization # type: boolean @@ -39,12 +39,8 @@ parameters: displayName: Run tests type: boolean default: true -- name: EnableCompliance - displayName: Run Compliance Tools - type: boolean - default: true - name: EnableAPIScan - displayName: Include APIScan with Compliance tools + displayName: Include APIScan with compliance tools type: boolean default: false # enable in individual repos only AFTER updating TSAOptions.json with your own values @@ -59,7 +55,7 @@ variables: - template: GlobalVariables.yml extends: - ${{ if parameters.EnableCompliance }}: + ${{ if or(parameters.ForceOfficialBuild, eq(variables['Build.Reason'],'Schedule')) }}: template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate parameters: sdl: @@ -74,7 +70,7 @@ extends: suppression: suppressionFile: $(System.DefaultWorkingDirectory)\azure-pipelines\falsepositives.gdnsuppress sbom: - enabled: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} # Disable the generation for SBOMs for artifacts in unsigned builds since it's slow + enabled: true stages: - stage: Build variables: @@ -83,9 +79,9 @@ extends: - template: /azure-pipelines/build.yml@self parameters: Is1ESPT: true - RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} + RealSign: true # ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} - EnableAPIScan: ${{ and(parameters.EnableCompliance, parameters.EnableAPIScan, ne(variables['Build.Reason'], 'pullRequest')) }} + EnableAPIScan: ${{ and(parameters.EnableAPIScan, ne(variables['Build.Reason'], 'pullRequest')) }} windowsPool: VSEngSS-MicroBuild2022-1ES linuxPool: name: AzurePipelines-EO @@ -100,7 +96,7 @@ extends: RunTests: ${{ parameters.RunTests }} - template: /azure-pipelines/prepare-insertion-stages.yml@self parameters: - RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} + RealSign: true ${{ else }}: template: azure-pipelines/MicroBuild.1ES.Unofficial.yml@MicroBuildTemplate parameters: @@ -116,9 +112,9 @@ extends: - template: /azure-pipelines/build.yml@self parameters: Is1ESPT: true - RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} + RealSign: false # ShouldSkipOptimize: ${{ parameters.ShouldSkipOptimize }} - EnableAPIScan: ${{ and(parameters.EnableCompliance, parameters.EnableAPIScan, ne(variables['Build.Reason'], 'pullRequest')) }} + EnableAPIScan: false windowsPool: VSEngSS-MicroBuild2022-1ES linuxPool: name: AzurePipelines-EO @@ -133,4 +129,4 @@ extends: RunTests: ${{ parameters.RunTests }} - template: /azure-pipelines/prepare-insertion-stages.yml@self parameters: - RealSign: ${{ or(parameters.RealSign, eq(variables['Build.Reason'],'Schedule')) }} + RealSign: false From 16b4bc059c992fc89dff1921c08bf1cb27d3654f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 18 Jun 2024 10:59:18 -0600 Subject: [PATCH 796/889] Switch from PAT-based to WIF-based auth When pulling from or pushing packages to the `azure-public` account, we need to authenticate when doing so from the `devdiv` account. We were previously doing this through PAT-based service connections. With this change, we switch to WIF (Workload Identity Federation) to authenticate. --- azure-pipelines/WIFtoPATauth.yml | 22 ++++++++++++++++++++ azure-pipelines/install-dependencies.yml | 15 +++++++++---- azure-pipelines/prepare-insertion-stages.yml | 4 ++++ 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 azure-pipelines/WIFtoPATauth.yml diff --git a/azure-pipelines/WIFtoPATauth.yml b/azure-pipelines/WIFtoPATauth.yml new file mode 100644 index 00000000..cb78f61f --- /dev/null +++ b/azure-pipelines/WIFtoPATauth.yml @@ -0,0 +1,22 @@ +parameters: +- name: deadPATServiceConnectionId # The GUID of the PAT-based service connection whose access token must be replaced. + type: string +- name: wifServiceConnectionName # The name of the WIF service connection to use to get the access token. + type: string +- name: resource # The scope for which the access token is requested. + type: string + default: 499b84ac-1321-427f-aa17-267ca6975798 # Azure Artifact feeds (any of them) + +steps: +- task: AzureCLI@2 + displayName: 🔏 Authenticate with WIF service connection + inputs: + azureSubscription: ${{ parameters.wifServiceConnectionName }} + scriptType: pscore + scriptLocation: inlineScript + inlineScript: | + $accessToken = az account get-access-token --query accessToken --resource '${{ parameters.resource }}' -o tsv + # Set the access token as a secret, so it doesn't get leaked in the logs + Write-Host "##vso[task.setsecret]$accessToken" + # Override the apitoken of the nuget service connection, for the duration of this stage + Write-Host "##vso[task.setendpoint id=${{ parameters.deadPATServiceConnectionId }};field=authParameter;key=apitoken]$accessToken" diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index dc35cece..8e713521 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -1,14 +1,21 @@ parameters: - initArgs: +- name: initArgs +- name: needsAzurePublicFeeds + type: boolean + default: true # If nuget.config pulls from the azure-public account, we need to authenticate when building on the devdiv account. steps: +- ${{ if and(parameters.needsAzurePublicFeeds, eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9')) }}: + - template: WIFtoPATauth.yml + parameters: + wifServiceConnectionName: azure-public/vside package pull + deadPATServiceConnectionId: 0ae39abc-4d06-4436-a7b5-865833df49db # azure-public/msft_consumption - task: NuGetAuthenticate@1 displayName: 🔏 Authenticate NuGet feeds inputs: - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: - nuGetServiceConnections: azure-public/msft_consumption # Only necessary for GitHub-hosted repos - forceReinstallCredentialProvider: true + ${{ if and(parameters.needsAzurePublicFeeds, eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9')) }}: + nuGetServiceConnections: azure-public/msft_consumption - powershell: | $AccessToken = '$(System.AccessToken)' # Avoid specifying the access token directly on the init.ps1 command line to avoid it showing up in errors diff --git a/azure-pipelines/prepare-insertion-stages.yml b/azure-pipelines/prepare-insertion-stages.yml index ab4507c4..e6557bb5 100644 --- a/azure-pipelines/prepare-insertion-stages.yml +++ b/azure-pipelines/prepare-insertion-stages.yml @@ -61,3 +61,7 @@ stages: - download: current artifact: deployables-Windows displayName: 🔻 Download deployables-Windows artifact + - template: WIFtoPATauth.yml + parameters: + wifServiceConnectionName: azure-public/vside package push + deadPATServiceConnectionId: 207efd62-fd0f-43e7-aeae-17c4febcc660 # azure-public/vs-impl From 3efca79af59ecfc3125d34b8e770a1db1980a170 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 18 Jun 2024 15:43:42 -0600 Subject: [PATCH 797/889] Fix initArgs required parameter break --- azure-pipelines/install-dependencies.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml index 8e713521..e5d58f41 100644 --- a/azure-pipelines/install-dependencies.yml +++ b/azure-pipelines/install-dependencies.yml @@ -1,5 +1,7 @@ parameters: - name: initArgs + type: string + default: '' - name: needsAzurePublicFeeds type: boolean default: true # If nuget.config pulls from the azure-public account, we need to authenticate when building on the devdiv account. From db5c05423b18852f18b280f9e8d0c56da913c161 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 09:07:14 -0600 Subject: [PATCH 798/889] Bump powershell from 7.4.2 to 7.4.3 (#275) Bumps [powershell](https://github.com/PowerShell/PowerShell) from 7.4.2 to 7.4.3. - [Release notes](https://github.com/PowerShell/PowerShell/releases) - [Commits](https://github.com/PowerShell/PowerShell/compare/v7.4.2...v7.4.3) --- updated-dependencies: - dependency-name: powershell dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .config/dotnet-tools.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 49ac8e66..8d8ff3ff 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "powershell": { - "version": "7.4.2", + "version": "7.4.3", "commands": [ "pwsh" ] @@ -21,4 +21,4 @@ ] } } -} +} \ No newline at end of file From d1ea1326b8663d1ba6f1f4b3ebb35374b28f01f4 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 18 Jun 2024 14:35:57 -0600 Subject: [PATCH 799/889] Authenticate source code archival requests --- azure-pipelines/Archive-SourceCode.ps1 | 12 +++++++++--- azure-pipelines/archive-sourcecode.yml | 12 +++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/azure-pipelines/Archive-SourceCode.ps1 b/azure-pipelines/Archive-SourceCode.ps1 index 73f52abd..0360a14f 100644 --- a/azure-pipelines/Archive-SourceCode.ps1 +++ b/azure-pipelines/Archive-SourceCode.ps1 @@ -35,7 +35,7 @@ .PARAMETER SourceCodeArchivalUri The URI to POST the source code archival request to. This value will typically come automatically by a variable group associated with your pipeline. - You can also look it up at https://dpsrequestforms.azurewebsites.net/#/help -> SCA Request Help -> SCA API Help -> Description + You can also look it up at https://dpsopsrequestforms.azurewebsites.net/#/help -> SCA Request Help -> SCA API Help -> Description #> [CmdletBinding(SupportsShouldProcess = $true, PositionalBinding = $false)] param ( @@ -76,7 +76,9 @@ param ( [Parameter()] [string]$ServerPath = '', [Parameter()] - [Uri]$SourceCodeArchivalUri = $env:SOURCECODEARCHIVALURI + [Uri]$SourceCodeArchivalUri = $env:SOURCECODEARCHIVALURI, + [Parameter(Mandatory = $true)] + [string]$AccessToken ) function Invoke-Git() { @@ -199,9 +201,13 @@ if ($PSCmdlet.ShouldProcess('source archival request', 'post')) { exit 1 } + $headers = @{ + 'Authorization' = "Bearer $AccessToken" + } + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - $Response = Invoke-WebRequest -Uri $SourceCodeArchivalUri -Method POST -Body $RequestJson -ContentType "application/json" -UseBasicParsing -SkipHttpErrorCheck + $Response = Invoke-WebRequest -Uri $SourceCodeArchivalUri -Method POST -Headers $headers -Body $RequestJson -ContentType "application/json" -UseBasicParsing -SkipHttpErrorCheck Write-Host "Status Code : " -NoNewline if ($Response.StatusCode -eq 200) { Write-Host $Response.StatusCode -ForegroundColor Green diff --git a/azure-pipelines/archive-sourcecode.yml b/azure-pipelines/archive-sourcecode.yml index 12b4d0c9..f5b4781e 100644 --- a/azure-pipelines/archive-sourcecode.yml +++ b/azure-pipelines/archive-sourcecode.yml @@ -63,7 +63,16 @@ extends: - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true displayName: ⚙ Set pipeline variables based on source - - powershell: > + - task: AzureCLI@2 + displayName: 🔏 Authenticate with WIF service connection + inputs: + azureSubscription: VS Core Source Code Archival + scriptType: pscore + scriptLocation: inlineScript + inlineScript: | + $accessToken = az account get-access-token --query accessToken --resource api://177cf50a-4bf5-4481-8b7e-f32900dfc8e6 -o tsv + Write-Host "##vso[task.setvariable variable=scaToken;issecret=true]$accessToken" + - pwsh: > $TeamAlias = '$(TeamEmail)'.Substring(0, '$(TeamEmail)'.IndexOf('@')) azure-pipelines/Archive-SourceCode.ps1 @@ -73,6 +82,7 @@ extends: -ProductName '$(SymbolsFeatureName)' -ProductLanguage English -Notes '${{ parameters.notes }}' + -AccessToken '$(scaToken)' -Verbose -WhatIf:$${{ parameters.whatif }} displayName: 🗃️ Submit archival request From 054fc88e85945609e7b86bb4d9b646adbfbe00ac Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Thu, 27 Jun 2024 16:39:42 -0600 Subject: [PATCH 800/889] Check for signed binaries in a broader scoped path --- azure-pipelines/microbuild.after.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/microbuild.after.yml b/azure-pipelines/microbuild.after.yml index 34bdb452..67f43b2c 100644 --- a/azure-pipelines/microbuild.after.yml +++ b/azure-pipelines/microbuild.after.yml @@ -11,7 +11,7 @@ steps: displayName: 🔍 Verify Signed Files inputs: TargetFolders: | - $(Build.SourcesDirectory)/bin/Packages/$(BuildConfiguration)/NuGet + $(Build.SourcesDirectory)/bin/Packages/$(BuildConfiguration) condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - ${{ if parameters.IsOptProf }}: From ae01d878e7a8f9c0800618058a357b7001ece3af Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 28 Jun 2024 07:03:43 -0600 Subject: [PATCH 801/889] Ignore .sarif files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 69599b87..3f1c5ed9 100644 --- a/.gitignore +++ b/.gitignore @@ -352,3 +352,6 @@ MigrationBackup/ # mac-created file to track user view preferences for a directory .DS_Store + +# Analysis results +*.sarif From 19e67ad57a852efc0568cda683b5384bda824c07 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 28 Jun 2024 12:17:08 -0600 Subject: [PATCH 802/889] Add support for VB.NET projects --- Directory.Build.props | 1 - Directory.Build.targets | 4 ++++ src/AssemblyInfo.vb | 6 ++++++ src/Directory.Build.targets | 3 ++- 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 src/AssemblyInfo.vb diff --git a/Directory.Build.props b/Directory.Build.props index 1c77d5d6..803396d0 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -6,7 +6,6 @@ $(RepoRootPath)obj\$([MSBuild]::MakeRelative($(RepoRootPath), $(MSBuildProjectDirectory)))\ $(RepoRootPath)bin\$(MSBuildProjectName)\ $(RepoRootPath)bin\Packages\$(Configuration)\ - 12 enable enable latest diff --git a/Directory.Build.targets b/Directory.Build.targets index b4afce0a..ecd71a31 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,5 +1,9 @@ + + 12 + 16.9 + diff --git a/src/AssemblyInfo.vb b/src/AssemblyInfo.vb new file mode 100644 index 00000000..34b7cbe1 --- /dev/null +++ b/src/AssemblyInfo.vb @@ -0,0 +1,6 @@ +' Copyright (c) COMPANY-PLACEHOLDER. All rights reserved. +' Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Imports System.Runtime.InteropServices + + diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 07f41346..654f5c6d 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,7 +1,8 @@ - + + From ebb586f8bb4993a4f2b0e144b1347474cb0c52fb Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 28 Jun 2024 13:54:20 -0600 Subject: [PATCH 803/889] Fix template expansion --- Apply-Template.ps1 | 2 +- Expand-Template.ps1 | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Apply-Template.ps1 b/Apply-Template.ps1 index 42ed3362..921ceee5 100644 --- a/Apply-Template.ps1 +++ b/Apply-Template.ps1 @@ -37,6 +37,6 @@ robocopy /mir $PSScriptRoot/.github $Path/.github robocopy /mir $PSScriptRoot/.vscode $Path/.vscode robocopy /mir $PSScriptRoot/tools $Path/tools robocopy $PSScriptRoot $Path Directory.Build.* Directory.Packages.props global.json init.* azure-pipelines.yml .gitignore .gitattributes .editorconfig -robocopy $PSScriptRoot/src $Path/src Directory.Build.* .editorconfig AssemblyInfo.cs +robocopy $PSScriptRoot/src $Path/src Directory.Build.* .editorconfig AssemblyInfo.cs AssemblyInfo.vb robocopy $PSScriptRoot/test $Path/test Directory.Build.* .editorconfig Remove-Item $Path/azure-pipelines/expand-template.yml diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index d203d85f..e9a567c1 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -148,6 +148,9 @@ try { Replace-Placeholders -Path "src/AssemblyInfo.cs" -Replacements @{ 'COMPANY-PLACEHOLDER'=$Author } + Replace-Placeholders -Path "src/AssemblyInfo.vb" -Replacements @{ + 'COMPANY-PLACEHOLDER'=$Author + } Replace-Placeholders -Path "LICENSE" -Replacements @{ 'COMPANY-PLACEHOLDER'=$Author } From 7233fa3c5970df39bdd275f5c68da59ee8a0ae47 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 28 Jun 2024 13:56:21 -0600 Subject: [PATCH 804/889] Fix copyright notice --- src/AssemblyInfo.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AssemblyInfo.vb b/src/AssemblyInfo.vb index 34b7cbe1..75fe6ea4 100644 --- a/src/AssemblyInfo.vb +++ b/src/AssemblyInfo.vb @@ -1,4 +1,4 @@ -' Copyright (c) COMPANY-PLACEHOLDER. All rights reserved. +' Copyright (c) Microsoft Corporation. All rights reserved. ' Licensed under the MIT license. See LICENSE file in the project root for full license information. Imports System.Runtime.InteropServices From e69fef21e7bb686d2175c1f24995e7514a9ea21c Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 8 Jul 2024 15:13:27 -0600 Subject: [PATCH 805/889] Bump several dependencies --- Directory.Packages.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 1efd3c08..fe766e30 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,11 +7,11 @@ - - + + - + From ebd7dc1ea948f79a9af8a1de98c2971aee885637 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 8 Jul 2024 15:17:04 -0600 Subject: [PATCH 806/889] Bump MicroBuild to 2.0.162 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index a139a39a..2cafae62 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ true true - 2.0.152 + 2.0.162 From baf10f7ffd53dee5b61099c371022a15bd6070b5 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 10 Jul 2024 10:15:20 -0700 Subject: [PATCH 807/889] Fix github actions warnings --- .github/workflows/build.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 33502820..06d884d9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: - windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - name: ⚙ Install prerequisites @@ -56,53 +56,53 @@ jobs: if: always() - name: 📢 Upload project.assets.json files if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: projectAssetsJson-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/projectAssetsJson continue-on-error: true - name: 📢 Upload variables - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: variables-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/Variables continue-on-error: true - name: 📢 Upload build_logs if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: build_logs-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/build_logs continue-on-error: true - name: 📢 Upload test_logs if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: test_logs-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/test_logs continue-on-error: true - name: 📢 Upload testResults if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: testResults-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/testResults continue-on-error: true - name: 📢 Upload coverageResults if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: coverageResults-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/coverageResults continue-on-error: true - name: 📢 Upload symbols - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: symbols-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/symbols continue-on-error: true - name: 📢 Upload deployables - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4 with: name: deployables-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/deployables From f93bdce9c96216e096c5a02927c3176cd9b5699b Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 10 Jul 2024 10:19:19 -0700 Subject: [PATCH 808/889] Skip codecov publishing without token --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06d884d9..cdf4ac96 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,4 +112,4 @@ jobs: shell: pwsh timeout-minutes: 3 continue-on-error: true - if: always() + if: env.codecov_token != '' From 03d69cfcbb867ac82907ed10b52fddbf71398ec3 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Mon, 8 Jul 2024 17:53:47 -0600 Subject: [PATCH 809/889] Sign the `*.VSInsertionMetadata` optprof package --- Expand-Template.ps1 | 8 +-- .../InsertionMetadataPackage.nuspec | 17 ----- azure-pipelines/artifacts/VSInsertion.ps1 | 25 +------- azure-pipelines/dotnet.yml | 5 +- global.json | 3 + .../Library.VSInsertionMetadata.proj | 11 ++++ .../ProfilingInputs.props | 0 .../VSInsertionMetadata.targets | 64 +++++++++++++++++++ 8 files changed, 83 insertions(+), 50 deletions(-) delete mode 100644 azure-pipelines/InsertionMetadataPackage.nuspec create mode 100644 src/VSInsertionMetadata/Library.VSInsertionMetadata.proj rename {azure-pipelines => src/VSInsertionMetadata}/ProfilingInputs.props (100%) create mode 100644 src/VSInsertionMetadata/VSInsertionMetadata.targets diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 index 9cbdee95..f91ab76b 100755 --- a/Expand-Template.ps1 +++ b/Expand-Template.ps1 @@ -105,6 +105,8 @@ try { if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } git mv test/Library.Tests "test/$LibraryName.Tests" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + git mv src/VSInsertionMetadata/Library.VSInsertionMetadata.proj "src/VSInsertionMetadata/$LibraryName.VSInsertionMetadata.proj" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Refresh solution file both to update paths and give the projects unique GUIDs dotnet sln remove src/Library/Library.csproj @@ -168,12 +170,6 @@ try { 'LibraryName' = $LibraryName; } - Replace-Placeholders -Path "azure-pipelines/InsertionMetadataPackage.nuspec" -Replacements @{ - 'LibraryName' = $LibraryName; - } - Replace-Placeholders -Path "azure-pipelines/artifacts/VSInsertion.ps1" -Replacements @{ - 'LibraryName' = $LibraryName; - } Replace-Placeholders -Path "azure-pipelines/OptProf.yml" -Replacements @{ 'LibraryName' = $LibraryName; } diff --git a/azure-pipelines/InsertionMetadataPackage.nuspec b/azure-pipelines/InsertionMetadataPackage.nuspec deleted file mode 100644 index aae33f5c..00000000 --- a/azure-pipelines/InsertionMetadataPackage.nuspec +++ /dev/null @@ -1,17 +0,0 @@ - - - - - LibraryName.VSInsertionMetadata - $version$ - Microsoft - Microsoft - - false - Contains metadata for insertion into VS. - © Microsoft Corporation. All rights reserved. - - - - - diff --git a/azure-pipelines/artifacts/VSInsertion.ps1 b/azure-pipelines/artifacts/VSInsertion.ps1 index 4c528f52..de7899e6 100644 --- a/azure-pipelines/artifacts/VSInsertion.ps1 +++ b/azure-pipelines/artifacts/VSInsertion.ps1 @@ -29,30 +29,7 @@ $result = @{ if ($env:IsOptProf) { $VSRepoPackages = "$RepoRoot/bin/Packages/$BuildConfiguration/VSRepo" - - $ArtifactBasePath = "$RepoRoot\obj\_artifacts" - $ArtifactPath = "$ArtifactBasePath\VSInsertion" - if (-not (Test-Path $ArtifactPath)) { New-Item -ItemType Directory -Path $ArtifactPath | Out-Null } - - $profilingInputs = [xml](Get-Content -Path "$PSScriptRoot\..\ProfilingInputs.props") - $profilingInputs.Project.ItemGroup.TestStore.Include = "vstsdrop:" + (& "$PSScriptRoot\..\variables\ProfilingInputsDropName.ps1") - $profilingInputs.Save("$ArtifactPath\ProfilingInputs.props") - - $InsertionMetadataVersion = $(dotnet tool run nbgv get-version -p "$RepoRoot\src" -f json | ConvertFrom-Json).NuGetPackageVersion - if ($env:BUILD_BUILDID) { - # We must ensure unique versions for the insertion metadata package so - # it can contain information that is unique to this build. - # In particular it includes the ProfilingInputsDropName, which contains the BuildId. - # A non-unique package version here may collide with a prior run of this same commit, - # ultimately resulting in a failure of the optprof run. - $InsertionMetadataVersion += '.' + $env:BUILD_BUILDID - } - & (& "$PSScriptRoot\..\Get-NuGetTool.ps1") pack "$PSScriptRoot\..\InsertionMetadataPackage.nuspec" -OutputDirectory $VSRepoPackages -BasePath $ArtifactPath -Version $InsertionMetadataVersion | Out-Null - if ($LASTEXITCODE -ne 0) { - exit $LASTEXITCODE - } - - $result["$VSRepoPackages"] = (Get-ChildItem "$VSRepoPackages\LibraryName.VSInsertionMetadata.$InsertionMetadataVersion.nupkg"); + $result["$VSRepoPackages"] = (Get-ChildItem "$VSRepoPackages\*.VSInsertionMetadata.*.nupkg"); } $result diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 828bd7b9..196fd4b5 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -17,9 +17,8 @@ steps: condition: and(succeeded(), ${{ parameters.RunTests }}) - ${{ if parameters.IsOptProf }}: - # We have to artifically run this script so that the extra .nupkg is produced for variables/InsertPropsValues.ps1 to notice. - - powershell: azure-pipelines\artifacts\VSInsertion.ps1 - displayName: 🔧 Prepare VSInsertion artifact + - script: dotnet pack src\VSInsertionMetadata -c $(BuildConfiguration) -warnaserror /bl:"$(Build.ArtifactStagingDirectory)/build_logs/VSInsertion-Pack.binlog" + displayName: 🔧 dotnet pack VSInsertionMetadata - powershell: azure-pipelines/variables/_pipelines.ps1 failOnStderr: true diff --git a/global.json b/global.json index c83e939e..e32504ca 100644 --- a/global.json +++ b/global.json @@ -3,5 +3,8 @@ "version": "8.0.300", "rollForward": "patch", "allowPrerelease": false + }, + "msbuild-sdks": { + "Microsoft.Build.NoTargets": "3.7.56" } } diff --git a/src/VSInsertionMetadata/Library.VSInsertionMetadata.proj b/src/VSInsertionMetadata/Library.VSInsertionMetadata.proj new file mode 100644 index 00000000..0caaedb9 --- /dev/null +++ b/src/VSInsertionMetadata/Library.VSInsertionMetadata.proj @@ -0,0 +1,11 @@ + + + netstandard2.0 + true + $(RepoRootPath)bin\Packages\$(Configuration)\VSRepo\ + false + false + Contains metadata for insertion into VS. + + + diff --git a/azure-pipelines/ProfilingInputs.props b/src/VSInsertionMetadata/ProfilingInputs.props similarity index 100% rename from azure-pipelines/ProfilingInputs.props rename to src/VSInsertionMetadata/ProfilingInputs.props diff --git a/src/VSInsertionMetadata/VSInsertionMetadata.targets b/src/VSInsertionMetadata/VSInsertionMetadata.targets new file mode 100644 index 00000000..b73e09aa --- /dev/null +++ b/src/VSInsertionMetadata/VSInsertionMetadata.targets @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + $(TargetsForTfmSpecificContentInPackage); + SubstituteProfilingInputsMacro; + SubstituteProfilingInputsMacroWarning; + + + + + + + + + + + + + + + + + + + + $(PackageVersion).$(Build_BuildId) + + + From 0c9771db3042989a06645b5c8f1af9c1d155b32a Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Fri, 12 Jul 2024 10:20:19 -0600 Subject: [PATCH 810/889] Break until the insertion project is renamed --- .../VSInsertionMetadata.targets | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/VSInsertionMetadata/VSInsertionMetadata.targets b/src/VSInsertionMetadata/VSInsertionMetadata.targets index b73e09aa..9b23536c 100644 --- a/src/VSInsertionMetadata/VSInsertionMetadata.targets +++ b/src/VSInsertionMetadata/VSInsertionMetadata.targets @@ -25,14 +25,10 @@ $(TargetsForTfmSpecificContentInPackage); SubstituteProfilingInputsMacro; - SubstituteProfilingInputsMacroWarning; - - - - + @@ -43,13 +39,20 @@ OutputFilename="@(ProfilingInputsTarget)" MatchExpression="%TESTSTORE%" ReplacementText="vstsdrop:$(ProfilingInputsDropName)" /> + + + + + Condition="'$(Build_BuildId)' != ''" + AfterTargets="GetBuildVersion"> + true + + + + false + + + $(MSBuildThisFileDirectory) + + + embedded + + true + $(MSBuildThisFileDirectory)strongname.snk + + + COMPANY-PLACEHOLDER + COMPANY-PLACEHOLDER + © COMPANY-PLACEHOLDER. All rights reserved. + MIT + true + true + true + snupkg + + + + + + + + + + + + + + $(RepositoryUrl)/releases/tag/v$(Version) + + + diff --git a/Directory.Build.rsp b/Directory.Build.rsp new file mode 100644 index 00000000..9a833a03 --- /dev/null +++ b/Directory.Build.rsp @@ -0,0 +1,16 @@ +#------------------------------------------------------------------------------ +# This file contains command-line options that MSBuild will process as part of +# every build, unless the "/noautoresponse" switch is specified. +# +# MSBuild processes the options in this file first, before processing the +# options on the command line. As a result, options on the command line can +# override the options in this file. However, depending on the options being +# set, the overriding can also result in conflicts. +# +# NOTE: The "/noautoresponse" switch cannot be specified in this file, nor in +# any response file that is referenced by this file. +#------------------------------------------------------------------------------ +/nr:false +/m +/verbosity:minimal +/clp:Summary;ForceNoAlign diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 00000000..ecd71a31 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,11 @@ + + + + 12 + 16.9 + + + + + + diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 00000000..4baf6ece --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,20 @@ + + + + + true + true + + + + + + + + + + + + + + diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..9867b3db --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,36 @@ +trigger: + batch: true + branches: + include: + - main + - 'validate/*' + paths: + exclude: + - doc/ + - '*.md' + - .vscode/ + - .github/ + - azure-pipelines/release.yml + +parameters: +- name: includeMacOS + displayName: Build on macOS + type: boolean + default: false # macOS is often bogged down in Azure Pipelines +- name: RunTests + displayName: Run tests + type: boolean + default: true + +variables: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + BuildConfiguration: Release + codecov_token: 4dc9e7e2-6b01-4932-a180-847b52b43d35 # Get a new one from https://codecov.io/ + ci_feed: https://pkgs.dev.azure.com/andrewarnott/_packaging/CI/nuget/v3/index.json # Azure Artifacts feed URL + NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages/ + +jobs: +- template: azure-pipelines/build.yml + parameters: + includeMacOS: ${{ parameters.includeMacOS }} + RunTests: ${{ parameters.RunTests }} diff --git a/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 b/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 new file mode 100644 index 00000000..391e5713 --- /dev/null +++ b/azure-pipelines/Get-ArtifactsStagingDirectory.ps1 @@ -0,0 +1,15 @@ +Param( + [switch]$CleanIfLocal +) +if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { + $ArtifactStagingFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY +} elseif ($env:RUNNER_TEMP) { + $ArtifactStagingFolder = "$env:RUNNER_TEMP\_artifacts" +} else { + $ArtifactStagingFolder = [System.IO.Path]::GetFullPath("$PSScriptRoot/../obj/_artifacts") + if ($CleanIfLocal -and (Test-Path $ArtifactStagingFolder)) { + Remove-Item $ArtifactStagingFolder -Recurse -Force + } +} + +$ArtifactStagingFolder diff --git a/azure-pipelines/Get-CodeCovTool.ps1 b/azure-pipelines/Get-CodeCovTool.ps1 new file mode 100644 index 00000000..ca580b4d --- /dev/null +++ b/azure-pipelines/Get-CodeCovTool.ps1 @@ -0,0 +1,86 @@ +<# +.SYNOPSIS + Downloads the CodeCov.io uploader tool and returns the path to it. +.PARAMETER AllowSkipVerify + Allows skipping signature verification of the downloaded tool if gpg is not installed. +#> +[CmdletBinding()] +Param( + [switch]$AllowSkipVerify +) + +if ($IsMacOS) { + $codeCovUrl = "https://uploader.codecov.io/latest/macos/codecov" + $toolName = 'codecov' +} +elseif ($IsLinux) { + $codeCovUrl = "https://uploader.codecov.io/latest/linux/codecov" + $toolName = 'codecov' +} +else { + $codeCovUrl = "https://uploader.codecov.io/latest/windows/codecov.exe" + $toolName = 'codecov.exe' +} + +$shaSuffix = ".SHA256SUM" +$sigSuffix = $shaSuffix + ".sig" + +Function Get-FileFromWeb([Uri]$Uri, $OutDir) { + $OutFile = Join-Path $OutDir $Uri.Segments[-1] + if (!(Test-Path $OutFile)) { + Write-Verbose "Downloading $Uri..." + if (!(Test-Path $OutDir)) { New-Item -ItemType Directory -Path $OutDir | Out-Null } + try { + (New-Object System.Net.WebClient).DownloadFile($Uri, $OutFile) + } finally { + # This try/finally causes the script to abort + } + } + + $OutFile +} + +$toolsPath = & "$PSScriptRoot\Get-TempToolsPath.ps1" +$binaryToolsPath = Join-Path $toolsPath codecov +$testingPath = Join-Path $binaryToolsPath unverified +$finalToolPath = Join-Path $binaryToolsPath $toolName + +if (!(Test-Path $finalToolPath)) { + if (Test-Path $testingPath) { + Remove-Item -Recurse -Force $testingPath # ensure we download all matching files + } + $tool = Get-FileFromWeb $codeCovUrl $testingPath + $sha = Get-FileFromWeb "$codeCovUrl$shaSuffix" $testingPath + $sig = Get-FileFromWeb "$codeCovUrl$sigSuffix" $testingPath + $key = Get-FileFromWeb https://keybase.io/codecovsecurity/pgp_keys.asc $testingPath + + if ((Get-Command gpg -ErrorAction SilentlyContinue)) { + Write-Host "Importing codecov key" -ForegroundColor Yellow + gpg --import $key + Write-Host "Verifying signature on codecov hash" -ForegroundColor Yellow + gpg --verify $sig $sha + } else { + if ($AllowSkipVerify) { + Write-Warning "gpg not found. Unable to verify hash signature." + } else { + throw "gpg not found. Unable to verify hash signature. Install gpg or add -AllowSkipVerify to override." + } + } + + Write-Host "Verifying hash on downloaded tool" -ForegroundColor Yellow + $actualHash = (Get-FileHash -Path $tool -Algorithm SHA256).Hash + $expectedHash = (Get-Content $sha).Split()[0] + if ($actualHash -ne $expectedHash) { + # Validation failed. Delete the tool so we can't execute it. + #Remove-Item $codeCovPath + throw "codecov uploader tool failed signature validation." + } + + Copy-Item $tool $finalToolPath + + if ($IsMacOS -or $IsLinux) { + chmod u+x $finalToolPath + } +} + +return $finalToolPath diff --git a/azure-pipelines/Get-LibTemplateBasis.ps1 b/azure-pipelines/Get-LibTemplateBasis.ps1 new file mode 100644 index 00000000..2181c77b --- /dev/null +++ b/azure-pipelines/Get-LibTemplateBasis.ps1 @@ -0,0 +1,25 @@ +<# +.SYNOPSIS + Returns the name of the well-known branch in the Library.Template repository upon which HEAD is based. +#> +[CmdletBinding(SupportsShouldProcess = $true)] +Param( + [switch]$ErrorIfNotRelated +) + +# This list should be sorted in order of decreasing specificity. +$branchMarkers = @( + @{ commit = 'fd0a7b25ccf030bbd16880cca6efe009d5b1fffc'; branch = 'microbuild' }; + @{ commit = '05f49ce799c1f9cc696d53eea89699d80f59f833'; branch = 'main' }; +) + +foreach ($entry in $branchMarkers) { + if (git rev-list HEAD | Select-String -Pattern $entry.commit) { + return $entry.branch + } +} + +if ($ErrorIfNotRelated) { + Write-Error "Library.Template has not been previously merged with this repo. Please review https://github.com/AArnott/Library.Template/tree/main?tab=readme-ov-file#readme for instructions." + exit 1 +} diff --git a/azure-pipelines/Get-NuGetTool.ps1 b/azure-pipelines/Get-NuGetTool.ps1 new file mode 100644 index 00000000..3097c873 --- /dev/null +++ b/azure-pipelines/Get-NuGetTool.ps1 @@ -0,0 +1,22 @@ +<# +.SYNOPSIS + Downloads the NuGet.exe tool and returns the path to it. +.PARAMETER NuGetVersion + The version of the NuGet tool to acquire. +#> +Param( + [Parameter()] + [string]$NuGetVersion='6.4.0' +) + +$toolsPath = & "$PSScriptRoot\Get-TempToolsPath.ps1" +$binaryToolsPath = Join-Path $toolsPath $NuGetVersion +if (!(Test-Path $binaryToolsPath)) { $null = mkdir $binaryToolsPath } +$nugetPath = Join-Path $binaryToolsPath nuget.exe + +if (!(Test-Path $nugetPath)) { + Write-Host "Downloading nuget.exe $NuGetVersion..." -ForegroundColor Yellow + (New-Object System.Net.WebClient).DownloadFile("https://dist.nuget.org/win-x86-commandline/v$NuGetVersion/NuGet.exe", $nugetPath) +} + +return (Resolve-Path $nugetPath).Path diff --git a/azure-pipelines/Get-ProcDump.ps1 b/azure-pipelines/Get-ProcDump.ps1 new file mode 100644 index 00000000..1493fe4b --- /dev/null +++ b/azure-pipelines/Get-ProcDump.ps1 @@ -0,0 +1,14 @@ +<# +.SYNOPSIS +Downloads 32-bit and 64-bit procdump executables and returns the path to where they were installed. +#> +$version = '0.0.1' +$baseDir = "$PSScriptRoot\..\obj\tools" +$procDumpToolPath = "$baseDir\procdump.$version\bin" +if (-not (Test-Path $procDumpToolPath)) { + if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null } + $baseDir = (Resolve-Path $baseDir).Path # Normalize it + & (& $PSScriptRoot\Get-NuGetTool.ps1) install procdump -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://api.nuget.org/v3/index.json | Out-Null +} + +(Resolve-Path $procDumpToolPath).Path diff --git a/azure-pipelines/Get-SymbolFiles.ps1 b/azure-pipelines/Get-SymbolFiles.ps1 new file mode 100644 index 00000000..b5063cec --- /dev/null +++ b/azure-pipelines/Get-SymbolFiles.ps1 @@ -0,0 +1,66 @@ +<# +.SYNOPSIS + Collect the list of PDBs built in this repo. +.PARAMETER Path + The directory to recursively search for PDBs. +.PARAMETER Tests + A switch indicating to find PDBs only for test binaries instead of only for shipping shipping binaries. +#> +[CmdletBinding()] +param ( + [parameter(Mandatory=$true)] + [string]$Path, + [switch]$Tests +) + +$ActivityName = "Collecting symbols from $Path" +Write-Progress -Activity $ActivityName -CurrentOperation "Discovery PDB files" +$PDBs = Get-ChildItem -rec "$Path/*.pdb" + +# Filter PDBs to product OR test related. +$testregex = "unittest|tests|\.test\." + +Write-Progress -Activity $ActivityName -CurrentOperation "De-duplicating symbols" +$PDBsByHash = @{} +$i = 0 +$PDBs |% { + Write-Progress -Activity $ActivityName -CurrentOperation "De-duplicating symbols" -PercentComplete (100 * $i / $PDBs.Length) + $hash = Get-FileHash $_ + $i++ + Add-Member -InputObject $_ -MemberType NoteProperty -Name Hash -Value $hash.Hash + Write-Output $_ +} | Sort-Object CreationTime |% { + # De-dupe based on hash. Prefer the first match so we take the first built copy. + if (-not $PDBsByHash.ContainsKey($_.Hash)) { + $PDBsByHash.Add($_.Hash, $_.FullName) + Write-Output $_ + } +} |? { + if ($Tests) { + $_.FullName -match $testregex + } else { + $_.FullName -notmatch $testregex + } +} |% { + # Collect the DLLs/EXEs as well. + $rootName = "$($_.Directory)/$($_.BaseName)" + if ($rootName.EndsWith('.ni')) { + $rootName = $rootName.Substring(0, $rootName.Length - 3) + } + + $dllPath = "$rootName.dll" + $exePath = "$rootName.exe" + if (Test-Path $dllPath) { + $BinaryImagePath = $dllPath + } elseif (Test-Path $exePath) { + $BinaryImagePath = $exePath + } else { + Write-Warning "`"$_`" found with no matching binary file." + $BinaryImagePath = $null + } + + if ($BinaryImagePath) { + Write-Output $BinaryImagePath + Write-Output $_.FullName + } +} diff --git a/azure-pipelines/Get-TempToolsPath.ps1 b/azure-pipelines/Get-TempToolsPath.ps1 new file mode 100644 index 00000000..bb3da8e3 --- /dev/null +++ b/azure-pipelines/Get-TempToolsPath.ps1 @@ -0,0 +1,13 @@ +if ($env:AGENT_TEMPDIRECTORY) { + $path = "$env:AGENT_TEMPDIRECTORY\$env:BUILD_BUILDID" +} elseif ($env:localappdata) { + $path = "$env:localappdata\gitrepos\tools" +} else { + $path = "$PSScriptRoot\..\obj\tools" +} + +if (!(Test-Path $path)) { + New-Item -ItemType Directory -Path $Path | Out-Null +} + +(Resolve-Path $path).Path diff --git a/azure-pipelines/Merge-CodeCoverage.ps1 b/azure-pipelines/Merge-CodeCoverage.ps1 new file mode 100644 index 00000000..5ecabbc9 --- /dev/null +++ b/azure-pipelines/Merge-CodeCoverage.ps1 @@ -0,0 +1,51 @@ +#!/usr/bin/env pwsh + +<# +.SYNOPSIS + Merges code coverage reports. +.PARAMETER Path + The path(s) to search for Cobertura code coverage reports. +.PARAMETER Format + The format for the merged result. The default is Cobertura +.PARAMETER OutputDir + The directory the merged result will be written to. The default is `coveragereport` in the root of this repo. +#> +[CmdletBinding()] +Param( + [Parameter(Mandatory=$true)] + [string[]]$Path, + [ValidateSet('Badges', 'Clover', 'Cobertura', 'CsvSummary', 'Html', 'Html_Dark', 'Html_Light', 'HtmlChart', 'HtmlInline', 'HtmlInline_AzurePipelines', 'HtmlInline_AzurePipelines_Dark', 'HtmlInline_AzurePipelines_Light', 'HtmlSummary', 'JsonSummary', 'Latex', 'LatexSummary', 'lcov', 'MarkdownSummary', 'MHtml', 'PngChart', 'SonarQube', 'TeamCitySummary', 'TextSummary', 'Xml', 'XmlSummary')] + [string]$Format='Cobertura', + [string]$OutputFile=("$PSScriptRoot/../coveragereport/merged.cobertura.xml") +) + +$RepoRoot = [string](Resolve-Path $PSScriptRoot/..) +Push-Location $RepoRoot +try { + Write-Verbose "Searching $Path for *.cobertura.xml files" + $reports = Get-ChildItem -Recurse $Path -Filter *.cobertura.xml + + if ($reports) { + $reports |% { $_.FullName } |% { + # In addition to replacing {reporoot}, we also normalize on one kind of slash so that the report aggregates data for a file whether data was collected on Windows or not. + $xml = [xml](Get-Content -Path $_) + $xml.coverage.packages.package.classes.class |? { $_.filename} |% { + $_.filename = $_.filename.Replace('{reporoot}', $RepoRoot).Replace([IO.Path]::AltDirectorySeparatorChar, [IO.Path]::DirectorySeparatorChar) + } + + $xml.Save($_) + } + + $Inputs = $reports |% { Resolve-Path -relative $_.FullName } + + if ((Split-Path $OutputFile) -and -not (Test-Path (Split-Path $OutputFile))) { + New-Item -Type Directory -Path (Split-Path $OutputFile) | Out-Null + } + + & dotnet tool run dotnet-coverage merge $Inputs -o $OutputFile -f cobertura + } else { + Write-Error "No reports found to merge." + } +} finally { + Pop-Location +} diff --git a/azure-pipelines/TSAOptions.json b/azure-pipelines/TSAOptions.json deleted file mode 100644 index d30a5edf..00000000 --- a/azure-pipelines/TSAOptions.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "tsaVersion": "TsaV2", - "codebase": "NewOrUpdate", - "codebaseName": "SlowCheetah", - "tsaStamp": "DevDiv", - "tsaEnvironment": "PROD", - "notificationAliases": [ - "vsslnx@microsoft.com" - ], - "instanceUrl": "https://devdiv.visualstudio.com", - "projectName": "DevDiv", - "areaPath": "DevDiv\\VS Core\\Project\\SlowCheetah", - "iterationPath": "DevDiv", - "tools": [ - "APIScan", - "CodeQL" - ], - "repositoryName": "SlowCheetah" -} \ No newline at end of file diff --git a/azure-pipelines/artifacts/Variables.ps1 b/azure-pipelines/artifacts/Variables.ps1 new file mode 100644 index 00000000..4bc6d216 --- /dev/null +++ b/azure-pipelines/artifacts/Variables.ps1 @@ -0,0 +1,43 @@ +# This artifact captures all variables defined in the ..\variables folder. +# It "snaps" the values of these variables where we can compute them during the build, +# and otherwise captures the scripts to run later during an Azure Pipelines environment release. + +$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot/../..") +$ArtifactBasePath = "$RepoRoot/obj/_artifacts" +$VariablesArtifactPath = Join-Path $ArtifactBasePath variables +if (-not (Test-Path $VariablesArtifactPath)) { New-Item -ItemType Directory -Path $VariablesArtifactPath | Out-Null } + +# Copy variables, either by value if the value is calculable now, or by script +Get-ChildItem "$PSScriptRoot/../variables" |% { + $value = $null + if (-not $_.BaseName.StartsWith('_')) { # Skip trying to interpret special scripts + # First check the environment variables in case the variable was set in a queued build + # Always use all caps for env var access because Azure Pipelines converts variables to upper-case for env vars, + # and on non-Windows env vars are case sensitive. + $envVarName = $_.BaseName.ToUpper() + if (Test-Path env:$envVarName) { + $value = Get-Content "env:$envVarName" + } + + # If that didn't give us anything, try executing the script right now from its original position + if (-not $value) { + $value = & $_.FullName + } + + if ($value) { + # We got something, so wrap it with quotes so it's treated like a literal value. + $value = "'$value'" + } + } + + # If that didn't get us anything, just copy the script itself + if (-not $value) { + $value = Get-Content -Path $_.FullName + } + + Set-Content -Path "$VariablesArtifactPath/$($_.Name)" -Value $value +} + +@{ + "$VariablesArtifactPath" = (Get-ChildItem $VariablesArtifactPath -Recurse); +} diff --git a/azure-pipelines/artifacts/_all.ps1 b/azure-pipelines/artifacts/_all.ps1 new file mode 100644 index 00000000..9a22a1d0 --- /dev/null +++ b/azure-pipelines/artifacts/_all.ps1 @@ -0,0 +1,72 @@ +#!/usr/bin/env pwsh + +<# +.SYNOPSIS + This script returns all the artifacts that should be collected after a build. + Each powershell artifact is expressed as an object with these properties: + Source - the full path to the source file + ArtifactName - the name of the artifact to upload to + ContainerFolder - the relative path within the artifact in which the file should appear + Each artifact aggregating .ps1 script should return a hashtable: + Key = path to the directory from which relative paths within the artifact should be calculated + Value = an array of paths (absolute or relative to the BaseDirectory) to files to include in the artifact. + FileInfo objects are also allowed. +.PARAMETER Force + Executes artifact scripts even if they have already been staged. +#> + +[CmdletBinding(SupportsShouldProcess = $true)] +param ( + [string]$ArtifactNameSuffix, + [switch]$Force +) + +Function EnsureTrailingSlash($path) { + if ($path.length -gt 0 -and !$path.EndsWith('\') -and !$path.EndsWith('/')) { + $path = $path + [IO.Path]::DirectorySeparatorChar + } + + $path.Replace('\', [IO.Path]::DirectorySeparatorChar) +} + +Function Test-ArtifactStaged($artifactName) { + $varName = "ARTIFACTSTAGED_$($artifactName.ToUpper())" + Test-Path "env:$varName" +} + +Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse | % { + $ArtifactName = $_.BaseName + if ($Force -or !(Test-ArtifactStaged($ArtifactName + $ArtifactNameSuffix))) { + $totalFileCount = 0 + Write-Verbose "Collecting file list for artifact $($_.BaseName)" + $fileGroups = & $_ + if ($fileGroups) { + $fileGroups.GetEnumerator() | % { + $BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key.ToString()), [UriKind]::Absolute) + $_.Value | ? { $_ } | % { + if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) { + $_ = $_.FullName + } + + $artifact = New-Object -TypeName PSObject + Add-Member -InputObject $artifact -MemberType NoteProperty -Name ArtifactName -Value $ArtifactName + + $SourceFullPath = New-Object Uri ($BaseDirectory, $_) + Add-Member -InputObject $artifact -MemberType NoteProperty -Name Source -Value $SourceFullPath.LocalPath + + $RelativePath = [Uri]::UnescapeDataString($BaseDirectory.MakeRelative($SourceFullPath)) + Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath) + + Write-Output $artifact + $totalFileCount += 1 + } + } + } + + if ($totalFileCount -eq 0) { + Write-Warning "No files found for the `"$ArtifactName`" artifact." + } + } else { + Write-Host "Skipping $ArtifactName because it has already been staged." -ForegroundColor DarkGray + } +} diff --git a/azure-pipelines/artifacts/_pipelines.ps1 b/azure-pipelines/artifacts/_pipelines.ps1 new file mode 100644 index 00000000..47321ed5 --- /dev/null +++ b/azure-pipelines/artifacts/_pipelines.ps1 @@ -0,0 +1,45 @@ +<# +.SYNOPSIS + This script translates all the artifacts described by _all.ps1 + into commands that instruct Azure Pipelines to actually collect those artifacts. +#> + +[CmdletBinding()] +param ( + [string]$ArtifactNameSuffix, + [switch]$StageOnly, + [switch]$AvoidSymbolicLinks +) + +Function Set-PipelineVariable($name, $value) { + if ((Test-Path "Env:\$name") -and (Get-Item "Env:\$name").Value -eq $value) { + return # already set + } + + #New-Item -Path "Env:\$name".ToUpper() -Value $value -Force | Out-Null + Write-Host "##vso[task.setvariable variable=$name]$value" +} + +Function Test-ArtifactUploaded($artifactName) { + $varName = "ARTIFACTUPLOADED_$($artifactName.ToUpper())" + Test-Path "env:$varName" +} + +& "$PSScriptRoot/_stage_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix -AvoidSymbolicLinks:$AvoidSymbolicLinks |% { + # Set a variable which will out-live this script so that a subsequent attempt to collect and upload artifacts + # will skip this one from a check in the _all.ps1 script. + Set-PipelineVariable "ARTIFACTSTAGED_$($_.Name.ToUpper())" 'true' + Write-Host "Staged artifact $($_.Name) to $($_.Path)" + + if (!$StageOnly) { + if (Test-ArtifactUploaded $_.Name) { + Write-Host "Skipping $($_.Name) because it has already been uploaded." -ForegroundColor DarkGray + } else { + Write-Host "##vso[artifact.upload containerfolder=$($_.Name);artifactname=$($_.Name);]$($_.Path)" + + # Set a variable which will out-live this script so that a subsequent attempt to collect and upload artifacts + # will skip this one from a check in the _all.ps1 script. + Set-PipelineVariable "ARTIFACTUPLOADED_$($_.Name.ToUpper())" 'true' + } + } +} diff --git a/azure-pipelines/artifacts/_stage_all.ps1 b/azure-pipelines/artifacts/_stage_all.ps1 new file mode 100644 index 00000000..74d7a38d --- /dev/null +++ b/azure-pipelines/artifacts/_stage_all.ps1 @@ -0,0 +1,72 @@ +<# +.SYNOPSIS + This script links all the artifacts described by _all.ps1 + into a staging directory, reading for uploading to a cloud build artifact store. + It returns a sequence of objects with Name and Path properties. +#> + +[CmdletBinding()] +param ( + [string]$ArtifactNameSuffix, + [switch]$AvoidSymbolicLinks +) + +$ArtifactStagingFolder = & "$PSScriptRoot/../Get-ArtifactsStagingDirectory.ps1" -CleanIfLocal + +function Create-SymbolicLink { + param ( + $Link, + $Target + ) + + if ($Link -eq $Target) { + return + } + + if (Test-Path $Link) { Remove-Item $Link } + $LinkContainer = Split-Path $Link -Parent + if (!(Test-Path $LinkContainer)) { mkdir $LinkContainer } + if ($IsMacOS -or $IsLinux) { + ln $Target $Link | Out-Null + } else { + cmd /c "mklink `"$Link`" `"$Target`"" | Out-Null + } + + if ($LASTEXITCODE -ne 0) { + # Windows requires admin privileges to create symbolic links + # unless Developer Mode has been enabled. + throw "Failed to create symbolic link at $Link that points to $Target" + } +} + +# Stage all artifacts +$Artifacts = & "$PSScriptRoot\_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix +$Artifacts |% { + $DestinationFolder = [System.IO.Path]::GetFullPath("$ArtifactStagingFolder/$($_.ArtifactName)$ArtifactNameSuffix/$($_.ContainerFolder)").TrimEnd('\') + $Name = "$(Split-Path $_.Source -Leaf)" + + #Write-Host "$($_.Source) -> $($_.ArtifactName)\$($_.ContainerFolder)" -ForegroundColor Yellow + + if (-not (Test-Path $DestinationFolder)) { New-Item -ItemType Directory -Path $DestinationFolder | Out-Null } + if (Test-Path -PathType Leaf $_.Source) { # skip folders + $TargetPath = Join-Path $DestinationFolder $Name + if ($AvoidSymbolicLinks) { + Copy-Item -Path $_.Source -Destination $TargetPath + } else { + Create-SymbolicLink -Link $TargetPath -Target $_.Source + } + } +} + +$ArtifactNames = $Artifacts |% { "$($_.ArtifactName)$ArtifactNameSuffix" } +$ArtifactNames += Get-ChildItem env:ARTIFACTSTAGED_* |% { + # Return from ALLCAPS to the actual capitalization used for the artifact. + $artifactNameAllCaps = "$($_.Name.Substring('ARTIFACTSTAGED_'.Length))" + (Get-ChildItem $ArtifactStagingFolder\$artifactNameAllCaps* -Filter $artifactNameAllCaps).Name +} +$ArtifactNames | Get-Unique |% { + $artifact = New-Object -TypeName PSObject + Add-Member -InputObject $artifact -MemberType NoteProperty -Name Name -Value $_ + Add-Member -InputObject $artifact -MemberType NoteProperty -Name Path -Value (Join-Path $ArtifactStagingFolder $_) + Write-Output $artifact +} diff --git a/azure-pipelines/artifacts/build_logs.ps1 b/azure-pipelines/artifacts/build_logs.ps1 new file mode 100644 index 00000000..f05358e0 --- /dev/null +++ b/azure-pipelines/artifacts/build_logs.ps1 @@ -0,0 +1,7 @@ +$ArtifactStagingFolder = & "$PSScriptRoot/../Get-ArtifactsStagingDirectory.ps1" + +if (!(Test-Path $ArtifactStagingFolder/build_logs)) { return } + +@{ + "$ArtifactStagingFolder/build_logs" = (Get-ChildItem -Recurse "$ArtifactStagingFolder/build_logs") +} diff --git a/azure-pipelines/artifacts/coverageResults.ps1 b/azure-pipelines/artifacts/coverageResults.ps1 new file mode 100644 index 00000000..280ff9ae --- /dev/null +++ b/azure-pipelines/artifacts/coverageResults.ps1 @@ -0,0 +1,23 @@ +$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") + +$coverageFiles = @(Get-ChildItem "$RepoRoot/test/*.cobertura.xml" -Recurse | Where {$_.FullName -notlike "*/In/*" -and $_.FullName -notlike "*\In\*" }) + +# Prepare code coverage reports for merging on another machine +if ($env:SYSTEM_DEFAULTWORKINGDIRECTORY) { + Write-Host "Substituting $env:SYSTEM_DEFAULTWORKINGDIRECTORY with `"{reporoot}`"" + $coverageFiles |% { + $content = Get-Content -Path $_ |% { $_ -Replace [regex]::Escape($env:SYSTEM_DEFAULTWORKINGDIRECTORY), "{reporoot}" } + Set-Content -Path $_ -Value $content -Encoding UTF8 + } +} else { + Write-Warning "coverageResults: Azure Pipelines not detected. Machine-neutral token replacement skipped." +} + +if (!((Test-Path $RepoRoot\bin) -and (Test-Path $RepoRoot\obj))) { return } + +@{ + $RepoRoot = ( + $coverageFiles + + (Get-ChildItem "$RepoRoot\obj\*.cs" -Recurse) + ); +} diff --git a/azure-pipelines/artifacts/deployables.ps1 b/azure-pipelines/artifacts/deployables.ps1 new file mode 100644 index 00000000..94c48cdd --- /dev/null +++ b/azure-pipelines/artifacts/deployables.ps1 @@ -0,0 +1,13 @@ +$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..") +$BuildConfiguration = $env:BUILDCONFIGURATION +if (!$BuildConfiguration) { + $BuildConfiguration = 'Debug' +} + +$PackagesRoot = "$RepoRoot/bin/Packages/$BuildConfiguration" + +if (!(Test-Path $PackagesRoot)) { return } + +@{ + "$PackagesRoot" = (Get-ChildItem $PackagesRoot -Recurse) +} diff --git a/azure-pipelines/artifacts/projectAssetsJson.ps1 b/azure-pipelines/artifacts/projectAssetsJson.ps1 new file mode 100644 index 00000000..d2e85ffb --- /dev/null +++ b/azure-pipelines/artifacts/projectAssetsJson.ps1 @@ -0,0 +1,9 @@ +$ObjRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..\obj") + +if (!(Test-Path $ObjRoot)) { return } + +@{ + "$ObjRoot" = ( + (Get-ChildItem "$ObjRoot\project.assets.json" -Recurse) + ); +} diff --git a/azure-pipelines/artifacts/symbols.ps1 b/azure-pipelines/artifacts/symbols.ps1 new file mode 100644 index 00000000..9e2c7bd5 --- /dev/null +++ b/azure-pipelines/artifacts/symbols.ps1 @@ -0,0 +1,7 @@ +$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot/../../bin") +if (!(Test-Path $BinPath)) { return } +$symbolfiles = & "$PSScriptRoot/../Get-SymbolFiles.ps1" -Path $BinPath | Get-Unique + +@{ + "$BinPath" = $SymbolFiles; +} diff --git a/azure-pipelines/artifacts/testResults.ps1 b/azure-pipelines/artifacts/testResults.ps1 new file mode 100644 index 00000000..301a4376 --- /dev/null +++ b/azure-pipelines/artifacts/testResults.ps1 @@ -0,0 +1,15 @@ +[CmdletBinding()] +Param( +) + +$result = @{} + +$testRoot = Resolve-Path "$PSScriptRoot\..\..\test" +$result[$testRoot] = (Get-ChildItem "$testRoot\TestResults" -Recurse -Directory | Get-ChildItem -Recurse -File) + +$testlogsPath = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\test_logs" +if (Test-Path $testlogsPath) { + $result[$testlogsPath] = Get-ChildItem "$testlogsPath\*"; +} + +$result diff --git a/azure-pipelines/artifacts/test_symbols.ps1 b/azure-pipelines/artifacts/test_symbols.ps1 new file mode 100644 index 00000000..ce2b6481 --- /dev/null +++ b/azure-pipelines/artifacts/test_symbols.ps1 @@ -0,0 +1,7 @@ +$BinPath = [System.IO.Path]::GetFullPath("$PSScriptRoot/../../bin") +if (!(Test-Path $BinPath)) { return } +$symbolfiles = & "$PSScriptRoot/../Get-SymbolFiles.ps1" -Path $BinPath -Tests | Get-Unique + +@{ + "$BinPath" = $SymbolFiles; +} diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml new file mode 100644 index 00000000..10825828 --- /dev/null +++ b/azure-pipelines/build.yml @@ -0,0 +1,79 @@ +parameters: +- name: windowsPool + type: object + default: + vmImage: windows-2022 +- name: includeMacOS + type: boolean +- name: RunTests + type: boolean + default: true + +jobs: +- job: Windows + pool: ${{ parameters.windowsPool }} + steps: + - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. + clean: true + - template: install-dependencies.yml + + - script: dotnet nbgv cloud -c + displayName: ⚙ Set build number + + - template: dotnet.yml + parameters: + RunTests: ${{ parameters.RunTests }} + - template: expand-template.yml + +- job: Linux + pool: + vmImage: Ubuntu-22.04 + steps: + - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. + clean: true + - template: install-dependencies.yml + - template: dotnet.yml + parameters: + RunTests: ${{ parameters.RunTests }} + - script: dotnet format --verify-no-changes --no-restore + displayName: 💅 Verify formatted code + - template: expand-template.yml + +- job: macOS + condition: ${{ parameters.includeMacOS }} + pool: + vmImage: macOS-14 + steps: + - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. + clean: true + - template: install-dependencies.yml + - template: dotnet.yml + parameters: + RunTests: ${{ parameters.RunTests }} + - template: expand-template.yml + +- job: WrapUp + dependsOn: + - Windows + - Linux + - macOS + pool: ${{ parameters.windowsPool }} # Use Windows agent because PublishSymbols task requires it (https://github.com/microsoft/azure-pipelines-tasks/issues/13821). + condition: succeededOrFailed() + steps: + - checkout: self + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. + clean: true + - template: install-dependencies.yml + parameters: + initArgs: -NoRestore + - template: publish-symbols.yml + parameters: + includeMacOS: ${{ parameters.includeMacOS }} + - ${{ if parameters.RunTests }}: + - template: publish-codecoverage.yml + parameters: + includeMacOS: ${{ parameters.includeMacOS }} + - template: publish-deployables.yml diff --git a/azure-pipelines/dotnet-test-cloud.ps1 b/azure-pipelines/dotnet-test-cloud.ps1 new file mode 100644 index 00000000..24bf812a --- /dev/null +++ b/azure-pipelines/dotnet-test-cloud.ps1 @@ -0,0 +1,83 @@ +#!/usr/bin/env pwsh + +<# +.SYNOPSIS + Runs tests as they are run in cloud test runs. +.PARAMETER Configuration + The configuration within which to run tests +.PARAMETER Agent + The name of the agent. This is used in preparing test run titles. +.PARAMETER PublishResults + A switch to publish results to Azure Pipelines. +.PARAMETER x86 + A switch to run the tests in an x86 process. +.PARAMETER dotnet32 + The path to a 32-bit dotnet executable to use. +#> +[CmdletBinding()] +Param( + [string]$Configuration='Debug', + [string]$Agent='Local', + [switch]$PublishResults, + [switch]$x86, + [string]$dotnet32 +) + +$RepoRoot = (Resolve-Path "$PSScriptRoot/..").Path +$ArtifactStagingFolder = & "$PSScriptRoot/Get-ArtifactsStagingDirectory.ps1" + +$dotnet = 'dotnet' +if ($x86) { + $x86RunTitleSuffix = ", x86" + if ($dotnet32) { + $dotnet = $dotnet32 + } else { + $dotnet32Possibilities = "$PSScriptRoot\../obj/tools/x86/.dotnet/dotnet.exe", "$env:AGENT_TOOLSDIRECTORY/x86/dotnet/dotnet.exe", "${env:ProgramFiles(x86)}\dotnet\dotnet.exe" + $dotnet32Matches = $dotnet32Possibilities |? { Test-Path $_ } + if ($dotnet32Matches) { + $dotnet = Resolve-Path @($dotnet32Matches)[0] + Write-Host "Running tests using `"$dotnet`"" -ForegroundColor DarkGray + } else { + Write-Error "Unable to find 32-bit dotnet.exe" + return 1 + } + } +} + +& $dotnet test $RepoRoot ` + --no-build ` + -c $Configuration ` + --filter "TestCategory!=FailsInCloudTest" ` + --collect "Code Coverage;Format=cobertura" ` + --settings "$PSScriptRoot/test.runsettings" ` + --blame-hang-timeout 60s ` + --blame-crash ` + -bl:"$ArtifactStagingFolder/build_logs/test.binlog" ` + --diag "$ArtifactStagingFolder/test_logs/diag.log;TraceLevel=info" ` + --logger trx ` + +$unknownCounter = 0 +Get-ChildItem -Recurse -Path $RepoRoot\test\*.trx |% { + Copy-Item $_ -Destination $ArtifactStagingFolder/test_logs/ + + if ($PublishResults) { + $x = [xml](Get-Content -Path $_) + $runTitle = $null + if ($x.TestRun.TestDefinitions -and $x.TestRun.TestDefinitions.GetElementsByTagName('UnitTest')) { + $storage = $x.TestRun.TestDefinitions.GetElementsByTagName('UnitTest')[0].storage -replace '\\','/' + if ($storage -match '/(?net[^/]+)/(?:(?[^/]+)/)?(?[^/]+)\.dll$') { + if ($matches.rid) { + $runTitle = "$($matches.lib) ($($matches.tfm), $($matches.rid), $Agent)" + } else { + $runTitle = "$($matches.lib) ($($matches.tfm)$x86RunTitleSuffix, $Agent)" + } + } + } + if (!$runTitle) { + $unknownCounter += 1; + $runTitle = "unknown$unknownCounter ($Agent$x86RunTitleSuffix)"; + } + + Write-Host "##vso[results.publish type=VSTest;runTitle=$runTitle;publishRunAttachments=true;resultFiles=$_;failTaskOnFailedTests=true;testRunSystem=VSTS - PTR;]" + } +} diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml new file mode 100644 index 00000000..2444928f --- /dev/null +++ b/azure-pipelines/dotnet.yml @@ -0,0 +1,30 @@ +parameters: + RunTests: + +steps: + +- script: dotnet build -t:build,pack --no-restore -c $(BuildConfiguration) -warnAsError -warnNotAsError:NU1901,NU1902,NU1903,NU1904 /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" + displayName: 🛠 dotnet build + +- powershell: azure-pipelines/dotnet-test-cloud.ps1 -Configuration $(BuildConfiguration) -Agent $(Agent.JobName) -PublishResults + displayName: 🧪 dotnet test + condition: and(succeeded(), ${{ parameters.RunTests }}) + +- powershell: azure-pipelines/variables/_pipelines.ps1 + failOnStderr: true + displayName: ⚙ Update pipeline variables based on build outputs + condition: succeededOrFailed() + +- powershell: azure-pipelines/artifacts/_pipelines.ps1 -ArtifactNameSuffix "-$(Agent.JobName)" -Verbose + failOnStderr: true + displayName: 📢 Publish artifacts + condition: succeededOrFailed() + +- ${{ if and(ne(variables['codecov_token'], ''), parameters.RunTests) }}: + - powershell: | + $ArtifactStagingFolder = & "azure-pipelines/Get-ArtifactsStagingDirectory.ps1" + $CoverageResultsFolder = Join-Path $ArtifactStagingFolder "coverageResults-$(Agent.JobName)" + azure-pipelines/publish-CodeCov.ps1 -CodeCovToken "$(codecov_token)" -PathToCodeCoverage "$CoverageResultsFolder" -Name "$(Agent.JobName) Coverage Results" -Flags "$(Agent.JobName)" + displayName: 📢 Publish code coverage results to codecov.io + timeoutInMinutes: 3 + continueOnError: true diff --git a/azure-pipelines/install-dependencies.yml b/azure-pipelines/install-dependencies.yml new file mode 100644 index 00000000..81782668 --- /dev/null +++ b/azure-pipelines/install-dependencies.yml @@ -0,0 +1,25 @@ +parameters: + initArgs: + +steps: + +- task: NuGetAuthenticate@1 + displayName: 🔏 Authenticate NuGet feeds + inputs: + forceReinstallCredentialProvider: true + +- powershell: | + $AccessToken = '$(System.AccessToken)' # Avoid specifying the access token directly on the init.ps1 command line to avoid it showing up in errors + .\init.ps1 -AccessToken $AccessToken ${{ parameters['initArgs'] }} -UpgradePrerequisites -NoNuGetCredProvider + dotnet --info + + # Print mono version if it is present. + if (Get-Command mono -ErrorAction SilentlyContinue) { + mono --version + } + displayName: ⚙ Install prerequisites + +- powershell: azure-pipelines/variables/_pipelines.ps1 + failOnStderr: true + displayName: ⚙ Set pipeline variables based on source + name: SetPipelineVariables diff --git a/azure-pipelines/justnugetorg.nuget.config b/azure-pipelines/justnugetorg.nuget.config new file mode 100644 index 00000000..765346e5 --- /dev/null +++ b/azure-pipelines/justnugetorg.nuget.config @@ -0,0 +1,7 @@ + + + + + + + diff --git a/azure-pipelines/libtemplate-update.yml b/azure-pipelines/libtemplate-update.yml new file mode 100644 index 00000000..87302b06 --- /dev/null +++ b/azure-pipelines/libtemplate-update.yml @@ -0,0 +1,146 @@ +# This pipeline schedules regular merges of Library.Template into a repo that is based on it. +# Only Azure Repos are supported. GitHub support comes via a GitHub Actions workflow. + +trigger: none +pr: none +schedules: +- cron: "0 3 * * Mon" # Sun @ 8 or 9 PM Mountain Time (depending on DST) + displayName: Weekly trigger + branches: + include: + - main + always: true + +parameters: +- name: AutoComplete + displayName: Auto-complete pull request + type: boolean + default: false + +stages: +- stage: Merge + jobs: + - job: merge + pool: + vmImage: ubuntu-latest + steps: + - checkout: self + fetchDepth: 0 + clean: true + - pwsh: | + $LibTemplateBranch = & ./azure-pipelines/Get-LibTemplateBasis.ps1 -ErrorIfNotRelated + if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE + } + + git fetch https://github.com/aarnott/Library.Template $LibTemplateBranch + if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE + } + $LibTemplateCommit = git rev-parse FETCH_HEAD + + if ((git rev-list FETCH_HEAD ^HEAD --count) -eq 0) { + Write-Host "There are no Library.Template updates to merge." + exit 0 + } + + $UpdateBranchName = 'auto/libtemplateUpdate' + git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" push origin -f FETCH_HEAD:refs/heads/$UpdateBranchName + + Write-Host "Creating pull request" + $contentType = 'application/json'; + $headers = @{ Authorization = 'Bearer $(System.AccessToken)' }; + $rawRequest = @{ + sourceRefName = "refs/heads/$UpdateBranchName"; + targetRefName = "refs/heads/main"; + title = 'Merge latest Library.Template'; + description = "This merges the latest features and fixes from [Library.Template's $LibTemplateBranch branch](https://github.com/AArnott/Library.Template/tree/$LibTemplateBranch)."; + } + $request = ConvertTo-Json $rawRequest + + $prApiBaseUri = '$(System.TeamFoundationCollectionUri)/$(System.TeamProject)/_apis/git/repositories/$(Build.Repository.ID)/pullrequests' + $prCreationUri = $prApiBaseUri + "?api-version=6.0" + Write-Host "POST $prCreationUri" + Write-Host $request + + $prCreationResult = Invoke-RestMethod -uri $prCreationUri -method POST -Headers $headers -ContentType $contentType -Body $request + $prUrl = "$($prCreationResult.repository.webUrl)/pullrequest/$($prCreationResult.pullRequestId)" + Write-Host "Pull request: $prUrl" + $prApiBaseUri += "/$($prCreationResult.pullRequestId)" + + $SummaryPath = Join-Path '$(Agent.TempDirectory)' 'summary.md' + Set-Content -Path $SummaryPath -Value "[Insertion pull request]($prUrl)" + Write-Host "##vso[task.uploadsummary]$SummaryPath" + + # Tag the PR + $tagUri = "$prApiBaseUri/labels?api-version=7.0" + $rawRequest = @{ + name = 'auto-template-merge'; + } + $request = ConvertTo-Json $rawRequest + Invoke-RestMethod -uri $tagUri -method POST -Headers $headers -ContentType $contentType -Body $request | Out-Null + + # Add properties to the PR that we can programatically parse later. + Function Set-PRProperties($properties) { + $rawRequest = $properties.GetEnumerator() |% { + @{ + op = 'add' + path = "/$($_.key)" + from = $null + value = $_.value + } + } + $request = ConvertTo-Json $rawRequest + $setPrPropertyUri = "$prApiBaseUri/properties?api-version=7.0" + Write-Debug "$request" + $setPrPropertyResult = Invoke-RestMethod -uri $setPrPropertyUri -method PATCH -Headers $headers -ContentType 'application/json-patch+json' -Body $request -StatusCodeVariable setPrPropertyStatus -SkipHttpErrorCheck + if ($setPrPropertyStatus -ne 200) { + Write-Host "##vso[task.logissue type=warning]Failed to set pull request properties. Result: $setPrPropertyStatus. $($setPrPropertyResult.message)" + } + } + Write-Host "Setting pull request properties" + Set-PRProperties @{ + 'AutomatedMerge.SourceBranch' = $LibTemplateBranch + 'AutomatedMerge.SourceCommit' = $LibTemplateCommit + } + + # Add an *active* PR comment to warn users to *merge* the pull request instead of squash it. + $request = ConvertTo-Json @{ + comments = @( + @{ + parentCommentId = 0 + content = "Do **not** squash this pull request when completing it. You must *merge* it." + commentType = 'system' + } + ) + status = 'active' + } + $result = Invoke-RestMethod -uri "$prApiBaseUri/threads?api-version=7.1" -method POST -Headers $headers -ContentType $contentType -Body $request -StatusCodeVariable addCommentStatus -SkipHttpErrorCheck + if ($addCommentStatus -ne 200) { + Write-Host "##vso[task.logissue type=warning]Failed to post comment on pull request. Result: $addCommentStatus. $($result.message)" + } + + # Set auto-complete on the PR + if ('${{ parameters.AutoComplete }}' -eq 'True') { + Write-Host "Setting auto-complete" + $mergeMessage = "Merged PR $($prCreationResult.pullRequestId): " + $commitMessage + $rawRequest = @{ + autoCompleteSetBy = @{ + id = $prCreationResult.createdBy.id + }; + completionOptions = @{ + deleteSourceBranch = $true; + mergeCommitMessage = $mergeMessage; + mergeStrategy = 'noFastForward'; + }; + } + $request = ConvertTo-Json $rawRequest + Write-Host $request + $uri = "$($prApiBaseUri)?api-version=6.0" + $result = Invoke-RestMethod -uri $uri -method PATCH -Headers $headers -ContentType $contentType -Body $request -StatusCodeVariable autoCompleteStatus -SkipHttpErrorCheck + if ($autoCompleteStatus -ne 200) { + Write-Host "##vso[task.logissue type=warning]Failed to set auto-complete on pull request. Result: $autoCompleteStatus. $($result.message)" + } + } + + displayName: Create pull request diff --git a/azure-pipelines/publish-CodeCov.ps1 b/azure-pipelines/publish-CodeCov.ps1 new file mode 100644 index 00000000..9926f018 --- /dev/null +++ b/azure-pipelines/publish-CodeCov.ps1 @@ -0,0 +1,30 @@ +<# +.SYNOPSIS + Uploads code coverage to codecov.io +.PARAMETER CodeCovToken + Code coverage token to use +.PARAMETER PathToCodeCoverage + Path to root of code coverage files +.PARAMETER Name + Name to upload with codecoverge +.PARAMETER Flags + Flags to upload with codecoverge +#> +[CmdletBinding()] +Param ( + [Parameter(Mandatory=$true)] + [string]$CodeCovToken, + [Parameter(Mandatory=$true)] + [string]$PathToCodeCoverage, + [string]$Name, + [string]$Flags +) + +$RepoRoot = (Resolve-Path "$PSScriptRoot/..").Path + +Get-ChildItem -Recurse -Path $PathToCodeCoverage -Filter "*.cobertura.xml" | % { + $relativeFilePath = Resolve-Path -relative $_.FullName + + Write-Host "Uploading: $relativeFilePath" -ForegroundColor Yellow + & (& "$PSScriptRoot/Get-CodeCovTool.ps1") -t $CodeCovToken -f $relativeFilePath -R $RepoRoot -F $Flags -n $Name +} diff --git a/azure-pipelines/publish-codecoverage.yml b/azure-pipelines/publish-codecoverage.yml new file mode 100644 index 00000000..8ec94e64 --- /dev/null +++ b/azure-pipelines/publish-codecoverage.yml @@ -0,0 +1,24 @@ +parameters: + includeMacOS: + +steps: +- download: current + artifact: coverageResults-Windows + displayName: 🔻 Download Windows code coverage results + continueOnError: true +- download: current + artifact: coverageResults-Linux + displayName: 🔻 Download Linux code coverage results + continueOnError: true +- download: current + artifact: coverageResults-macOS + displayName: 🔻 Download macOS code coverage results + continueOnError: true + condition: and(succeeded(), ${{ parameters.includeMacOS }}) +- powershell: azure-pipelines/Merge-CodeCoverage.ps1 -Path '$(Pipeline.Workspace)' -OutputFile coveragereport/merged.cobertura.xml -Format Cobertura -Verbose + displayName: ⚙ Merge coverage +- task: PublishCodeCoverageResults@2 + displayName: 📢 Publish code coverage results to Azure DevOps + inputs: + summaryFileLocation: coveragereport/merged.cobertura.xml + failIfCoverageEmpty: true diff --git a/azure-pipelines/publish-deployables.yml b/azure-pipelines/publish-deployables.yml new file mode 100644 index 00000000..31e80a43 --- /dev/null +++ b/azure-pipelines/publish-deployables.yml @@ -0,0 +1,8 @@ +steps: +- download: current + displayName: 🔻 Download deployables + artifact: deployables-Windows + +- powershell: dotnet nuget push "$(Resolve-Path '$(Pipeline.Workspace)\deployables-Windows\')*.nupkg" -s $(ci_feed) -k azdo --skip-duplicate + displayName: 📦 Push packages to CI feed + condition: and(succeeded(), ne(variables['ci_feed'], ''), ne(variables['Build.Reason'], 'PullRequest')) diff --git a/azure-pipelines/publish-symbols.yml b/azure-pipelines/publish-symbols.yml new file mode 100644 index 00000000..00c188fc --- /dev/null +++ b/azure-pipelines/publish-symbols.yml @@ -0,0 +1,59 @@ +parameters: + includeMacOS: + +steps: +- task: DownloadPipelineArtifact@2 + inputs: + artifact: symbols-Windows + path: $(Pipeline.Workspace)/symbols/Windows + displayName: 🔻 Download Windows symbols + continueOnError: true +- task: DownloadPipelineArtifact@2 + inputs: + artifact: symbols-Linux + path: $(Pipeline.Workspace)/symbols/Linux + displayName: 🔻 Download Linux symbols + continueOnError: true +- task: DownloadPipelineArtifact@2 + inputs: + artifact: symbols-macOS + path: $(Pipeline.Workspace)/symbols/macOS + displayName: 🔻 Download macOS symbols + continueOnError: true + condition: ${{ parameters.includeMacOS }} + +- task: DownloadPipelineArtifact@2 + inputs: + artifact: test_symbols-Windows + path: $(Pipeline.Workspace)/test_symbols/Windows + displayName: 🔻 Download Windows test symbols + continueOnError: true +- task: DownloadPipelineArtifact@2 + inputs: + artifact: test_symbols-Linux + path: $(Pipeline.Workspace)/test_symbols/Linux + displayName: 🔻 Download Linux test symbols + continueOnError: true +- task: DownloadPipelineArtifact@2 + inputs: + artifact: test_symbols-macOS + path: $(Pipeline.Workspace)/test_symbols/macOS + displayName: 🔻 Download macOS test symbols + continueOnError: true + condition: ${{ parameters.includeMacOS }} + +- task: PublishSymbols@2 + inputs: + SymbolsFolder: $(Pipeline.Workspace)/symbols + SearchPattern: '**/*.pdb' + IndexSources: false + SymbolServerType: TeamServices + displayName: 📢 Publish symbols + +- task: PublishSymbols@2 + inputs: + SymbolsFolder: $(Pipeline.Workspace)/test_symbols + SearchPattern: '**/*.pdb' + IndexSources: false + SymbolServerType: TeamServices + displayName: 📢 Publish test symbols diff --git a/azure-pipelines/release.yml b/azure-pipelines/release.yml new file mode 100644 index 00000000..db6b5e4c --- /dev/null +++ b/azure-pipelines/release.yml @@ -0,0 +1,60 @@ +trigger: none # We only want to trigger manually or based on resources +pr: none + +resources: + pipelines: + - pipeline: CI + source: slow-cheetah-ci + trigger: + tags: + - auto-release + +variables: +- group: Publishing secrets + +jobs: +- job: release + pool: + vmImage: ubuntu-latest + steps: + - checkout: none + - powershell: | + Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)" + if ('$(resources.pipeline.CI.runName)'.Contains('-')) { + Write-Host "##vso[task.setvariable variable=IsPrerelease]true" + } else { + Write-Host "##vso[task.setvariable variable=IsPrerelease]false" + } + displayName: ⚙ Set up pipeline + - task: UseDotNet@2 + displayName: ⚙ Install .NET SDK + inputs: + packageType: sdk + version: 6.x + - download: CI + artifact: deployables-Windows + displayName: 🔻 Download deployables-Windows artifact + patterns: 'deployables-Windows/*' + - task: GitHubRelease@1 + displayName: 📢 GitHub release (create) + inputs: + gitHubConnection: # TODO: fill in service connection here + repositoryName: $(Build.Repository.Name) + target: $(resources.pipeline.CI.sourceCommit) + tagSource: userSpecifiedTag + tag: v$(resources.pipeline.CI.runName) + title: v$(resources.pipeline.CI.runName) + isDraft: true # After running this step, visit the new draft release, edit, and publish. + isPreRelease: $(IsPrerelease) + assets: $(Pipeline.Workspace)/CI/deployables-Windows/*.nupkg + changeLogCompareToRelease: lastNonDraftRelease + changeLogType: issueBased + changeLogLabels: | + [ + { "label" : "breaking change", "displayName" : "Breaking changes", "state" : "closed" }, + { "label" : "bug", "displayName" : "Fixes", "state" : "closed" }, + { "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" } + ] + - script: dotnet nuget push $(Pipeline.Workspace)/CI/deployables-Windows/*.nupkg -s https://api.nuget.org/v3/index.json --api-key $(NuGetOrgApiKey) --skip-duplicate + displayName: 📦 Push packages to nuget.org + condition: and(succeeded(), ne(variables['NuGetOrgApiKey'], '')) diff --git a/azure-pipelines/test.runsettings b/azure-pipelines/test.runsettings new file mode 100644 index 00000000..4e24a0a6 --- /dev/null +++ b/azure-pipelines/test.runsettings @@ -0,0 +1,44 @@ + + + + + + + + + \.dll$ + \.exe$ + + + xunit\..* + + + + + ^System\.Diagnostics\.DebuggerHiddenAttribute$ + ^System\.Diagnostics\.DebuggerNonUserCodeAttribute$ + ^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$ + ^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$ + + + + + True + + True + + True + + False + + False + + False + + True + + + + + + diff --git a/azure-pipelines/variables/DotNetSdkVersion.ps1 b/azure-pipelines/variables/DotNetSdkVersion.ps1 new file mode 100644 index 00000000..b213fbc2 --- /dev/null +++ b/azure-pipelines/variables/DotNetSdkVersion.ps1 @@ -0,0 +1,2 @@ +$globalJson = Get-Content -Path "$PSScriptRoot\..\..\global.json" | ConvertFrom-Json +$globalJson.sdk.version diff --git a/azure-pipelines/variables/_all.ps1 b/azure-pipelines/variables/_all.ps1 new file mode 100644 index 00000000..cc6e8810 --- /dev/null +++ b/azure-pipelines/variables/_all.ps1 @@ -0,0 +1,20 @@ +#!/usr/bin/env pwsh + +<# +.SYNOPSIS + This script returns a hashtable of build variables that should be set + at the start of a build or release definition's execution. +#> + +[CmdletBinding(SupportsShouldProcess = $true)] +param ( +) + +$vars = @{} + +Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" |% { + Write-Host "Computing $($_.BaseName) variable" + $vars[$_.BaseName] = & $_ +} + +$vars diff --git a/azure-pipelines/variables/_pipelines.ps1 b/azure-pipelines/variables/_pipelines.ps1 new file mode 100644 index 00000000..11748b81 --- /dev/null +++ b/azure-pipelines/variables/_pipelines.ps1 @@ -0,0 +1,31 @@ +<# +.SYNOPSIS + This script translates the variables returned by the _all.ps1 script + into commands that instruct Azure Pipelines to actually set those variables for other pipeline tasks to consume. + + The build or release definition may have set these variables to override + what the build would do. So only set them if they have not already been set. +#> + +[CmdletBinding()] +param ( +) + +(& "$PSScriptRoot\_all.ps1").GetEnumerator() |% { + # Always use ALL CAPS for env var names since Azure Pipelines converts variable names to all caps and on non-Windows OS, env vars are case sensitive. + $keyCaps = $_.Key.ToUpper() + if ((Test-Path "env:$keyCaps") -and (Get-Content "env:$keyCaps")) { + Write-Host "Skipping setting $keyCaps because variable is already set to '$(Get-Content env:$keyCaps)'." -ForegroundColor Cyan + } else { + Write-Host "$keyCaps=$($_.Value)" -ForegroundColor Yellow + if ($env:TF_BUILD) { + # Create two variables: the first that can be used by its simple name and accessible only within this job. + Write-Host "##vso[task.setvariable variable=$keyCaps]$($_.Value)" + # and the second that works across jobs and stages but must be fully qualified when referenced. + Write-Host "##vso[task.setvariable variable=$keyCaps;isOutput=true]$($_.Value)" + } elseif ($env:GITHUB_ACTIONS) { + Add-Content -Path $env:GITHUB_ENV -Value "$keyCaps=$($_.Value)" + } + Set-Item -Path "env:$keyCaps" -Value $_.Value + } +} diff --git a/global.json b/global.json new file mode 100644 index 00000000..1f0eafb4 --- /dev/null +++ b/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "8.0.402", + "rollForward": "patch", + "allowPrerelease": false + } +} diff --git a/init.cmd b/init.cmd new file mode 100644 index 00000000..667efabb --- /dev/null +++ b/init.cmd @@ -0,0 +1,20 @@ +@echo off +SETLOCAL +set PS1UnderCmd=1 + +:: Get the datetime in a format that can go in a filename. +set _my_datetime=%date%_%time% +set _my_datetime=%_my_datetime: =_% +set _my_datetime=%_my_datetime::=% +set _my_datetime=%_my_datetime:/=_% +set _my_datetime=%_my_datetime:.=_% +set CmdEnvScriptPath=%temp%\envvarscript_%_my_datetime%.cmd + +powershell.exe -NoProfile -NoLogo -ExecutionPolicy bypass -Command "try { & '%~dpn0.ps1' %*; exit $LASTEXITCODE } catch { write-host $_; exit 1 }" + +:: Set environment variables in the parent cmd.exe process. +IF EXIST "%CmdEnvScriptPath%" ( + ENDLOCAL + CALL "%CmdEnvScriptPath%" + DEL "%CmdEnvScriptPath%" +) diff --git a/init.ps1 b/init.ps1 new file mode 100644 index 00000000..e2849855 --- /dev/null +++ b/init.ps1 @@ -0,0 +1,114 @@ +#!/usr/bin/env pwsh + +<# +.SYNOPSIS + Installs dependencies required to build and test the projects in this repository. +.DESCRIPTION + This MAY not require elevation, as the SDK and runtimes are installed to a per-user location, + unless the `-InstallLocality` switch is specified directing to a per-repo or per-machine location. + See detailed help on that switch for more information. + + The CmdEnvScriptPath environment variable may be optionally set to a path to a cmd shell script to be created (or appended to if it already exists) that will set the environment variables in cmd.exe that are set within the PowerShell environment. + This is used by init.cmd in order to reapply any new environment variables to the parent cmd.exe process that were set in the powershell child process. +.PARAMETER InstallLocality + A value indicating whether dependencies should be installed locally to the repo or at a per-user location. + Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. + Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. + Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. + When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. + Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. + Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. +.PARAMETER NoPrerequisites + Skips the installation of prerequisite software (e.g. SDKs, tools). +.PARAMETER NoNuGetCredProvider + Skips the installation of the NuGet credential provider. Useful in pipelines with the `NuGetAuthenticate` task, as a workaround for https://github.com/microsoft/artifacts-credprovider/issues/244. + This switch is ignored and installation is skipped when -NoPrerequisites is specified. +.PARAMETER UpgradePrerequisites + Takes time to install prerequisites even if they are already present in case they need to be upgraded. + No effect if -NoPrerequisites is specified. +.PARAMETER NoRestore + Skips the package restore step. +.PARAMETER NoToolRestore + Skips the dotnet tool restore step. +.PARAMETER AccessToken + An optional access token for authenticating to Azure Artifacts authenticated feeds. +.PARAMETER Interactive + Runs NuGet restore in interactive mode. This can turn authentication failures into authentication challenges. +#> +[CmdletBinding(SupportsShouldProcess = $true)] +Param ( + [ValidateSet('repo', 'user', 'machine')] + [string]$InstallLocality = 'user', + [Parameter()] + [switch]$NoPrerequisites, + [Parameter()] + [switch]$NoNuGetCredProvider, + [Parameter()] + [switch]$UpgradePrerequisites, + [Parameter()] + [switch]$NoRestore, + [Parameter()] + [switch]$NoToolRestore, + [Parameter()] + [string]$AccessToken, + [Parameter()] + [switch]$Interactive +) + +$EnvVars = @{} +$PrependPath = @() + +if (!$NoPrerequisites) { + if (!$NoNuGetCredProvider) { + & "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken -Force:$UpgradePrerequisites + } + + & "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality + if ($LASTEXITCODE -eq 3010) { + Exit 3010 + } + + # The procdump tool and env var is required for dotnet test to collect hang/crash dumps of tests. + # But it only works on Windows. + if ($env:OS -eq 'Windows_NT') { + $EnvVars['PROCDUMP_PATH'] = & "$PSScriptRoot\azure-pipelines\Get-ProcDump.ps1" + } +} + +# Workaround nuget credential provider bug that causes very unreliable package restores on Azure Pipelines +$env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS = 20 +$env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS = 20 + +Push-Location $PSScriptRoot +try { + $HeaderColor = 'Green' + + $RestoreArguments = @() + if ($Interactive) { + $RestoreArguments += '--interactive' + } + + if (!$NoRestore -and $PSCmdlet.ShouldProcess("NuGet packages", "Restore")) { + Write-Host "Restoring NuGet packages" -ForegroundColor $HeaderColor + dotnet restore @RestoreArguments + if ($lastexitcode -ne 0) { + throw "Failure while restoring packages." + } + } + + if (!$NoToolRestore -and $PSCmdlet.ShouldProcess("dotnet tool", "restore")) { + dotnet tool restore @RestoreArguments + if ($lastexitcode -ne 0) { + throw "Failure while restoring dotnet CLI tools." + } + } + + & "$PSScriptRoot/tools/Set-EnvVars.ps1" -Variables $EnvVars -PrependPath $PrependPath | Out-Null +} +catch { + Write-Error $error[0] + exit $lastexitcode +} +finally { + Pop-Location +} diff --git a/src/.editorconfig b/src/.editorconfig new file mode 100644 index 00000000..e69de29b diff --git a/src/AssemblyInfo.cs b/src/AssemblyInfo.cs new file mode 100644 index 00000000..81feda27 --- /dev/null +++ b/src/AssemblyInfo.cs @@ -0,0 +1,6 @@ +// Copyright (c) COMPANY-PLACEHOLDER. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Runtime.InteropServices; + +[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.SafeDirectories)] diff --git a/src/AssemblyInfo.vb b/src/AssemblyInfo.vb new file mode 100644 index 00000000..34b7cbe1 --- /dev/null +++ b/src/AssemblyInfo.vb @@ -0,0 +1,6 @@ +' Copyright (c) COMPANY-PLACEHOLDER. All rights reserved. +' Licensed under the MIT license. See LICENSE file in the project root for full license information. + +Imports System.Runtime.InteropServices + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 8f49d791..9ba7818d 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,17 +1,12 @@ + - + - Debug - AnyCPU - $(MSBuildThisFileDirectory)..\bin\ - $(MSBuildThisFileDirectory)..\obj\$(MSBuildProjectName)\ - $(BaseIntermediateOutputPath)$(Configuration)\ - $(BaseOutputPath)$(Configuration)\ - $(OutputPath)packages\ - true + README.md - - + + + diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets new file mode 100644 index 00000000..654f5c6d --- /dev/null +++ b/src/Directory.Build.targets @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/.editorconfig b/test/.editorconfig new file mode 100644 index 00000000..74dd4a1f --- /dev/null +++ b/test/.editorconfig @@ -0,0 +1,55 @@ +[*.cs] + +# SA1600: Elements should be documented +dotnet_diagnostic.SA1600.severity = silent + +# SA1601: Partial elements should be documented +dotnet_diagnostic.SA1601.severity = silent + +# SA1602: Enumeration items should be documented +dotnet_diagnostic.SA1602.severity = silent + +# SA1615: Element return value should be documented +dotnet_diagnostic.SA1615.severity = silent + +# VSTHRD103: Call async methods when in an async method +dotnet_diagnostic.VSTHRD103.severity = silent + +# VSTHRD111: Use .ConfigureAwait(bool) +dotnet_diagnostic.VSTHRD111.severity = none + +# VSTHRD200: Use Async suffix for async methods +dotnet_diagnostic.VSTHRD200.severity = silent + +# CA1014: Mark assemblies with CLSCompliant +dotnet_diagnostic.CA1014.severity = none + +# CA1050: Declare types in namespaces +dotnet_diagnostic.CA1050.severity = none + +# CA1303: Do not pass literals as localized parameters +dotnet_diagnostic.CA1303.severity = none + +# CS1591: Missing XML comment for publicly visible type or member +dotnet_diagnostic.CS1591.severity = silent + +# CA1707: Identifiers should not contain underscores +dotnet_diagnostic.CA1707.severity = silent + +# CA1062: Validate arguments of public methods +dotnet_diagnostic.CA1062.severity = suggestion + +# CA1063: Implement IDisposable Correctly +dotnet_diagnostic.CA1063.severity = silent + +# CA1816: Dispose methods should call SuppressFinalize +dotnet_diagnostic.CA1816.severity = silent + +# CA2007: Consider calling ConfigureAwait on the awaited task +dotnet_diagnostic.CA2007.severity = none + +# SA1401: Fields should be private +dotnet_diagnostic.SA1401.severity = silent + +# SA1133: Do not combine attributes +dotnet_diagnostic.SA1133.severity = silent diff --git a/test/Directory.Build.props b/test/Directory.Build.props new file mode 100644 index 00000000..6c7aa71d --- /dev/null +++ b/test/Directory.Build.props @@ -0,0 +1,10 @@ + + + + + + false + true + + + diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets new file mode 100644 index 00000000..a6e0f4ac --- /dev/null +++ b/test/Directory.Build.targets @@ -0,0 +1,4 @@ + + + + diff --git a/tools/Check-DotNetRuntime.ps1 b/tools/Check-DotNetRuntime.ps1 new file mode 100644 index 00000000..9d012109 --- /dev/null +++ b/tools/Check-DotNetRuntime.ps1 @@ -0,0 +1,41 @@ +<# +.SYNOPSIS + Checks whether a given .NET Core runtime is installed. +#> +[CmdletBinding()] +Param ( + [Parameter()] + [ValidateSet('Microsoft.AspNetCore.App','Microsoft.NETCore.App')] + [string]$Runtime='Microsoft.NETCore.App', + [Parameter(Mandatory=$true)] + [Version]$Version +) + +$dotnet = Get-Command dotnet -ErrorAction SilentlyContinue +if (!$dotnet) { + # Nothing is installed. + Write-Output $false + exit 1 +} + +Function IsVersionMatch { + Param( + [Parameter()] + $actualVersion + ) + return $actualVersion -and + $Version.Major -eq $actualVersion.Major -and + $Version.Minor -eq $actualVersion.Minor -and + (($Version.Build -eq -1) -or ($Version.Build -eq $actualVersion.Build)) -and + (($Version.Revision -eq -1) -or ($Version.Revision -eq $actualVersion.Revision)) +} + +$installedRuntimes = dotnet --list-runtimes |? { $_.Split()[0] -ieq $Runtime } |% { $v = $null; [Version]::tryparse($_.Split()[1], [ref] $v); $v } +$matchingRuntimes = $installedRuntimes |? { IsVersionMatch -actualVersion $_ } +if (!$matchingRuntimes) { + Write-Output $false + exit 1 +} + +Write-Output $true +exit 0 diff --git a/tools/Check-DotNetSdk.ps1 b/tools/Check-DotNetSdk.ps1 new file mode 100644 index 00000000..6c9fa772 --- /dev/null +++ b/tools/Check-DotNetSdk.ps1 @@ -0,0 +1,37 @@ +<# +.SYNOPSIS + Checks whether the .NET Core SDK required by this repo is installed. +#> +[CmdletBinding()] +Param ( +) + +$dotnet = Get-Command dotnet -ErrorAction SilentlyContinue +if (!$dotnet) { + # Nothing is installed. + Write-Output $false + exit 1 +} + +# We need to set the current directory so dotnet considers the SDK required by our global.json file. +Push-Location "$PSScriptRoot\.." +try { + dotnet -h 2>&1 | Out-Null + if (($LASTEXITCODE -eq 129) -or # On Linux + ($LASTEXITCODE -eq -2147450751) # On Windows + ) { + # These exit codes indicate no matching SDK exists. + Write-Output $false + exit 2 + } + + # The required SDK is already installed! + Write-Output $true + exit 0 +} catch { + # I don't know why, but on some build agents (e.g. MicroBuild), an exception is thrown from the `dotnet` invocation when a match is not found. + Write-Output $false + exit 3 +} finally { + Pop-Location +} diff --git a/tools/Install-DotNetSdk.ps1 b/tools/Install-DotNetSdk.ps1 new file mode 100644 index 00000000..e190fcfb --- /dev/null +++ b/tools/Install-DotNetSdk.ps1 @@ -0,0 +1,421 @@ +#!/usr/bin/env pwsh + +<# +.SYNOPSIS + Installs the .NET SDK specified in the global.json file at the root of this repository, + along with supporting .NET runtimes used for testing. +.DESCRIPTION + This MAY not require elevation, as the SDK and runtimes are installed locally to this repo location, + unless `-InstallLocality machine` is specified. +.PARAMETER InstallLocality + A value indicating whether dependencies should be installed locally to the repo or at a per-user location. + Per-user allows sharing the installed dependencies across repositories and allows use of a shared expanded package cache. + Visual Studio will only notice and use these SDKs/runtimes if VS is launched from the environment that runs this script. + Per-repo allows for high isolation, allowing for a more precise recreation of the environment within an Azure Pipelines build. + When using 'repo', environment variables are set to cause the locally installed dotnet SDK to be used. + Per-repo can lead to file locking issues when dotnet.exe is left running as a build server and can be mitigated by running `dotnet build-server shutdown`. + Per-machine requires elevation and will download and install all SDKs and runtimes to machine-wide locations so all applications can find it. +.PARAMETER SdkOnly + Skips installing the runtime. +.PARAMETER IncludeX86 + Installs a x86 SDK and runtimes in addition to the x64 ones. Only supported on Windows. Ignored on others. +.PARAMETER IncludeAspNetCore + Installs the ASP.NET Core runtime along with the .NET runtime. +#> +[CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] +Param ( + [ValidateSet('repo','user','machine')] + [string]$InstallLocality='user', + [switch]$SdkOnly, + [switch]$IncludeX86, + [switch]$IncludeAspNetCore +) + +$DotNetInstallScriptRoot = "$PSScriptRoot/../obj/tools" +if (!(Test-Path $DotNetInstallScriptRoot)) { New-Item -ItemType Directory -Path $DotNetInstallScriptRoot -WhatIf:$false | Out-Null } +$DotNetInstallScriptRoot = Resolve-Path $DotNetInstallScriptRoot + +# Look up actual required .NET SDK version from global.json +$sdkVersion = & "$PSScriptRoot/../azure-pipelines/variables/DotNetSdkVersion.ps1" + +If ($IncludeX86 -and ($IsMacOS -or $IsLinux)) { + Write-Verbose "Ignoring -IncludeX86 switch because 32-bit runtimes are only supported on Windows." + $IncludeX86 = $false +} + +$arch = [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture +if (!$arch) { # Windows Powershell leaves this blank + $arch = 'x64' + if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { $arch = 'ARM64' } + if (${env:ProgramFiles(Arm)}) { $arch = 'ARM64' } +} + +# Search for all .NET runtime versions referenced from MSBuild projects and arrange to install them. +$runtimeVersions = @() +$windowsDesktopRuntimeVersions = @() +$aspnetRuntimeVersions = @() +if (!$SdkOnly) { + Get-ChildItem "$PSScriptRoot\..\src\*.*proj","$PSScriptRoot\..\test\*.*proj","$PSScriptRoot\..\Directory.Build.props" -Recurse |% { + $projXml = [xml](Get-Content -Path $_) + $pg = $projXml.Project.PropertyGroup + if ($pg) { + $targetFrameworks = @() + $tf = $pg.TargetFramework + $targetFrameworks += $tf + $tfs = $pg.TargetFrameworks + if ($tfs) { + $targetFrameworks = $tfs -Split ';' + } + } + $targetFrameworks |? { $_ -match 'net(?:coreapp)?(\d+\.\d+)' } |% { + $v = $Matches[1] + $runtimeVersions += $v + $aspnetRuntimeVersions += $v + if ($v -ge '3.0' -and -not ($IsMacOS -or $IsLinux)) { + $windowsDesktopRuntimeVersions += $v + } + } + + # Add target frameworks of the form: netXX + $targetFrameworks |? { $_ -match 'net(\d+\.\d+)' } |% { + $v = $Matches[1] + $runtimeVersions += $v + $aspnetRuntimeVersions += $v + if (-not ($IsMacOS -or $IsLinux)) { + $windowsDesktopRuntimeVersions += $v + } + } + } +} + +if (!$IncludeAspNetCore) { + $aspnetRuntimeVersions = @() +} + +Function Get-FileFromWeb([Uri]$Uri, $OutDir) { + $OutFile = Join-Path $OutDir $Uri.Segments[-1] + if (!(Test-Path $OutFile)) { + Write-Verbose "Downloading $Uri..." + if (!(Test-Path $OutDir)) { New-Item -ItemType Directory -Path $OutDir | Out-Null } + try { + (New-Object System.Net.WebClient).DownloadFile($Uri, $OutFile) + } finally { + # This try/finally causes the script to abort + } + } + + $OutFile +} + +Function Get-InstallerExe( + $Version, + $Architecture, + [ValidateSet('Sdk','Runtime','WindowsDesktop')] + [string]$sku +) { + # Get the latest/actual version for the specified one + $TypedVersion = $null + if (![Version]::TryParse($Version, [ref] $TypedVersion)) { + Write-Error "Unable to parse $Version into an a.b.c.d version. This version cannot be installed machine-wide." + exit 1 + } + + if ($TypedVersion.Build -eq -1) { + $versionInfo = -Split (Invoke-WebRequest -Uri "https://dotnetcli.blob.core.windows.net/dotnet/$sku/$Version/latest.version" -UseBasicParsing) + $Version = $versionInfo[-1] + } + + $majorMinor = "$($TypedVersion.Major).$($TypedVersion.Minor)" + $ReleasesFile = Join-Path $DotNetInstallScriptRoot "$majorMinor\releases.json" + if (!(Test-Path $ReleasesFile)) { + Get-FileFromWeb -Uri "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/$majorMinor/releases.json" -OutDir (Split-Path $ReleasesFile) | Out-Null + } + + $releases = Get-Content $ReleasesFile | ConvertFrom-Json + $url = $null + foreach ($release in $releases.releases) { + $filesElement = $null + if ($release.$sku.version -eq $Version) { + $filesElement = $release.$sku.files + } + if (!$filesElement -and ($sku -eq 'sdk') -and $release.sdks) { + foreach ($sdk in $release.sdks) { + if ($sdk.version -eq $Version) { + $filesElement = $sdk.files + break + } + } + } + + if ($filesElement) { + foreach ($file in $filesElement) { + if ($file.rid -eq "win-$Architecture") { + $url = $file.url + Break + } + } + + if ($url) { + Break + } + } + } + + if ($url) { + Get-FileFromWeb -Uri $url -OutDir $DotNetInstallScriptRoot + } else { + throw "Unable to find release of $sku v$Version" + } +} + +Function Install-DotNet($Version, $Architecture, [ValidateSet('Sdk','Runtime','WindowsDesktop','AspNetCore')][string]$sku = 'Sdk') { + Write-Host "Downloading .NET $sku $Version..." + $Installer = Get-InstallerExe -Version $Version -Architecture $Architecture -sku $sku + Write-Host "Installing .NET $sku $Version..." + cmd /c start /wait $Installer /install /passive /norestart + if ($LASTEXITCODE -eq 3010) { + Write-Verbose "Restart required" + } elseif ($LASTEXITCODE -ne 0) { + throw "Failure to install .NET SDK" + } +} + +$switches = @() +$envVars = @{ + # For locally installed dotnet, skip first time experience which takes a long time + 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' = 'true'; +} + +if ($InstallLocality -eq 'machine') { + if ($IsMacOS -or $IsLinux) { + $DotNetInstallDir = '/usr/share/dotnet' + } else { + $restartRequired = $false + if ($PSCmdlet.ShouldProcess(".NET SDK $sdkVersion", "Install")) { + Install-DotNet -Version $sdkVersion -Architecture $arch + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + + if ($IncludeX86) { + Install-DotNet -Version $sdkVersion -Architecture x86 + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + } + } + + $runtimeVersions | Sort-Object | Get-Unique |% { + if ($PSCmdlet.ShouldProcess(".NET runtime $_", "Install")) { + Install-DotNet -Version $_ -sku Runtime -Architecture $arch + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + + if ($IncludeX86) { + Install-DotNet -Version $_ -sku Runtime -Architecture x86 + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + } + } + } + + $windowsDesktopRuntimeVersions | Sort-Object | Get-Unique |% { + if ($PSCmdlet.ShouldProcess(".NET Windows Desktop $_", "Install")) { + Install-DotNet -Version $_ -sku WindowsDesktop -Architecture $arch + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + + if ($IncludeX86) { + Install-DotNet -Version $_ -sku WindowsDesktop -Architecture x86 + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + } + } + } + + $aspnetRuntimeVersions | Sort-Object | Get-Unique |% { + if ($PSCmdlet.ShouldProcess("ASP.NET Core $_", "Install")) { + Install-DotNet -Version $_ -sku AspNetCore -Architecture $arch + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + + if ($IncludeX86) { + Install-DotNet -Version $_ -sku AspNetCore -Architecture x86 + $restartRequired = $restartRequired -or ($LASTEXITCODE -eq 3010) + } + } + } + if ($restartRequired) { + Write-Host -ForegroundColor Yellow "System restart required" + Exit 3010 + } + + return + } +} elseif ($InstallLocality -eq 'repo') { + $DotNetInstallDir = "$DotNetInstallScriptRoot/.dotnet" + $DotNetX86InstallDir = "$DotNetInstallScriptRoot/x86/.dotnet" +} elseif ($env:AGENT_TOOLSDIRECTORY) { + $DotNetInstallDir = "$env:AGENT_TOOLSDIRECTORY/dotnet" + $DotNetX86InstallDir = "$env:AGENT_TOOLSDIRECTORY/x86/dotnet" +} else { + $DotNetInstallDir = Join-Path $HOME .dotnet +} + +if ($DotNetInstallDir) { + if (!(Test-Path $DotNetInstallDir)) { New-Item -ItemType Directory -Path $DotNetInstallDir } + $DotNetInstallDir = Resolve-Path $DotNetInstallDir + Write-Host "Installing .NET SDK and runtimes to $DotNetInstallDir" -ForegroundColor Blue + $envVars['DOTNET_MULTILEVEL_LOOKUP'] = '0' + $envVars['DOTNET_ROOT'] = $DotNetInstallDir +} + +if ($IncludeX86) { + if ($DotNetX86InstallDir) { + if (!(Test-Path $DotNetX86InstallDir)) { New-Item -ItemType Directory -Path $DotNetX86InstallDir } + $DotNetX86InstallDir = Resolve-Path $DotNetX86InstallDir + Write-Host "Installing x86 .NET SDK and runtimes to $DotNetX86InstallDir" -ForegroundColor Blue + } else { + # Only machine-wide or repo-wide installations can handle two unique dotnet.exe architectures. + Write-Error "The installation location or OS isn't supported for x86 installation. Try a different -InstallLocality value." + return 1 + } +} + +if ($IsMacOS -or $IsLinux) { + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/0b09de9bc136cacb5f849a6957ebd4062173c148/src/dotnet-install.sh" + $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.sh" +} else { + $DownloadUri = "https://raw.githubusercontent.com/dotnet/install-scripts/0b09de9bc136cacb5f849a6957ebd4062173c148/src/dotnet-install.ps1" + $DotNetInstallScriptPath = "$DotNetInstallScriptRoot/dotnet-install.ps1" +} + +if (-not (Test-Path $DotNetInstallScriptPath)) { + Invoke-WebRequest -Uri $DownloadUri -OutFile $DotNetInstallScriptPath -UseBasicParsing + if ($IsMacOS -or $IsLinux) { + chmod +x $DotNetInstallScriptPath + } +} + +# In case the script we invoke is in a directory with spaces, wrap it with single quotes. +# In case the path includes single quotes, escape them. +$DotNetInstallScriptPathExpression = $DotNetInstallScriptPath.Replace("'", "''") +$DotNetInstallScriptPathExpression = "& '$DotNetInstallScriptPathExpression'" + +$anythingInstalled = $false +$global:LASTEXITCODE = 0 + +if ($PSCmdlet.ShouldProcess(".NET SDK $sdkVersion", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion -Architecture $arch -InstallDir $DotNetInstallDir $switches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } +} else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion -Architecture $arch -InstallDir $DotNetInstallDir $switches -DryRun" +} + +if ($IncludeX86) { + if ($PSCmdlet.ShouldProcess(".NET x86 SDK $sdkVersion", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion -Architecture x86 -InstallDir $DotNetX86InstallDir $switches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET x86 SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Version $sdkVersion -Architecture x86 -InstallDir $DotNetX86InstallDir $switches -DryRun" + } +} + +$dotnetRuntimeSwitches = $switches + '-Runtime','dotnet' + +$runtimeVersions | Sort-Object -Unique |% { + if ($PSCmdlet.ShouldProcess(".NET $Arch runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $dotnetRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $dotnetRuntimeSwitches -DryRun" + } + + if ($IncludeX86) { + if ($PSCmdlet.ShouldProcess(".NET x86 runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $dotnetRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $dotnetRuntimeSwitches -DryRun" + } + } +} + +$windowsDesktopRuntimeSwitches = $switches + '-Runtime','windowsdesktop' + +$windowsDesktopRuntimeVersions | Sort-Object -Unique |% { + if ($PSCmdlet.ShouldProcess(".NET WindowsDesktop $arch runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $windowsDesktopRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $windowsDesktopRuntimeSwitches -DryRun" + } + + if ($IncludeX86) { + if ($PSCmdlet.ShouldProcess(".NET WindowsDesktop x86 runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $windowsDesktopRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $windowsDesktopRuntimeSwitches -DryRun" + } + } +} + +$aspnetRuntimeSwitches = $switches + '-Runtime','aspnetcore' + +$aspnetRuntimeVersions | Sort-Object -Unique |% { + if ($PSCmdlet.ShouldProcess(".NET ASP.NET Core $arch runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $aspnetRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture $arch -InstallDir $DotNetInstallDir $aspnetRuntimeSwitches -DryRun" + } + + if ($IncludeX86) { + if ($PSCmdlet.ShouldProcess(".NET ASP.NET Core x86 runtime $_", "Install")) { + $anythingInstalled = $true + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $aspnetRuntimeSwitches" + + if ($LASTEXITCODE -ne 0) { + Write-Error ".NET SDK installation failure: $LASTEXITCODE" + exit $LASTEXITCODE + } + } else { + Invoke-Expression -Command "$DotNetInstallScriptPathExpression -Channel $_ -Architecture x86 -InstallDir $DotNetX86InstallDir $aspnetRuntimeSwitches -DryRun" + } + } +} + +if ($PSCmdlet.ShouldProcess("Set DOTNET environment variables to discover these installed runtimes?")) { + & "$PSScriptRoot/Set-EnvVars.ps1" -Variables $envVars -PrependPath $DotNetInstallDir | Out-Null +} + +if ($anythingInstalled -and ($InstallLocality -ne 'machine') -and !$env:TF_BUILD -and !$env:GITHUB_ACTIONS) { + Write-Warning ".NET runtimes or SDKs were installed to a non-machine location. Perform your builds or open Visual Studio from this same environment in order for tools to discover the location of these dependencies." +} diff --git a/tools/Install-NuGetCredProvider.ps1 b/tools/Install-NuGetCredProvider.ps1 new file mode 100644 index 00000000..496049a2 --- /dev/null +++ b/tools/Install-NuGetCredProvider.ps1 @@ -0,0 +1,76 @@ +#!/usr/bin/env pwsh + +<# +.SYNOPSIS + Downloads and installs the Microsoft Artifacts Credential Provider + from https://github.com/microsoft/artifacts-credprovider + to assist in authenticating to Azure Artifact feeds in interactive development + or unattended build agents. +.PARAMETER Force + Forces install of the CredProvider plugin even if one already exists. This is useful to upgrade an older version. +.PARAMETER AccessToken + An optional access token for authenticating to Azure Artifacts authenticated feeds. +#> +[CmdletBinding()] +Param ( + [Parameter()] + [switch]$Force, + [Parameter()] + [string]$AccessToken +) + +$envVars = @{} + +$toolsPath = & "$PSScriptRoot\..\azure-pipelines\Get-TempToolsPath.ps1" + +if ($IsMacOS -or $IsLinux) { + $installerScript = "installcredprovider.sh" + $sourceUrl = "https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh" +} else { + $installerScript = "installcredprovider.ps1" + $sourceUrl = "https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.ps1" +} + +$installerScript = Join-Path $toolsPath $installerScript + +if (!(Test-Path $installerScript) -or $Force) { + Invoke-WebRequest $sourceUrl -OutFile $installerScript +} + +$installerScript = (Resolve-Path $installerScript).Path + +if ($IsMacOS -or $IsLinux) { + chmod u+x $installerScript +} + +& $installerScript -Force:$Force -AddNetfx -InstallNet6 + +if ($AccessToken) { + $endpoints = @() + + $endpointURIs = @() + Get-ChildItem "$PSScriptRoot\..\nuget.config" -Recurse |% { + $nugetConfig = [xml](Get-Content -Path $_) + + $nugetConfig.configuration.packageSources.add |? { ($_.value -match '^https://pkgs\.dev\.azure\.com/') -or ($_.value -match '^https://[\w\-]+\.pkgs\.visualstudio\.com/') } |% { + if ($endpointURIs -notcontains $_.Value) { + $endpointURIs += $_.Value + $endpoint = New-Object -TypeName PSObject + Add-Member -InputObject $endpoint -MemberType NoteProperty -Name endpoint -Value $_.value + Add-Member -InputObject $endpoint -MemberType NoteProperty -Name username -Value ado + Add-Member -InputObject $endpoint -MemberType NoteProperty -Name password -Value $AccessToken + $endpoints += $endpoint + } + } + } + + $auth = New-Object -TypeName PSObject + Add-Member -InputObject $auth -MemberType NoteProperty -Name endpointCredentials -Value $endpoints + + $authJson = ConvertTo-Json -InputObject $auth + $envVars += @{ + 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS'=$authJson; + } +} + +& "$PSScriptRoot/Set-EnvVars.ps1" -Variables $envVars | Out-Null diff --git a/tools/MergeFrom-Template.ps1 b/tools/MergeFrom-Template.ps1 new file mode 100644 index 00000000..3f721c6a --- /dev/null +++ b/tools/MergeFrom-Template.ps1 @@ -0,0 +1,79 @@ + +<# +.SYNOPSIS + Merges the latest changes from Library.Template into HEAD of this repo. +.PARAMETER LocalBranch + The name of the local branch to create at HEAD and use to merge into from Library.Template. +#> +[CmdletBinding(SupportsShouldProcess = $true)] +Param( + [string]$LocalBranch = "dev/$($env:USERNAME)/libtemplateUpdate" +) + +Function Spawn-Tool($command, $commandArgs, $workingDirectory, $allowFailures) { + if ($workingDirectory) { + Push-Location $workingDirectory + } + try { + if ($env:TF_BUILD) { + Write-Host "$pwd >" + Write-Host "##[command]$command $commandArgs" + } + else { + Write-Host "$command $commandArgs" -ForegroundColor Yellow + } + if ($commandArgs) { + & $command @commandArgs + } else { + Invoke-Expression $command + } + if ((!$allowFailures) -and ($LASTEXITCODE -ne 0)) { exit $LASTEXITCODE } + } + finally { + if ($workingDirectory) { + Pop-Location + } + } +} + +$remoteBranch = & $PSScriptRoot\..\azure-pipelines\Get-LibTemplateBasis.ps1 -ErrorIfNotRelated +if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE +} + +$LibTemplateUrl = 'https://github.com/aarnott/Library.Template' +Spawn-Tool 'git' ('fetch', $LibTemplateUrl, $remoteBranch) +$SourceCommit = Spawn-Tool 'git' ('rev-parse', 'FETCH_HEAD') +$BaseBranch = Spawn-Tool 'git' ('branch', '--show-current') +$SourceCommitUrl = "$LibTemplateUrl/commit/$SourceCommit" + +# To reduce the odds of merge conflicts at this stage, we always move HEAD to the last successful merge. +$basis = Spawn-Tool 'git' ('rev-parse', 'HEAD') # TODO: consider improving this later + +Write-Host "Merging the $remoteBranch branch of Library.Template ($SourceCommit) into local repo $basis" -ForegroundColor Green + +Spawn-Tool 'git' ('checkout', '-b', $LocalBranch, $basis) $null $true +if ($LASTEXITCODE -eq 128) { + Spawn-Tool 'git' ('checkout', $LocalBranch) + Spawn-Tool 'git' ('merge', $basis) +} + +Spawn-Tool 'git' ('merge', 'FETCH_HEAD', '--no-ff', '-m', "Merge the $remoteBranch branch from $LibTemplateUrl`n`nSpecifically, this merges [$SourceCommit from that repo]($SourceCommitUrl).") +if ($LASTEXITCODE -eq 1) { + Write-Error "Merge conflict detected. Manual resolution required." + exit 1 +} +elseif ($LASTEXITCODE -ne 0) { + Write-Error "Merge failed with exit code $LASTEXITCODE." + exit $LASTEXITCODE +} + +$result = New-Object PSObject -Property @{ + BaseBranch = $BaseBranch # The original branch that was checked out when the script ran. + LocalBranch = $LocalBranch # The name of the local branch that was created before the merge. + SourceCommit = $SourceCommit # The commit from Library.Template that was merged in. + SourceBranch = $remoteBranch # The branch from Library.Template that was merged in. +} + +Write-Host $result +Write-Output $result diff --git a/tools/Set-EnvVars.ps1 b/tools/Set-EnvVars.ps1 new file mode 100644 index 00000000..3f6f86ba --- /dev/null +++ b/tools/Set-EnvVars.ps1 @@ -0,0 +1,97 @@ +<# +.SYNOPSIS + Set environment variables in the environment. + Azure Pipeline and CMD environments are considered. +.PARAMETER Variables + A hashtable of variables to be set. +.PARAMETER PrependPath + A set of paths to prepend to the PATH environment variable. +.OUTPUTS + A boolean indicating whether the environment variables can be expected to propagate to the caller's environment. +.DESCRIPTION + The CmdEnvScriptPath environment variable may be optionally set to a path to a cmd shell script to be created (or appended to if it already exists) that will set the environment variables in cmd.exe that are set within the PowerShell environment. + This is used by init.cmd in order to reapply any new environment variables to the parent cmd.exe process that were set in the powershell child process. +#> +[CmdletBinding(SupportsShouldProcess=$true)] +Param( + [Parameter(Mandatory=$true, Position=1)] + $Variables, + [string[]]$PrependPath +) + +if ($Variables.Count -eq 0) { + return $true +} + +$cmdInstructions = !$env:TF_BUILD -and !$env:GITHUB_ACTIONS -and !$env:CmdEnvScriptPath -and ($env:PS1UnderCmd -eq '1') +if ($cmdInstructions) { + Write-Warning "Environment variables have been set that will be lost because you're running under cmd.exe" + Write-Host "Environment variables that must be set manually:" -ForegroundColor Blue +} else { + Write-Host "Environment variables set:" -ForegroundColor Blue + Write-Host ($Variables | Out-String) + if ($PrependPath) { + Write-Host "Paths prepended to PATH: $PrependPath" + } +} + +if ($env:TF_BUILD) { + Write-Host "Azure Pipelines detected. Logging commands will be used to propagate environment variables and prepend path." +} + +if ($env:GITHUB_ACTIONS) { + Write-Host "GitHub Actions detected. Logging commands will be used to propagate environment variables and prepend path." +} + +$CmdEnvScript = '' +$Variables.GetEnumerator() |% { + Set-Item -Path env:$($_.Key) -Value $_.Value + + # If we're running in a cloud CI, set these environment variables so they propagate. + if ($env:TF_BUILD) { + Write-Host "##vso[task.setvariable variable=$($_.Key);]$($_.Value)" + } + if ($env:GITHUB_ACTIONS) { + Add-Content -Path $env:GITHUB_ENV -Value "$($_.Key)=$($_.Value)" + } + + if ($cmdInstructions) { + Write-Host "SET $($_.Key)=$($_.Value)" + } + + $CmdEnvScript += "SET $($_.Key)=$($_.Value)`r`n" +} + +$pathDelimiter = ';' +if ($IsMacOS -or $IsLinux) { + $pathDelimiter = ':' +} + +if ($PrependPath) { + $PrependPath |% { + $newPathValue = "$_$pathDelimiter$env:PATH" + Set-Item -Path env:PATH -Value $newPathValue + if ($cmdInstructions) { + Write-Host "SET PATH=$newPathValue" + } + + if ($env:TF_BUILD) { + Write-Host "##vso[task.prependpath]$_" + } + if ($env:GITHUB_ACTIONS) { + Add-Content -Path $env:GITHUB_PATH -Value $_ + } + + $CmdEnvScript += "SET PATH=$_$pathDelimiter%PATH%" + } +} + +if ($env:CmdEnvScriptPath) { + if (Test-Path $env:CmdEnvScriptPath) { + $CmdEnvScript = (Get-Content -Path $env:CmdEnvScriptPath) + $CmdEnvScript + } + + Set-Content -Path $env:CmdEnvScriptPath -Value $CmdEnvScript +} + +return !$cmdInstructions From 6b1a06d316613fd0b95c1503c5eeb804035ca34c Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Thu, 14 Nov 2024 11:50:50 -0800 Subject: [PATCH 863/889] builds are working, not tested on pipelines --- Directory.Packages.props | 8 +++++ src/AssemblyInfo.cs | 2 +- .../BaseTest.cs | 2 +- .../BuildTests/ConfigTransformTestsBase.cs | 24 ++++++++++----- .../BuildTests/ConsoleAppTests.cs | 2 +- .../TestProjects/WebApplication/Web.config | 20 ++++++++----- .../WebApplication/WebApplication.csproj | 10 +++++++ .../BuildTests/WebAppTests.cs | 2 +- ...soft.VisualStudio.SlowCheetah.Tests.csproj | 30 +++++++++---------- .../TestUtilities.cs | 2 +- .../TransformTest.cs | 2 +- ...t.VisualStudio.SlowCheetah.VS.Tests.csproj | 22 +++++--------- ...crosoft.VisualStudio.SlowCheetah.VS.csproj | 25 +++++++++------- ...osoft.VisualStudio.SlowCheetah.Vsix.csproj | 20 ++++++------- .../Build/TransformTask.cs | 2 +- .../Exceptions/TransformFailedException.cs | 2 +- .../Logging/ITransformationLogger.cs | 8 ++--- .../Logging/JsonShimLogger.cs | 2 +- .../Logging/TransformationTaskLogger.cs | 2 +- .../Logging/XmlShimLogger.cs | 2 +- .../Microsoft.VisualStudio.SlowCheetah.csproj | 12 ++++---- .../Properties/AssemblyInfo.cs | 2 +- .../Transformer/ITransformer.cs | 2 +- .../Transformer/JsonTransformer.cs | 2 +- .../Transformer/TransformUtilities.cs | 2 +- .../Transformer/TransformerFactory.cs | 2 +- .../Transformer/XmlTransformer.cs | 2 +- src/SlowCheetah.sln | 5 ++-- src/stylecop.json => stylecop.json | 0 29 files changed, 122 insertions(+), 96 deletions(-) rename src/stylecop.json => stylecop.json (100%) diff --git a/Directory.Packages.props b/Directory.Packages.props index 2d15bd1c..309a3a64 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -12,6 +12,13 @@ + + + + + + + @@ -20,5 +27,6 @@ + diff --git a/src/AssemblyInfo.cs b/src/AssemblyInfo.cs index 9731a830..6aee887e 100644 --- a/src/AssemblyInfo.cs +++ b/src/AssemblyInfo.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. using System.Runtime.InteropServices; diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BaseTest.cs b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BaseTest.cs index 73b05ec8..b5b5ff29 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BaseTest.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BaseTest.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs index e35e2ffe..2b07cf12 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line @@ -25,7 +25,7 @@ public abstract class ConfigTransformTestsBase : IDisposable /// public string SolutionDir { - get { return Path.Combine(Environment.CurrentDirectory, @"..\..\..\src"); } + get { return Path.Combine(Environment.CurrentDirectory, @"..\..\..\..\src"); } } /// @@ -80,15 +80,23 @@ public void BuildProject(string projectName) { FileName = msbuildPath, Arguments = $"{projectPath} {properties}", - CreateNoWindow = true, - WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden, + CreateNoWindow = false, + WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized, }; - using (var process = System.Diagnostics.Process.Start(startInfo)) + try { - process.WaitForExit(); - Assert.Equal(0, process.ExitCode); - process.Close(); + + using (var process = System.Diagnostics.Process.Start(startInfo)) + { + process.WaitForExit(); + Assert.Equal(0, process.ExitCode); + process.Close(); + } + } + catch(Exception ex) + { + throw new Exception($"Error running msbuild: {ex.Message}", ex); } } diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConsoleAppTests.cs b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConsoleAppTests.cs index 92610027..3ce3bfe8 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConsoleAppTests.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConsoleAppTests.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.config b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.config index 37e083c5..31de11e4 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.config +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.config @@ -1,21 +1,25 @@ - + + - - + + - + \ No newline at end of file diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/WebApplication.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/WebApplication.csproj index e1ab618c..85ecd30e 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/WebApplication.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/WebApplication.csproj @@ -21,6 +21,7 @@ + True true @@ -58,6 +59,15 @@ + + + + + + + + + true diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/WebAppTests.cs b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/WebAppTests.cs index b2baef5e..431364e4 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/WebAppTests.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/WebAppTests.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj index 093b52e7..27a469af 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj @@ -12,21 +12,21 @@ - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + + + + + + + + + diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/TestUtilities.cs b/src/Microsoft.VisualStudio.SlowCheetah.Tests/TestUtilities.cs index dbb76dea..9445c7a6 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/TestUtilities.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/TestUtilities.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/TransformTest.cs b/src/Microsoft.VisualStudio.SlowCheetah.Tests/TransformTest.cs index 85f88239..9ba19a01 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/TransformTest.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/TransformTest.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj b/src/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj index 43b54b10..ae9cea57 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj @@ -6,21 +6,13 @@ - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + + + + diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj index 27f99893..f0b8c1be 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj @@ -1,27 +1,32 @@  - + Library net472 false Copyright © Microsoft Corporation. All rights reserved. false + 10.0 - + + + + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - + + + + + + diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj index 196ef619..2b3c34ae 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj @@ -31,7 +31,7 @@ false false false - $(OutputPath)net472\ + $(BaseOutputPath)$(Configuration)\net472\ Microsoft.VisualStudio.SlowCheetah @@ -79,15 +79,15 @@ - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + + + + + + + + diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Build/TransformTask.cs b/src/Microsoft.VisualStudio.SlowCheetah/Build/TransformTask.cs index b57ad92e..c36840fa 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Build/TransformTask.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Build/TransformTask.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Exceptions/TransformFailedException.cs b/src/Microsoft.VisualStudio.SlowCheetah/Exceptions/TransformFailedException.cs index de398fa3..88e1f0b1 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Exceptions/TransformFailedException.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Exceptions/TransformFailedException.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Logging/ITransformationLogger.cs b/src/Microsoft.VisualStudio.SlowCheetah/Logging/ITransformationLogger.cs index 24d4bd36..1e734602 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Logging/ITransformationLogger.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Logging/ITransformationLogger.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { @@ -11,7 +11,7 @@ namespace Microsoft.VisualStudio.SlowCheetah public enum LogMessageImportance { /// - /// High importace. Prioritize + /// High importace. Prioritize. /// High = 2, @@ -21,9 +21,9 @@ public enum LogMessageImportance Normal = 1, /// - /// Low Importance. Do not show if unnecessary + /// Low Importance. Do not show if unnecessary. /// - Low = 0 + Low = 0, } /// diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Logging/JsonShimLogger.cs b/src/Microsoft.VisualStudio.SlowCheetah/Logging/JsonShimLogger.cs index d91079e8..4b93f0da 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Logging/JsonShimLogger.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Logging/JsonShimLogger.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Logging/TransformationTaskLogger.cs b/src/Microsoft.VisualStudio.SlowCheetah/Logging/TransformationTaskLogger.cs index 09a8e17f..32d2ad4a 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Logging/TransformationTaskLogger.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Logging/TransformationTaskLogger.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Logging/XmlShimLogger.cs b/src/Microsoft.VisualStudio.SlowCheetah/Logging/XmlShimLogger.cs index 4de28888..4e1718bc 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Logging/XmlShimLogger.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Logging/XmlShimLogger.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj b/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj index 386f7a60..a6136bff 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj @@ -11,7 +11,6 @@ SlowCheetah slow cheetah XML JSON Transform XDT JDT web.config app.config https://aka.ms/VsExtensibilityIcon true - https://raw.githubusercontent.com/Microsoft/slow-cheetah/main/LICENSE https://github.com/Microsoft/slow-cheetah https://github.com/Microsoft/slow-cheetah True @@ -19,6 +18,7 @@ true 2.8 + @@ -27,18 +27,16 @@ + - - - - - - + + + diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Properties/AssemblyInfo.cs b/src/Microsoft.VisualStudio.SlowCheetah/Properties/AssemblyInfo.cs index be9d63d6..95be5ffa 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Properties/AssemblyInfo.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Properties/AssemblyInfo.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. using System.Resources; diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/ITransformer.cs b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/ITransformer.cs index 26536cba..31d41a3c 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/ITransformer.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/ITransformer.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/JsonTransformer.cs b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/JsonTransformer.cs index 0e703b2a..a9a599cb 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/JsonTransformer.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/JsonTransformer.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformUtilities.cs b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformUtilities.cs index 6bcf4a9a..c33d24cc 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformUtilities.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformUtilities.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformerFactory.cs b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformerFactory.cs index cded4f22..31222f25 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformerFactory.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformerFactory.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/XmlTransformer.cs b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/XmlTransformer.cs index fd13bde7..f6817feb 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/XmlTransformer.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/XmlTransformer.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/SlowCheetah.sln b/src/SlowCheetah.sln index ef6eb1ad..0c60feca 100644 --- a/src/SlowCheetah.sln +++ b/src/SlowCheetah.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26430.6 +# Visual Studio Version 17 +VisualStudioVersion = 17.13.35505.181 main MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.SlowCheetah", "Microsoft.VisualStudio.SlowCheetah\Microsoft.VisualStudio.SlowCheetah.csproj", "{6354D859-E629-49FC-B154-FC0BA42D71B0}" EndProject @@ -9,6 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Slow EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{16014DDD-6525-48EF-9D6A-E1067594E1E8}" ProjectSection(SolutionItems) = preProject + ..\Directory.Packages.props = ..\Directory.Packages.props stylecop.json = stylecop.json ..\version.json = ..\version.json EndProjectSection diff --git a/src/stylecop.json b/stylecop.json similarity index 100% rename from src/stylecop.json rename to stylecop.json From 6405fc33a1fd6a3116665704337dc89401ff7048 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Thu, 14 Nov 2024 13:08:38 -0800 Subject: [PATCH 864/889] update tsa options --- azure-pipelines/TSAOptions.json | 15 +++++++++------ azure-pipelines/official.yml | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/azure-pipelines/TSAOptions.json b/azure-pipelines/TSAOptions.json index 6dfeac4c..a781ebb6 100644 --- a/azure-pipelines/TSAOptions.json +++ b/azure-pipelines/TSAOptions.json @@ -1,19 +1,22 @@ { "tsaVersion": "TsaV2", "codebase": "NewOrUpdate", - "codebaseName": "LibraryName", + "codebaseName": "SlowCheetah", "tsaStamp": "DevDiv", "tsaEnvironment": "PROD", "notificationAliases": [ - "vsidemicrobuild@microsoft.com" + "vsslnx@microsoft.com" ], "codebaseAdmins": [ - "REDMOND\\andarno" + "REDMOND\\tevinstanley" ], "instanceUrl": "https://devdiv.visualstudio.com", "projectName": "DevDiv", - "areaPath": "DevDiv\\VS Core", + "areaPath": "DevDiv\\VS Core\\Project\\SlowCheetah", "iterationPath": "DevDiv", - "alltools": true, - "repositoryName": "Library.Template" + "tools": [ + "APIScan", + "CodeQL" + ], + "repositoryName": "SlowCheetah" } diff --git a/azure-pipelines/official.yml b/azure-pipelines/official.yml index e01575fa..b00e73db 100644 --- a/azure-pipelines/official.yml +++ b/azure-pipelines/official.yml @@ -42,7 +42,7 @@ parameters: - name: EnableAPIScan displayName: Include APIScan with compliance tools type: boolean - default: false # enable in individual repos only AFTER updating TSAOptions.json with your own values + default: true # enable in individual repos only AFTER updating TSAOptions.json with your own values resources: repositories: From 6527ad0d945f2dc8a30f7b4336febc91aff9c5be Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Tue, 26 Nov 2024 13:26:52 -0800 Subject: [PATCH 865/889] updated to help more build runs --- Directory.Packages.props | 9 +- Expand-Template.ps1 | 216 ------------------ azure-pipelines/build.yml | 4 +- azure-pipelines/dotnet-test-cloud.ps1 | 2 +- azure-pipelines/dotnet.yml | 2 +- init.ps1 | 2 +- ...soft.VisualStudio.SlowCheetah.Tests.csproj | 4 +- ...crosoft.VisualStudio.SlowCheetah.VS.csproj | 11 +- ...osoft.VisualStudio.SlowCheetah.Vsix.csproj | 2 +- 9 files changed, 19 insertions(+), 233 deletions(-) delete mode 100755 Expand-Template.ps1 diff --git a/Directory.Packages.props b/Directory.Packages.props index 309a3a64..94108d12 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,20 +4,21 @@ true true - 2.0.171 + + - - + + @@ -29,4 +30,4 @@ - + \ No newline at end of file diff --git a/Expand-Template.ps1 b/Expand-Template.ps1 deleted file mode 100755 index 4192f8cf..00000000 --- a/Expand-Template.ps1 +++ /dev/null @@ -1,216 +0,0 @@ -#!/usr/bin/env pwsh - -<# -.SYNOPSIS -Expands this template into an actual project, taking values for placeholders -.PARAMETER LibraryName -The name of the library. Should consist only of alphanumeric characters and periods. -.PARAMETER Author -The name to use in copyright and owner notices. -.PARAMETER CodeCovToken -A token obtained from codecov.io for your repo. If not specified, code coverage results will not be published to codecov.io, -but can be added later by editing the Azure Pipelines YAML file. -.PARAMETER Squash -A switch that causes all of git history to be squashed to just one initial commit for the template, and one for its expansion. -#> -[CmdletBinding(SupportsShouldProcess, ConfirmImpact='Medium')] -Param( - [Parameter(Mandatory=$true)] - [string]$LibraryName, - [Parameter()] - [string]$Author = "Microsoft Corporation", - [Parameter()] - [string]$CodeCovToken, - [Parameter()] - [switch]$Squash -) - -function Replace-Placeholders { - [CmdletBinding()] - param( - [Parameter(Mandatory=$true)] - [string]$Path, - [Parameter(Mandatory=$true)] - $Replacements - ) - - $Path = Resolve-Path $Path - Write-Host "Replacing tokens in `"$Path`"" - $content = Get-Content -Encoding UTF8 -Path $Path | Out-String - $Replacements.GetEnumerator() |% { - $modifiedContent = $content -replace $_.Key,$_.Value - if ($modifiedContent -eq $content) { - Write-Error "No $($_.Key) token found to replace." - } - $content = $modifiedContent - } - $content = $content.TrimEnd(("`r","`n")) - [System.IO.File]::WriteAllLines($Path, $content) # Don't use Set-Content because that adds a UTF8 BOM - git add $Path -} - -# Try to find sn.exe if it isn't on the PATH -$sn = Get-Command sn -ErrorAction SilentlyContinue -if (-not $sn) { - if ($IsMacOS -or $IsLinux) { - Write-Error "sn command not found on PATH. Install mono and/or vote up this issue: https://github.com/dotnet/sdk/issues/13560" - exit(1) - } - $snExes = Get-ChildItem -Recurse "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\sn.exe" - if ($snExes) { - $sn = Get-Command $snExes[0].FullName - } else { - Write-Error "sn command not found on PATH and SDK could not be found." - exit(1) - } -} - -if (-not (& "$PSScriptRoot\tools\Check-DotNetSdk.ps1")) { - if ($PSCmdlet.ShouldProcess('Install .NET Core SDK?')) { - & "$PSScriptRoot\tools\Install-DotNetSdk.ps1" - } else { - Write-Error "Matching .NET Core SDK version not found. Install now?" - exit 1 - } -} - -# Verify all commands we use are on the PATH -('git','dotnet') |% { - if (-not (Get-Command $_ -ErrorAction SilentlyContinue)) { - Write-Error "$_ command not found on PATH." - exit(1) - } -} - -Push-Location $PSScriptRoot -try { - if ($Squash) { - $originalCommitId = git rev-parse HEAD - git reset --soft $(git rev-list --max-parents=0 HEAD) - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - git commit --amend -qm "Initial template from https://github.com/AArnott/Library.Template" -m "Original commit from template $originalCommitId" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - } - - git config core.safecrlf false # Avoid warnings when adding files with mangled line endings - - # Rename project directories and solution - git mv Library.sln "$LibraryName.sln" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - git mv src/Library/Library.csproj "src/Library/$LibraryName.csproj" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - git mv src/Library "src/$LibraryName" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - git mv test/Library.Tests/Library.Tests.csproj "test/Library.Tests/$LibraryName.Tests.csproj" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - git mv test/Library.Tests "test/$LibraryName.Tests" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - git mv src/VSInsertionMetadata/Library.VSInsertionMetadata.proj "src/VSInsertionMetadata/$LibraryName.VSInsertionMetadata.proj" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - - # Refresh solution file both to update paths and give the projects unique GUIDs - dotnet sln remove src/Library/Library.csproj - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - dotnet sln remove test/Library.Tests/Library.Tests.csproj - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - dotnet sln add "src/$LibraryName" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - dotnet sln add "test/$LibraryName.Tests" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - git add "$LibraryName.sln" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - - # Update project reference in test project. Add before removal to keep the same ItemGroup in place. - dotnet add "test/$LibraryName.Tests" reference "src/$LibraryName" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - dotnet remove "test/$LibraryName.Tests" reference src/Library/Library.csproj - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - git add "test/$LibraryName.Tests/$LibraryName.Tests.csproj" - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - - # Replace placeholders in source files - Replace-Placeholders -Path "src/$LibraryName/Calculator.cs" -Replacements @{ - 'Library'=$LibraryName - } - Replace-Placeholders -Path "test/$LibraryName.Tests/CalculatorTests.cs" -Replacements @{ - 'Library'=$LibraryName - } - Replace-Placeholders -Path "README.md" -Replacements @{ - "(?m)^.*\[NuGet package\][^`r`n]*"="[![NuGet package](https://img.shields.io/nuget/v/$LibraryName.svg)](https://nuget.org/packages/$LibraryName)" - "(?m)^.*\[Azure Pipelines status\].*`r?`n"="" - "(?m)^.*\[GitHub Actions status\].*`r?`n"="" - "(?m)^.*\[codecov\].*`r?`n"="" - } - - # Specially handle azure-pipelines .yml edits - Replace-Placeholders -Path "azure-pipelines/build.yml" -Replacements @{ - "(?m).*expand-template\.yml(?:\r)?\n" = "" - } - - $YmlReplacements = @{ - "(?m)^\s+- microbuild`r?`n"="" - } - Replace-Placeholders -Path "azure-pipelines\official.yml" -Replacements $YmlReplacements - Replace-Placeholders -Path "azure-pipelines.yml" -Replacements $YmlReplacements - - $YmlReplacements = @{} - if ($CodeCovToken) { - $YmlReplacements['(codecov_token: ).*(#.*)'] = "`$1$CodeCovToken" - } else { - $YmlReplacements['(codecov_token: ).*(#.*)'] = "#`$1`$2" - } - Replace-Placeholders -Path "azure-pipelines/BuildStageVariables.yml" -Replacements $YmlReplacements - - Replace-Placeholders -Path "azure-pipelines/variables/InsertVersionsValues.ps1" -Replacements @{ - 'LibraryName' = $LibraryName; - 'LibraryNoDots' = $LibraryName.Replace('.',''); - } - - Replace-Placeholders -Path "azure-pipelines/variables/InsertJsonValues.ps1" -Replacements @{ - 'LibraryName' = $LibraryName; - } - - Replace-Placeholders -Path "azure-pipelines/variables/SymbolsFeatureName.ps1" -Replacements @{ - 'LibraryName' = $LibraryName; - } - - Replace-Placeholders -Path "azure-pipelines/OptProf.yml" -Replacements @{ - 'LibraryName' = $LibraryName; - } - Replace-Placeholders -Path "azure-pipelines/OptProf_part2.yml" -Replacements @{ - 'LibraryName' = $LibraryName; - } - - # Self destruct - git rm Expand-Template.* Apply-Template.ps1 - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - git rm :/azure-pipelines/expand-template.yml - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - - # Self-integrity check - Get-ChildItem -Recurse -File -Exclude bin,obj,README.md,Expand-Template.* |? { -not $_.FullName.Contains("obj") } |% { - $PLACEHOLDERS = Get-Content -Path $_.FullName |? { $_.Contains('PLACEHOLDER') } - if ($PLACEHOLDERS) { - Write-Error "PLACEHOLDER discovered in $($_.FullName)" - } - } - - # Commit the changes - git commit -qm "Expanded template for $LibraryName" -m "This expansion done by the (now removed) Expand-Template.ps1 script." - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - - Write-Host -ForegroundColor Green "Template successfully expanded." - - if ($env:PS1UnderCmd) { - # We're running under the Expand-Template.cmd script. - # Since we just deleted it from disk cmd.exe will complain. Just advise the user it's OK. - Write-Host -ForegroundColor Green 'Disregard an error you may see: "The batch file cannot be found." We just cleaned up after ourselves.' - } - -} finally { - git config --local --unset core.safecrlf - Pop-Location -} - -# When testing this script, all the changes can be quickly reverted with this command: -# git reset HEAD :/README.md :/LICENSE :/azure-pipelines.yml :/src :/test :/azure-pipelines; git co -- :/README.md :/LICENSE :/azure-pipelines.yml :/src :/azure-pipelines; git clean -fd :/src :/test diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index e9fb6248..ded585ac 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -42,10 +42,10 @@ parameters: # Callers (e.g. Official.yml) *may* expose these parameters at queue-time in order to turn OFF optional agents. - name: EnableLinuxBuild type: boolean - default: true + default: false - name: EnableMacOSBuild type: boolean - default: true + default: false ##### 👆🏼 You MAY change the defaults above. ##### 👇🏼 You should NOT change the defaults below. diff --git a/azure-pipelines/dotnet-test-cloud.ps1 b/azure-pipelines/dotnet-test-cloud.ps1 index 24bf812a..3c524734 100644 --- a/azure-pipelines/dotnet-test-cloud.ps1 +++ b/azure-pipelines/dotnet-test-cloud.ps1 @@ -44,7 +44,7 @@ if ($x86) { } } -& $dotnet test $RepoRoot ` +& $dotnet test "$RepoRoot\src" ` --no-build ` -c $Configuration ` --filter "TestCategory!=FailsInCloudTest" ` diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index f48dd906..638170d1 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -8,7 +8,7 @@ parameters: steps: -- script: dotnet build -t:build,pack --no-restore -c $(BuildConfiguration) -warnAsError -warnNotAsError:NU1901,NU1902,NU1903,NU1904 /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" +- script: dotnet build src -t:build,pack --no-restore -c $(BuildConfiguration) /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" displayName: 🛠 dotnet build - ${{ if not(parameters.IsOptProf) }}: diff --git a/init.ps1 b/init.ps1 index 69aef8fc..5a31bea7 100644 --- a/init.ps1 +++ b/init.ps1 @@ -113,7 +113,7 @@ try { if (!$NoRestore -and $PSCmdlet.ShouldProcess("NuGet packages", "Restore")) { Write-Host "Restoring NuGet packages" -ForegroundColor $HeaderColor - dotnet restore @RestoreArguments + dotnet restore @RestoreArguments src if ($lastexitcode -ne 0) { throw "Failure while restoring packages." } diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj index 27a469af..6bdfa3fc 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj @@ -25,8 +25,8 @@ - - + + diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj index f0b8c1be..e9b56aff 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj @@ -7,6 +7,7 @@ Copyright © Microsoft Corporation. All rights reserved. false 10.0 + true @@ -15,9 +16,8 @@ - - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -25,8 +25,9 @@ - - + + + diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj index 2b3c34ae..cad1107e 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj @@ -100,7 +100,7 @@ - + From 5828b9a599ce95b9f8a5c72883378adaeb7ac6de Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Wed, 27 Nov 2024 13:15:36 -0800 Subject: [PATCH 866/889] test to see if tests pass now --- .../Microsoft.VisualStudio.SlowCheetah.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj index 6bdfa3fc..27a469af 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj @@ -25,8 +25,8 @@ - - + + From 973f382a5acced0cc6b6785ae18fbbe6e90f98ff Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Mon, 2 Dec 2024 10:54:02 -0800 Subject: [PATCH 867/889] changing some of the msbuild location stuff to work with dotnet test --- Directory.Packages.props | 2 +- .../BuildTests/ConfigTransformTestsBase.cs | 19 ++++++++++++++++++- ...soft.VisualStudio.SlowCheetah.Tests.csproj | 5 +++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 94108d12..f25f97b3 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -19,7 +19,7 @@ - + diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs index 2b07cf12..eb6a137d 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs @@ -13,6 +13,7 @@ namespace Microsoft.VisualStudio.SlowCheetah.Tests.BuildTests using System.IO; using System.Linq; using System.Xml.Linq; + using Microsoft.Build.Utilities; using Xunit; /// @@ -69,11 +70,13 @@ public void BuildProject(string projectName) { "OutputPath", this.OutputPath }, }; + var msbuildPath = ToolLocationHelper.GetPathToBuildToolsFile("msbuild.exe", ToolLocationHelper.CurrentToolsVersion); + // We use an external process to run msbuild, because XUnit test discovery breaks // when using . // MSBuild NuGet packages proved to be difficult in getting in-proc test builds to run. string projectPath = Path.Combine(this.TestProjectsDir, projectName, projectName + ".csproj"); - string msbuildPath = MSBuildExePath; + //string msbuildPath = MSBuildExePath; string properties = "/p:" + string.Join(",", globalProperties.Select(x => $"{x.Key}={x.Value}")); var startInfo = new System.Diagnostics.ProcessStartInfo() @@ -84,11 +87,25 @@ public void BuildProject(string projectName) WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized, }; + string path = "C:\\src\\libtempslowcheetah\\src\\Microsoft.VisualStudio.SlowCheetah.Tests\\example.txt"; + + // Open the file for reading + using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Write)) + { + // Read from the file + using (StreamWriter writer = new StreamWriter(fs)) + { + writer.WriteLine($"Running msbuild.exe {startInfo.Arguments}"); + writer.WriteLine($"Running msbuild.exe filename {startInfo.FileName}"); + } + } + try { using (var process = System.Diagnostics.Process.Start(startInfo)) { + process.WaitForExit(); Assert.Equal(0, process.ExitCode); process.Close(); diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj index 27a469af..75cc3766 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj @@ -21,12 +21,13 @@ --> + - - + + From 2142235eb92c0d1542a21187842f5f65a89606c5 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Mon, 2 Dec 2024 11:07:25 -0800 Subject: [PATCH 868/889] removing testing code so that I can see how it performs in cloud --- .../BuildTests/ConfigTransformTestsBase.cs | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs index eb6a137d..ec35cc88 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs @@ -84,21 +84,22 @@ public void BuildProject(string projectName) FileName = msbuildPath, Arguments = $"{projectPath} {properties}", CreateNoWindow = false, - WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized, + WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden, }; - string path = "C:\\src\\libtempslowcheetah\\src\\Microsoft.VisualStudio.SlowCheetah.Tests\\example.txt"; - - // Open the file for reading - using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Write)) - { - // Read from the file - using (StreamWriter writer = new StreamWriter(fs)) - { - writer.WriteLine($"Running msbuild.exe {startInfo.Arguments}"); - writer.WriteLine($"Running msbuild.exe filename {startInfo.FileName}"); - } - } + // Tevin: Delete later + //string path = "C:\\src\\libtempslowcheetah\\src\\Microsoft.VisualStudio.SlowCheetah.Tests\\example.txt"; + + //// Open the file for reading + //using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Write)) + //{ + // // Read from the file + // using (StreamWriter writer = new StreamWriter(fs)) + // { + // writer.WriteLine($"Running msbuild.exe {startInfo.Arguments}"); + // writer.WriteLine($"Running msbuild.exe filename {startInfo.FileName}"); + // } + //} try { From 63d7d7b6f688ad54a1c8f97ff2e06e0895071353 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Mon, 2 Dec 2024 11:37:33 -0800 Subject: [PATCH 869/889] modifing verify code format so that it runs on src --- azure-pipelines/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index ded585ac..2373e8e2 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -194,7 +194,7 @@ jobs: IsOptProf: ${{ parameters.IsOptProf }} - ${{ if and(parameters.EnableDotNetFormatCheck, not(parameters.EnableLinuxBuild)) }}: - - script: dotnet format --verify-no-changes --no-restore + - script: dotnet format --verify-no-changes --no-restore src displayName: 💅 Verify formatted code - ${{ if eq(variables['system.collectionId'], '011b8bdf-6d56-4f87-be0d-0092136884d9') }}: @@ -236,7 +236,7 @@ jobs: Is1ESPT: ${{ parameters.Is1ESPT }} RunTests: ${{ parameters.RunTests }} - ${{ if parameters.EnableDotNetFormatCheck }}: - - script: dotnet format --verify-no-changes --no-restore + - script: dotnet format --verify-no-changes --no-restore src displayName: 💅 Verify formatted code - template: expand-template.yml From f6bbe588dc3dd8fd5552bf8ebd10c426ceab5f8b Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Mon, 2 Dec 2024 11:59:13 -0800 Subject: [PATCH 870/889] remove dotnet format --- azure-pipelines/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index 2373e8e2..c5745fc6 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -21,7 +21,7 @@ parameters: # This is just one of a a few mechanisms to enforce code style consistency. - name: EnableDotNetFormatCheck type: boolean - default: true + default: false # This lists the names of the artifacts that will be published *from every OS build agent*. # Any new azure-pipelines/artifacts/*.ps1 script needs to be added to this list. # If an artifact is only generated or collected on one OS, it should NOT be listed here, From f314e4261b299bc4866e3575cb0854b70d123384 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Mon, 2 Dec 2024 12:25:54 -0800 Subject: [PATCH 871/889] remove references to expand-template.yml since it is not used anymore --- azure-pipelines/build.yml | 4 ---- azure-pipelines/expand-template.yml | 18 ------------------ 2 files changed, 22 deletions(-) delete mode 100644 azure-pipelines/expand-template.yml diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml index c5745fc6..375c422e 100644 --- a/azure-pipelines/build.yml +++ b/azure-pipelines/build.yml @@ -204,8 +204,6 @@ jobs: IsOptProf: ${{ parameters.IsOptProf }} SkipCodesignVerify: ${{ parameters.SkipCodesignVerify }} - - template: expand-template.yml - - ${{ if not(parameters.IsOptProf) }}: - ${{ if parameters.EnableLinuxBuild }}: - job: Linux @@ -238,7 +236,6 @@ jobs: - ${{ if parameters.EnableDotNetFormatCheck }}: - script: dotnet format --verify-no-changes --no-restore src displayName: 💅 Verify formatted code - - template: expand-template.yml - ${{ if parameters.EnableMacOSBuild }}: - job: macOS @@ -268,7 +265,6 @@ jobs: parameters: Is1ESPT: ${{ parameters.Is1ESPT }} RunTests: ${{ parameters.RunTests }} - - template: expand-template.yml - job: WrapUp dependsOn: diff --git a/azure-pipelines/expand-template.yml b/azure-pipelines/expand-template.yml deleted file mode 100644 index 0047e536..00000000 --- a/azure-pipelines/expand-template.yml +++ /dev/null @@ -1,18 +0,0 @@ -steps: -- script: | - dotnet build-server shutdown - git clean -fdx - displayName: 🧹 Cleaning repo for template expansion -- powershell: | - git config user.name "test user" - git config user.email "andrewarnott@gmail.com" - ./Expand-Template.ps1 -LibraryName Calc -Author "Andrew Arnott" - displayName: 🧪 Expanding template - failOnStderr: true -# TODO: Verify that all changes are staged to the git index - -- powershell: .\init.ps1 - displayName: 🔽 Install prereqs and restore packages - -- script: dotnet build - displayName: 🛠 dotnet build (expanded template) From f8994c72d3fe129fea44054d792225a61f93a481 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Mon, 2 Dec 2024 16:19:37 -0800 Subject: [PATCH 872/889] update to not pack newtonsoft into our package, since we don't own it I assume others would just handle whatever version they need. --- .../Microsoft.VisualStudio.SlowCheetah.VS.csproj | 4 ---- .../Microsoft.VisualStudio.SlowCheetah.csproj | 5 +++-- src/SlowCheetah.sln | 6 +++++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj index e9b56aff..dbac61f8 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj @@ -10,10 +10,6 @@ true - - - - diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj b/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj index a6136bff..c1cd793b 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj @@ -19,12 +19,13 @@ 2.8 - + - + + diff --git a/src/SlowCheetah.sln b/src/SlowCheetah.sln index 0c60feca..af5accd5 100644 --- a/src/SlowCheetah.sln +++ b/src/SlowCheetah.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.13.35505.181 main +VisualStudioVersion = 17.13.35505.181 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.SlowCheetah", "Microsoft.VisualStudio.SlowCheetah\Microsoft.VisualStudio.SlowCheetah.csproj", "{6354D859-E629-49FC-B154-FC0BA42D71B0}" EndProject @@ -9,6 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Slow EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{16014DDD-6525-48EF-9D6A-E1067594E1E8}" ProjectSection(SolutionItems) = preProject + ..\Directory.Build.props = ..\Directory.Build.props ..\Directory.Packages.props = ..\Directory.Packages.props stylecop.json = stylecop.json ..\version.json = ..\version.json @@ -94,4 +95,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AD9FD28F-3EAE-4C44-B1B1-E91933777300} + EndGlobalSection EndGlobal From 760d2bb8b811ace25e2bf646ec66584756c54cdf Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Fri, 6 Dec 2024 11:25:33 -0800 Subject: [PATCH 873/889] wip weird thing going on with vsix --- .../Microsoft.VisualStudio.SlowCheetah.Vsix.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj index cad1107e..dd467dff 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj @@ -100,9 +100,9 @@ - + - + From 4f190f0f45243ec90e2316b7bdf1e142f67dd633 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Wed, 11 Dec 2024 12:10:59 -0800 Subject: [PATCH 875/889] saving before I delete assemblyinfo.cs --- global.json | 3 +- .../BuildTests/ConfigTransformTestsBase.cs | 29 ++-- ...soft.VisualStudio.SlowCheetah.Tests.csproj | 4 +- .../example.txt | 2 + ...t.VisualStudio.SlowCheetah.VS.Tests.csproj | 10 ++ src/SlowCheetah.sln | 58 +++---- .../App.config | 6 + .../BaseTest.cs | 82 +++++++++ .../BuildTests/ConfigTransformTestsBase.cs | 158 ++++++++++++++++++ .../BuildTests/ConsoleAppTests.cs | 52 ++++++ .../TestProjects/ConsoleApp/App.Debug.config | 8 + .../ConsoleApp/App.Release.config | 8 + .../TestProjects/ConsoleApp/App.config | 22 +++ .../TestProjects/ConsoleApp/ConsoleApp.csproj | 79 +++++++++ .../ConsoleApp/Other.Debug.config | 6 + .../ConsoleApp/Other.Release.config | 6 + .../TestProjects/ConsoleApp/Other.config | 4 + .../TestProjects/ConsoleApp/Program.cs | 15 ++ .../ConsoleApp/Properties/AssemblyInfo.cs | 36 ++++ .../TestProjects/Directory.Build.props | 1 + .../TestProjects/Directory.Build.targets | 1 + .../WebApplication/Other.Debug.config | 6 + .../WebApplication/Other.Release.config | 6 + .../TestProjects/WebApplication/Other.config | 4 + .../WebApplication/Properties/AssemblyInfo.cs | 35 ++++ .../WebApplication/Web.Debug.config | 30 ++++ .../WebApplication/Web.Release.config | 31 ++++ .../TestProjects/WebApplication/Web.config | 25 +++ .../WebApplication/WebApplication.csproj | 130 ++++++++++++++ .../BuildTests/WebAppTests.cs | 36 ++++ ...soft.VisualStudio.SlowCheetah.Tests.csproj | 63 +++++++ .../TestUtilities.cs | 54 ++++++ .../TransformTest.cs | 42 +++++ .../example.txt | 2 + .../App.config | 6 + ...t.VisualStudio.SlowCheetah.VS.Tests.csproj | 36 ++++ .../PackageUtilitiesTest.cs | 130 ++++++++++++++ test/dirs.proj | 5 + 38 files changed, 1185 insertions(+), 46 deletions(-) create mode 100644 src/Microsoft.VisualStudio.SlowCheetah.Tests/example.txt create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/App.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BaseTest.cs create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConsoleAppTests.cs create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/App.Debug.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/App.Release.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/App.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/ConsoleApp.csproj create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Other.Debug.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Other.Release.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Other.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Program.cs create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Properties/AssemblyInfo.cs create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/Directory.Build.props create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/Directory.Build.targets create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Other.Debug.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Other.Release.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Other.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Properties/AssemblyInfo.cs create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.Debug.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.Release.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/WebApplication.csproj create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/WebAppTests.cs create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/TestUtilities.cs create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/TransformTest.cs create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/example.txt create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/App.config create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj create mode 100644 test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/PackageUtilitiesTest.cs create mode 100644 test/dirs.proj diff --git a/global.json b/global.json index f9835d26..2d466a84 100644 --- a/global.json +++ b/global.json @@ -5,6 +5,7 @@ "allowPrerelease": false }, "msbuild-sdks": { - "Microsoft.Build.NoTargets": "3.7.56" + "Microsoft.Build.NoTargets": "3.7.56", + "Microsoft.Build.Traversal": "3.1.6" } } diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs index ec35cc88..fdec22c5 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs @@ -26,7 +26,7 @@ public abstract class ConfigTransformTestsBase : IDisposable /// public string SolutionDir { - get { return Path.Combine(Environment.CurrentDirectory, @"..\..\..\..\src"); } + get { return Path.Combine(Environment.CurrentDirectory, @"..\..\..\..\test"); } } /// @@ -88,31 +88,30 @@ public void BuildProject(string projectName) }; // Tevin: Delete later - //string path = "C:\\src\\libtempslowcheetah\\src\\Microsoft.VisualStudio.SlowCheetah.Tests\\example.txt"; - - //// Open the file for reading - //using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Write)) - //{ - // // Read from the file - // using (StreamWriter writer = new StreamWriter(fs)) - // { - // writer.WriteLine($"Running msbuild.exe {startInfo.Arguments}"); - // writer.WriteLine($"Running msbuild.exe filename {startInfo.FileName}"); - // } - //} + string path = "C:\\src\\libtempslowcheetah\\test\\Microsoft.VisualStudio.SlowCheetah.Tests\\example.txt"; + + // Open the file for reading + using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Write)) + { + // Read from the file + using (StreamWriter writer = new StreamWriter(fs)) + { + writer.WriteLine($"Running msbuild.exe {startInfo.Arguments}"); + writer.WriteLine($"Running msbuild.exe filename {startInfo.FileName}"); + } + } try { using (var process = System.Diagnostics.Process.Start(startInfo)) { - process.WaitForExit(); Assert.Equal(0, process.ExitCode); process.Close(); } } - catch(Exception ex) + catch (Exception ex) { throw new Exception($"Error running msbuild: {ex.Message}", ex); } diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj index 75cc3766..60b061bc 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj @@ -27,11 +27,11 @@ - + - + diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/example.txt b/src/Microsoft.VisualStudio.SlowCheetah.Tests/example.txt new file mode 100644 index 00000000..9e188f46 --- /dev/null +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/example.txt @@ -0,0 +1,2 @@ +Running msbuild.exe C:\src\libtempslowcheetah\bin\Microsoft.VisualStudio.SlowCheetah.Tests\Debug\net472\..\..\..\..\test\Microsoft.VisualStudio.SlowCheetah.Tests\BuildTests\TestProjects\WebApplication\WebApplication.csproj /p:Configuration=Debug,OutputPath=C:\src\libtempslowcheetah\bin\Microsoft.VisualStudio.SlowCheetah.Tests\Debug\net472\ProjectOutput +Running msbuild.exe filename C:\Program Files\Microsoft Visual Studio\2022\IntPreview\MSBuild\Current\Bin\amd64\msbuild.exe diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj b/src/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj index ae9cea57..df5cc548 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj @@ -9,10 +9,20 @@ + + + + + + diff --git a/src/SlowCheetah.sln b/src/SlowCheetah.sln index af5accd5..a750bfe2 100644 --- a/src/SlowCheetah.sln +++ b/src/SlowCheetah.sln @@ -5,22 +5,24 @@ VisualStudioVersion = 17.13.35505.181 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.SlowCheetah", "Microsoft.VisualStudio.SlowCheetah\Microsoft.VisualStudio.SlowCheetah.csproj", "{6354D859-E629-49FC-B154-FC0BA42D71B0}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.SlowCheetah.Tests", "Microsoft.VisualStudio.SlowCheetah.Tests\Microsoft.VisualStudio.SlowCheetah.Tests.csproj", "{8011779C-108E-46A7-B0E3-BE2DC023BDFE}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{16014DDD-6525-48EF-9D6A-E1067594E1E8}" ProjectSection(SolutionItems) = preProject ..\Directory.Build.props = ..\Directory.Build.props ..\Directory.Packages.props = ..\Directory.Packages.props + Microsoft.VisualStudio.SlowCheetah.Tests\Microsoft.VisualStudio.SlowCheetah.Tests.csproj = Microsoft.VisualStudio.SlowCheetah.Tests\Microsoft.VisualStudio.SlowCheetah.Tests.csproj + ..\test\Microsoft.VisualStudio.SlowCheetah.Tests\Microsoft.VisualStudio.SlowCheetah.Tests.csproj = ..\test\Microsoft.VisualStudio.SlowCheetah.Tests\Microsoft.VisualStudio.SlowCheetah.Tests.csproj stylecop.json = stylecop.json ..\version.json = ..\version.json EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.SlowCheetah.VS.Tests", "Microsoft.VisualStudio.SlowCheetah.VS.Tests\Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj", "{CF485485-48C5-4EEF-A552-7CE8A7A360E8}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.VisualStudio.SlowCheetah.Vsix", "Microsoft.VisualStudio.SlowCheetah.Vsix\Microsoft.VisualStudio.SlowCheetah.Vsix.csproj", "{CD2AF93D-5714-404B-9D42-61477BE8F3CF}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.SlowCheetah.VS", "Microsoft.VisualStudio.SlowCheetah.VS\Microsoft.VisualStudio.SlowCheetah.VS.csproj", "{80A712EE-7B5C-44D3-A2AD-F918B893B6DF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.VisualStudio.SlowCheetah.VS.Tests", "..\test\Microsoft.VisualStudio.SlowCheetah.VS.Tests\Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj", "{7CAC125E-EE65-2E4D-57C6-25E4C869F409}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.VisualStudio.SlowCheetah.Tests", "..\test\Microsoft.VisualStudio.SlowCheetah.Tests\Microsoft.VisualStudio.SlowCheetah.Tests.csproj", "{2CDACD21-BB66-9B22-E564-3E5D0DFADE8F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -43,30 +45,6 @@ Global {6354D859-E629-49FC-B154-FC0BA42D71B0}.Release|x64.Build.0 = Release|Any CPU {6354D859-E629-49FC-B154-FC0BA42D71B0}.Release|x86.ActiveCfg = Release|Any CPU {6354D859-E629-49FC-B154-FC0BA42D71B0}.Release|x86.Build.0 = Release|Any CPU - {8011779C-108E-46A7-B0E3-BE2DC023BDFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8011779C-108E-46A7-B0E3-BE2DC023BDFE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8011779C-108E-46A7-B0E3-BE2DC023BDFE}.Debug|x64.ActiveCfg = Debug|Any CPU - {8011779C-108E-46A7-B0E3-BE2DC023BDFE}.Debug|x64.Build.0 = Debug|Any CPU - {8011779C-108E-46A7-B0E3-BE2DC023BDFE}.Debug|x86.ActiveCfg = Debug|Any CPU - {8011779C-108E-46A7-B0E3-BE2DC023BDFE}.Debug|x86.Build.0 = Debug|Any CPU - {8011779C-108E-46A7-B0E3-BE2DC023BDFE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8011779C-108E-46A7-B0E3-BE2DC023BDFE}.Release|Any CPU.Build.0 = Release|Any CPU - {8011779C-108E-46A7-B0E3-BE2DC023BDFE}.Release|x64.ActiveCfg = Release|Any CPU - {8011779C-108E-46A7-B0E3-BE2DC023BDFE}.Release|x64.Build.0 = Release|Any CPU - {8011779C-108E-46A7-B0E3-BE2DC023BDFE}.Release|x86.ActiveCfg = Release|Any CPU - {8011779C-108E-46A7-B0E3-BE2DC023BDFE}.Release|x86.Build.0 = Release|Any CPU - {CF485485-48C5-4EEF-A552-7CE8A7A360E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CF485485-48C5-4EEF-A552-7CE8A7A360E8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CF485485-48C5-4EEF-A552-7CE8A7A360E8}.Debug|x64.ActiveCfg = Debug|Any CPU - {CF485485-48C5-4EEF-A552-7CE8A7A360E8}.Debug|x64.Build.0 = Debug|Any CPU - {CF485485-48C5-4EEF-A552-7CE8A7A360E8}.Debug|x86.ActiveCfg = Debug|Any CPU - {CF485485-48C5-4EEF-A552-7CE8A7A360E8}.Debug|x86.Build.0 = Debug|Any CPU - {CF485485-48C5-4EEF-A552-7CE8A7A360E8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CF485485-48C5-4EEF-A552-7CE8A7A360E8}.Release|Any CPU.Build.0 = Release|Any CPU - {CF485485-48C5-4EEF-A552-7CE8A7A360E8}.Release|x64.ActiveCfg = Release|Any CPU - {CF485485-48C5-4EEF-A552-7CE8A7A360E8}.Release|x64.Build.0 = Release|Any CPU - {CF485485-48C5-4EEF-A552-7CE8A7A360E8}.Release|x86.ActiveCfg = Release|Any CPU - {CF485485-48C5-4EEF-A552-7CE8A7A360E8}.Release|x86.Build.0 = Release|Any CPU {CD2AF93D-5714-404B-9D42-61477BE8F3CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CD2AF93D-5714-404B-9D42-61477BE8F3CF}.Debug|Any CPU.Build.0 = Debug|Any CPU {CD2AF93D-5714-404B-9D42-61477BE8F3CF}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -91,6 +69,30 @@ Global {80A712EE-7B5C-44D3-A2AD-F918B893B6DF}.Release|x64.Build.0 = Release|Any CPU {80A712EE-7B5C-44D3-A2AD-F918B893B6DF}.Release|x86.ActiveCfg = Release|Any CPU {80A712EE-7B5C-44D3-A2AD-F918B893B6DF}.Release|x86.Build.0 = Release|Any CPU + {7CAC125E-EE65-2E4D-57C6-25E4C869F409}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7CAC125E-EE65-2E4D-57C6-25E4C869F409}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7CAC125E-EE65-2E4D-57C6-25E4C869F409}.Debug|x64.ActiveCfg = Debug|Any CPU + {7CAC125E-EE65-2E4D-57C6-25E4C869F409}.Debug|x64.Build.0 = Debug|Any CPU + {7CAC125E-EE65-2E4D-57C6-25E4C869F409}.Debug|x86.ActiveCfg = Debug|Any CPU + {7CAC125E-EE65-2E4D-57C6-25E4C869F409}.Debug|x86.Build.0 = Debug|Any CPU + {7CAC125E-EE65-2E4D-57C6-25E4C869F409}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7CAC125E-EE65-2E4D-57C6-25E4C869F409}.Release|Any CPU.Build.0 = Release|Any CPU + {7CAC125E-EE65-2E4D-57C6-25E4C869F409}.Release|x64.ActiveCfg = Release|Any CPU + {7CAC125E-EE65-2E4D-57C6-25E4C869F409}.Release|x64.Build.0 = Release|Any CPU + {7CAC125E-EE65-2E4D-57C6-25E4C869F409}.Release|x86.ActiveCfg = Release|Any CPU + {7CAC125E-EE65-2E4D-57C6-25E4C869F409}.Release|x86.Build.0 = Release|Any CPU + {2CDACD21-BB66-9B22-E564-3E5D0DFADE8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2CDACD21-BB66-9B22-E564-3E5D0DFADE8F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2CDACD21-BB66-9B22-E564-3E5D0DFADE8F}.Debug|x64.ActiveCfg = Debug|Any CPU + {2CDACD21-BB66-9B22-E564-3E5D0DFADE8F}.Debug|x64.Build.0 = Debug|Any CPU + {2CDACD21-BB66-9B22-E564-3E5D0DFADE8F}.Debug|x86.ActiveCfg = Debug|Any CPU + {2CDACD21-BB66-9B22-E564-3E5D0DFADE8F}.Debug|x86.Build.0 = Debug|Any CPU + {2CDACD21-BB66-9B22-E564-3E5D0DFADE8F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2CDACD21-BB66-9B22-E564-3E5D0DFADE8F}.Release|Any CPU.Build.0 = Release|Any CPU + {2CDACD21-BB66-9B22-E564-3E5D0DFADE8F}.Release|x64.ActiveCfg = Release|Any CPU + {2CDACD21-BB66-9B22-E564-3E5D0DFADE8F}.Release|x64.Build.0 = Release|Any CPU + {2CDACD21-BB66-9B22-E564-3E5D0DFADE8F}.Release|x86.ActiveCfg = Release|Any CPU + {2CDACD21-BB66-9B22-E564-3E5D0DFADE8F}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/App.config b/test/Microsoft.VisualStudio.SlowCheetah.Tests/App.config new file mode 100644 index 00000000..7a556c88 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BaseTest.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BaseTest.cs new file mode 100644 index 00000000..b5b5ff29 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BaseTest.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. + +#pragma warning disable SA1512 // Single-line comments must not be followed by blank line + +// Copyright (C) Sayed Ibrahim Hashimi +#pragma warning restore SA1512 // Single-line comments must not be followed by blank line + +namespace Microsoft.VisualStudio.SlowCheetah.Tests +{ + using System; + using System.Collections.Generic; + using System.IO; + + /// + /// Class that contains base initialization methods for all the unit tests, such as creating and deleting temporary files. + /// + public class BaseTest : IDisposable + { + /// + /// Gets the list of temporary files to delete after test. + /// + protected IList FilesToDeleteAfterTest { get; } = new List(); + + /// + /// At the end of tests, attempts to delete all the files generated during the test. + /// + public void Dispose() + { + foreach (string filename in this.FilesToDeleteAfterTest) + { + if (File.Exists(filename)) + { + try + { + File.Delete(filename); + } + catch (System.IO.IOException) + { + // some processes will hold onto the file until the AppDomain is unloaded + } + } + } + + this.FilesToDeleteAfterTest.Clear(); + } + + /// + /// Writes a string to a temporary file. + /// + /// Content to be written. + /// The path of the created file. + protected virtual string WriteTextToTempFile(string content) + { + if (string.IsNullOrEmpty(content)) + { + throw new ArgumentNullException(nameof(content)); + } + + string tempFile = this.GetTempFilename(true); + File.WriteAllText(tempFile, content); + return tempFile; + } + + /// + /// Creates a temporary file for testing. + /// + /// If it is ensured that a file with the same name doesn't already exist. + /// The path to the created file. + protected virtual string GetTempFilename(bool ensureFileDoesntExist) + { + string path = Path.GetTempFileName(); + if (ensureFileDoesntExist && File.Exists(path)) + { + File.Delete(path); + } + + this.FilesToDeleteAfterTest.Add(path); + return path; + } + } +} diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs new file mode 100644 index 00000000..fdec22c5 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. + +#pragma warning disable SA1512 // Single-line comments must not be followed by blank line + +// Copyright (C) Sayed Ibrahim Hashimi +#pragma warning restore SA1512 // Single-line comments must not be followed by blank line + +namespace Microsoft.VisualStudio.SlowCheetah.Tests.BuildTests +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Xml.Linq; + using Microsoft.Build.Utilities; + using Xunit; + + /// + /// Base class for transformation tests. + /// + public abstract class ConfigTransformTestsBase : IDisposable + { + /// + /// Gets the test solution directory. + /// + public string SolutionDir + { + get { return Path.Combine(Environment.CurrentDirectory, @"..\..\..\..\test"); } + } + + /// + /// Gets the output path of the test project. + /// + public string OutputPath + { + get { return Path.Combine(Environment.CurrentDirectory, @"ProjectOutput"); } + } + + /// + /// Gets the test projects directory. + /// + public string TestProjectsDir + { + get { return Path.Combine(this.SolutionDir, @"Microsoft.VisualStudio.SlowCheetah.Tests\BuildTests\TestProjects"); } + } + + /// + /// Gets the msbuild exe path that was cached during build. + /// + private static string MSBuildExePath + { + get + { + string msbuildPathCache = Path.Combine(Environment.CurrentDirectory, "msbuildPath.txt"); + return Path.Combine(File.ReadAllLines(msbuildPathCache).First(), "msbuild.exe"); + } + } + + /// + /// Builds the project of the given name from the . + /// + /// Name of the project to be built. + /// Must correspond to a folder name in the test projects directory. + public void BuildProject(string projectName) + { + var globalProperties = new Dictionary() + { + { "Configuration", "Debug" }, + { "OutputPath", this.OutputPath }, + }; + + var msbuildPath = ToolLocationHelper.GetPathToBuildToolsFile("msbuild.exe", ToolLocationHelper.CurrentToolsVersion); + + // We use an external process to run msbuild, because XUnit test discovery breaks + // when using . + // MSBuild NuGet packages proved to be difficult in getting in-proc test builds to run. + string projectPath = Path.Combine(this.TestProjectsDir, projectName, projectName + ".csproj"); + //string msbuildPath = MSBuildExePath; + string properties = "/p:" + string.Join(",", globalProperties.Select(x => $"{x.Key}={x.Value}")); + + var startInfo = new System.Diagnostics.ProcessStartInfo() + { + FileName = msbuildPath, + Arguments = $"{projectPath} {properties}", + CreateNoWindow = false, + WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden, + }; + + // Tevin: Delete later + string path = "C:\\src\\libtempslowcheetah\\test\\Microsoft.VisualStudio.SlowCheetah.Tests\\example.txt"; + + // Open the file for reading + using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Write)) + { + // Read from the file + using (StreamWriter writer = new StreamWriter(fs)) + { + writer.WriteLine($"Running msbuild.exe {startInfo.Arguments}"); + writer.WriteLine($"Running msbuild.exe filename {startInfo.FileName}"); + } + } + + try + { + + using (var process = System.Diagnostics.Process.Start(startInfo)) + { + process.WaitForExit(); + Assert.Equal(0, process.ExitCode); + process.Close(); + } + } + catch (Exception ex) + { + throw new Exception($"Error running msbuild: {ex.Message}", ex); + } + } + + /// + /// Gets a app setting from a configuration file. + /// + /// Path to the configuration file. + /// Setting key. + /// Value of the setting. + public string GetAppSettingValue(string configFilePath, string appSettingKey) + { + var configFile = XDocument.Load(configFilePath); + var testSetting = (from settingEl in configFile.Descendants("appSettings").Elements() + where settingEl.Attribute("key").Value == appSettingKey + select settingEl.Attribute("value").Value).Single(); + return testSetting; + } + + /// + /// Gets the value of a node within a configuration file. + /// + /// Path to the configuration file. + /// Name of the node. + /// Value of the node. + public string GetConfigNodeValue(string configFilePath, string nodeName) + { + var configFile = XDocument.Load(configFilePath); + return configFile.Descendants(nodeName).Single().Value; + } + + /// + /// At the end of tests, delete the output path for the tested projects. + /// + public void Dispose() + { + if (Directory.Exists(this.OutputPath)) + { + Directory.Delete(this.OutputPath, recursive: true); + } + } + } +} diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConsoleAppTests.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConsoleAppTests.cs new file mode 100644 index 00000000..3ce3bfe8 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConsoleAppTests.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. + +#pragma warning disable SA1512 // Single-line comments must not be followed by blank line + +// Copyright (C) Sayed Ibrahim Hashimi +#pragma warning restore SA1512 // Single-line comments must not be followed by blank line + +namespace Microsoft.VisualStudio.SlowCheetah.Tests.BuildTests +{ + using System.IO; + using Xunit; + + /// + /// Tests build time transformations for a test console app. + /// + [Collection("BuildTests")] + public class ConsoleAppTests : ConfigTransformTestsBase + { + /// + /// Tests if app.config is transformed on build. + /// + [Fact] + public void ConsoleApp_AppConfig_IsTransformed() + { + var projectName = "ConsoleApp"; + this.BuildProject(projectName); + + var configFilePath = Path.Combine(this.OutputPath, "ConsoleApp.exe.config"); + + var testSetting = this.GetAppSettingValue(configFilePath, "TestSetting"); + + Assert.Equal("Debug", testSetting); + } + + /// + /// Tests if other.config is transformed on build. + /// + [Fact] + public void ConsoleApp_OtherConfig_IsTransformed() + { + var projectName = "ConsoleApp"; + this.BuildProject(projectName); + + var configFilePath = Path.Combine(this.OutputPath, "Other.config"); + + var testNodeValue = this.GetConfigNodeValue(configFilePath, "TestNode"); + + Assert.Equal("Debug", testNodeValue); + } + } +} diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/App.Debug.config b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/App.Debug.config new file mode 100644 index 00000000..c582ae9a --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/App.Debug.config @@ -0,0 +1,8 @@ + + + + + + + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/App.Release.config b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/App.Release.config new file mode 100644 index 00000000..0d8dd466 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/App.Release.config @@ -0,0 +1,8 @@ + + + + + + + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/App.config b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/App.config new file mode 100644 index 00000000..e6792411 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/App.config @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/ConsoleApp.csproj b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/ConsoleApp.csproj new file mode 100644 index 00000000..2c786ed1 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/ConsoleApp.csproj @@ -0,0 +1,79 @@ + + + + + Debug + AnyCPU + {1C50F6B9-3E9C-48D1-87C3-783763D11A4C} + Exe + ConsoleApp + ConsoleApp + v4.5.2 + 512 + true + win + 9.0 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + True + App.config + + + True + App.config + + + true + + + True + Other.config + + + True + Other.config + + + true + + + + + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Other.Debug.config b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Other.Debug.config new file mode 100644 index 00000000..de6580ee --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Other.Debug.config @@ -0,0 +1,6 @@ + + + + Debug + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Other.Release.config b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Other.Release.config new file mode 100644 index 00000000..b2f90247 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Other.Release.config @@ -0,0 +1,6 @@ + + + + Release + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Other.config b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Other.config new file mode 100644 index 00000000..28eeeac5 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Other.config @@ -0,0 +1,4 @@ + + + default + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Program.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Program.cs new file mode 100644 index 00000000..0c76bf6f --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Program.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApp +{ + class Program + { + static void Main(string[] args) + { + } + } +} diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Properties/AssemblyInfo.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..f8ba6d40 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/ConsoleApp/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ConsoleApp")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ConsoleApp")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1c50f6b9-3e9c-48d1-87c3-783763d11a4c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/Directory.Build.props b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/Directory.Build.props new file mode 100644 index 00000000..42309161 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/Directory.Build.props @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/Directory.Build.targets b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/Directory.Build.targets new file mode 100644 index 00000000..42309161 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/Directory.Build.targets @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Other.Debug.config b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Other.Debug.config new file mode 100644 index 00000000..de6580ee --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Other.Debug.config @@ -0,0 +1,6 @@ + + + + Debug + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Other.Release.config b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Other.Release.config new file mode 100644 index 00000000..b2f90247 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Other.Release.config @@ -0,0 +1,6 @@ + + + + Release + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Other.config b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Other.config new file mode 100644 index 00000000..28eeeac5 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Other.config @@ -0,0 +1,4 @@ + + + default + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Properties/AssemblyInfo.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..3b3de4c8 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WebApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebApplication")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ff416cd8-e3b3-4223-b8fd-e6b3b6720d71")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.Debug.config b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.Debug.config new file mode 100644 index 00000000..ccf59884 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.Release.config b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.Release.config new file mode 100644 index 00000000..9b90a9c2 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.config b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.config new file mode 100644 index 00000000..31de11e4 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Web.config @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/WebApplication.csproj b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/WebApplication.csproj new file mode 100644 index 00000000..8dfe364d --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/WebApplication.csproj @@ -0,0 +1,130 @@ + + + + Debug + AnyCPU + + + 2.0 + {FF416CD8-E3B3-4223-B8FD-E6B3B6720D71} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + WebApplication + WebApplication + v4.5.2 + win + true + + + + + + + + True + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + True + Other.config + + + True + Other.config + + + Web.config + + + Web.config + + + + + + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + + True + True + 57677 + / + http://localhost:56732/ + False + False + + + False + + + + + + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/WebAppTests.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/WebAppTests.cs new file mode 100644 index 00000000..431364e4 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/WebAppTests.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. + +#pragma warning disable SA1512 // Single-line comments must not be followed by blank line + +// Copyright (C) Sayed Ibrahim Hashimi +#pragma warning restore SA1512 // Single-line comments must not be followed by blank line + +namespace Microsoft.VisualStudio.SlowCheetah.Tests.BuildTests +{ + using System.IO; + using Xunit; + + /// + /// Tests build time transformations for a test web app. + /// + [Collection("BuildTests")] + public class WebAppTests : ConfigTransformTestsBase + { + /// + /// Tests if other.config is transformed on build. + /// + [Fact] + public void WebApp_OtherConfig_IsTransformed() + { + var projectName = "WebApplication"; + this.BuildProject(projectName); + + var configFilePath = Path.Combine(this.OutputPath, "Other.config"); + + var testNodeValue = this.GetConfigNodeValue(configFilePath, "TestNode"); + + Assert.Equal("Debug", testNodeValue); + } + } +} diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj b/test/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj new file mode 100644 index 00000000..38a4dca2 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj @@ -0,0 +1,63 @@ + + + + net472 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_CopyTools Include="@(_DependentAssemblies);%(_DependentAssemblies.RelativeDir)Microsoft.Web.XmlTransform.dll" /> + <_CopyTools Include="@(_DependentAssemblies);%(_DependentAssemblies.RelativeDir)Microsoft.VisualStudio.Jdt.dll" /> + <_CopyBuild Include="%(_DependentAssemblies.RelativeDir)Build\Microsoft.VisualStudio.SlowCheetah*.targets" /> + + + + + + + + + <_MSBuildPathLines Include="$(MSBuildToolsPath)" /> + + + + + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/TestUtilities.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/TestUtilities.cs new file mode 100644 index 00000000..9445c7a6 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/TestUtilities.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. + +#pragma warning disable SA1512 // Single-line comments must not be followed by blank line + +// Copyright (C) Sayed Ibrahim Hashimi +#pragma warning restore SA1512 // Single-line comments must not be followed by blank line + +namespace Microsoft.VisualStudio.SlowCheetah.Tests +{ + /// + /// Utilities class for SlowCheetah tests. + /// + public static class TestUtilities + { + /// + /// Example source file for transform testing. + /// + public const string Source01 = + @" + + + + + + "; + + /// + /// Example transform file for transform testing. + /// + public const string Transform01 = + @" + + + + + + "; + + /// + /// Example result file for transform testing. + /// + public const string Result01 = + @" + + + + + + "; + } +} diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/TransformTest.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/TransformTest.cs new file mode 100644 index 00000000..9ba19a01 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/TransformTest.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License license. See LICENSE file in the project root for full license information. + +#pragma warning disable SA1512 // Single-line comments must not be followed by blank line + +// Copyright (C) Sayed Ibrahim Hashimi +#pragma warning restore SA1512 // Single-line comments must not be followed by blank line + +namespace Microsoft.VisualStudio.SlowCheetah.Tests +{ + using System.IO; + using Xunit; + + /// + /// Tests for . + /// + public class TransformTest : BaseTest + { + /// + /// Tests for . + /// + [Fact] + public void TestXmlTransform() + { + string sourceFile = this.WriteTextToTempFile(TestUtilities.Source01); + string transformFile = this.WriteTextToTempFile(TestUtilities.Transform01); + string expectedResultFile = this.WriteTextToTempFile(TestUtilities.Result01); + + string destFile = this.GetTempFilename(true); + ITransformer transformer = new XmlTransformer(); + transformer.Transform(sourceFile, transformFile, destFile); + + Assert.True(File.Exists(sourceFile)); + Assert.True(File.Exists(transformFile)); + Assert.True(File.Exists(destFile)); + + string actualResult = File.ReadAllText(destFile); + string expectedResult = File.ReadAllText(expectedResultFile); + Assert.Equal(expectedResult.Trim(), actualResult.Trim()); + } + } +} diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/example.txt b/test/Microsoft.VisualStudio.SlowCheetah.Tests/example.txt new file mode 100644 index 00000000..9e188f46 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/example.txt @@ -0,0 +1,2 @@ +Running msbuild.exe C:\src\libtempslowcheetah\bin\Microsoft.VisualStudio.SlowCheetah.Tests\Debug\net472\..\..\..\..\test\Microsoft.VisualStudio.SlowCheetah.Tests\BuildTests\TestProjects\WebApplication\WebApplication.csproj /p:Configuration=Debug,OutputPath=C:\src\libtempslowcheetah\bin\Microsoft.VisualStudio.SlowCheetah.Tests\Debug\net472\ProjectOutput +Running msbuild.exe filename C:\Program Files\Microsoft Visual Studio\2022\IntPreview\MSBuild\Current\Bin\amd64\msbuild.exe diff --git a/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/App.config b/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/App.config new file mode 100644 index 00000000..35252b96 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj b/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj new file mode 100644 index 00000000..c25827be --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj @@ -0,0 +1,36 @@ + + + + net472 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/PackageUtilitiesTest.cs b/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/PackageUtilitiesTest.cs new file mode 100644 index 00000000..f21779f2 --- /dev/null +++ b/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/PackageUtilitiesTest.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE file in the project root for full license information. + +namespace Microsoft.VisualStudio.SlowCheetah.VS.Tests +{ + using System.Collections.Generic; + using Xunit; + + /// + /// Test class for . + /// + public class PackageUtilitiesTest + { + private IEnumerable baseTestProjectConfigs = new List(new string[] { "Debug", "Release" }); + private IEnumerable testProjectConfigsWithDots = new List(new string[] { "Debug", "Debug.Test", "Release", "Test.Release", "Test.Rel" }); + + /// + /// Tests returns on arguments that are null or empty strings. + /// + /// Document name. + /// Transform file name. + [Theory] + [InlineData(null, null)] + [InlineData("", "")] + [InlineData("App.config", null)] + [InlineData("App.config", "")] + [InlineData(null, "App.Debug.config")] + [InlineData("", "App.Debug.config")] + public void IsFileTransformWithNullArguments(string docName, string trnName) + { + Assert.False(PackageUtilities.IsFileTransformForBuildConfiguration(docName, trnName, this.baseTestProjectConfigs)); + } + + /// + /// Tests with valid arguments normally found in projects. + /// + /// Document name. + /// Transform file name. + [Theory] + [InlineData("App.config", "App.Debug.config")] + [InlineData("App.config", "app.release.config")] + [InlineData("APP.config", "App.Debug.config")] + [InlineData("App.Test.config", "App.Test.Debug.config")] + public void IsFileTransformWithValidArguments(string docName, string trnName) + { + Assert.True(PackageUtilities.IsFileTransformForBuildConfiguration(docName, trnName, this.baseTestProjectConfigs)); + } + + /// + /// Tests with invalid arguments. + /// + /// Document name. + /// Transform file name. + [Theory] + [InlineData("App.config", "App.Test.Debug.config")] + [InlineData("App.Debug.config", "App.Debug.config")] + [InlineData("App.Debug.config", "App.Release.config")] + public void IsFileTransformWithInvalidArguments(string docName, string trnName) + { + Assert.False(PackageUtilities.IsFileTransformForBuildConfiguration(docName, trnName, this.baseTestProjectConfigs)); + } + + /// + /// Tests with project configurations containing dots + /// and file names with similar structures. Tests valid names. + /// + /// Document name. + /// Transform file name. + [Theory] + [InlineData("App.config", "App.Debug.Test.config")] + [InlineData("App.System.config", "App.System.Debug.Test.config")] + [InlineData("App.config", "App.Test.Release.config")] + [InlineData("App.Test.config", "App.Test.Release.config")] + [InlineData("App.Test.config", "App.Test.Test.Release.config")] + [InlineData("App.config", "App.Test.Rel.config")] + public void IsFileTransformWithDottedConfigsAndValidNames(string docName, string trnName) + { + Assert.True(PackageUtilities.IsFileTransformForBuildConfiguration(docName, trnName, this.testProjectConfigsWithDots)); + } + + /// + /// Tests with project configurations containing dots + /// and file names with similar structures. Tests invalid names. + /// + /// Document name. + /// Transform file name. + [Theory] + [InlineData("App.config", "App.Release.Test.config")] + [InlineData("App.config", "App.Rel.Test.config")] + [InlineData("App.Test.config", "App.Test.Rel.config")] + [InlineData("App.Test.config", "App.Test.Test.config")] + [InlineData("App.Test.config", "App.Debug.Test.config")] + [InlineData("App.config", "Test.Rel.config")] + [InlineData("App.Test.Rel.config", "App.Test.Rel.config")] + public void IsFileTransformWithDottedConfigsAndInvalidNames(string docName, string trnName) + { + Assert.False(PackageUtilities.IsFileTransformForBuildConfiguration(docName, trnName, this.testProjectConfigsWithDots)); + } + + /// + /// Tests with invalid arguments. + /// + /// Document name. + /// Transform file name. + [Theory] + [InlineData("App.config", "App.config")] + [InlineData("App.Debug.config", "App.Debug.config")] + [InlineData("App.config", "App..config")] + [InlineData("App.Debug.config", "App.config")] + [InlineData("App.config", "App.config.Debug")] + public void IsFileGenericTransformWithInvalidArguments(string docName, string trnName) + { + Assert.False(PackageUtilities.IsGenericFileTransform(docName, trnName)); + } + + /// + /// Tests with valid arguments. + /// + /// Document name. + /// Transform file name. + [Theory] + [InlineData("App.config", "App.Debug.config")] + [InlineData("App.config", "App.Test.Debug.config")] + [InlineData("App.Test.config", "App.Test.Debug.config")] + public void IsFileGenericTransformWithValidArguments(string docName, string trnName) + { + Assert.True(PackageUtilities.IsGenericFileTransform(docName, trnName)); + } + } +} diff --git a/test/dirs.proj b/test/dirs.proj new file mode 100644 index 00000000..2a5b1f05 --- /dev/null +++ b/test/dirs.proj @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file From aedc32f979d3e0eca76b80ec4e65f222bf5c84d0 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Wed, 11 Dec 2024 15:34:10 -0800 Subject: [PATCH 876/889] working locally please work on cloud --- azure-pipelines/dotnet-test-cloud.ps1 | 47 ++++++++++--------- .../WebApplication/Properties/AssemblyInfo.cs | 35 -------------- .../WebApplication/WebApplication.csproj | 9 ++-- 3 files changed, 30 insertions(+), 61 deletions(-) delete mode 100644 test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Properties/AssemblyInfo.cs diff --git a/azure-pipelines/dotnet-test-cloud.ps1 b/azure-pipelines/dotnet-test-cloud.ps1 index 3c524734..b712f14d 100644 --- a/azure-pipelines/dotnet-test-cloud.ps1 +++ b/azure-pipelines/dotnet-test-cloud.ps1 @@ -16,11 +16,11 @@ #> [CmdletBinding()] Param( - [string]$Configuration='Debug', - [string]$Agent='Local', - [switch]$PublishResults, - [switch]$x86, - [string]$dotnet32 + [string]$Configuration = 'Debug', + [string]$Agent = 'Local', + [switch]$PublishResults, + [switch]$x86, + [string]$dotnet32 ) $RepoRoot = (Resolve-Path "$PSScriptRoot/..").Path @@ -31,44 +31,47 @@ if ($x86) { $x86RunTitleSuffix = ", x86" if ($dotnet32) { $dotnet = $dotnet32 - } else { + } + else { $dotnet32Possibilities = "$PSScriptRoot\../obj/tools/x86/.dotnet/dotnet.exe", "$env:AGENT_TOOLSDIRECTORY/x86/dotnet/dotnet.exe", "${env:ProgramFiles(x86)}\dotnet\dotnet.exe" - $dotnet32Matches = $dotnet32Possibilities |? { Test-Path $_ } + $dotnet32Matches = $dotnet32Possibilities | ? { Test-Path $_ } if ($dotnet32Matches) { $dotnet = Resolve-Path @($dotnet32Matches)[0] Write-Host "Running tests using `"$dotnet`"" -ForegroundColor DarkGray - } else { + } + else { Write-Error "Unable to find 32-bit dotnet.exe" return 1 } } } -& $dotnet test "$RepoRoot\src" ` - --no-build ` - -c $Configuration ` - --filter "TestCategory!=FailsInCloudTest" ` - --collect "Code Coverage;Format=cobertura" ` - --settings "$PSScriptRoot/test.runsettings" ` - --blame-hang-timeout 60s ` - --blame-crash ` - -bl:"$ArtifactStagingFolder/build_logs/test.binlog" ` - --diag "$ArtifactStagingFolder/test_logs/diag.log;TraceLevel=info" ` - --logger trx ` +& $dotnet test "$RepoRoot\test" ` + --no-build ` + -c $Configuration ` + --filter "TestCategory!=FailsInCloudTest" ` + --collect "Code Coverage;Format=cobertura" ` + --settings "$PSScriptRoot/test.runsettings" ` + --blame-hang-timeout 60s ` + --blame-crash ` + -bl:"$ArtifactStagingFolder/build_logs/test.binlog" ` + --diag "$ArtifactStagingFolder/test_logs/diag.log;TraceLevel=info" ` + --logger trx ` $unknownCounter = 0 -Get-ChildItem -Recurse -Path $RepoRoot\test\*.trx |% { +Get-ChildItem -Recurse -Path $RepoRoot\test\*.trx | % { Copy-Item $_ -Destination $ArtifactStagingFolder/test_logs/ if ($PublishResults) { $x = [xml](Get-Content -Path $_) $runTitle = $null if ($x.TestRun.TestDefinitions -and $x.TestRun.TestDefinitions.GetElementsByTagName('UnitTest')) { - $storage = $x.TestRun.TestDefinitions.GetElementsByTagName('UnitTest')[0].storage -replace '\\','/' + $storage = $x.TestRun.TestDefinitions.GetElementsByTagName('UnitTest')[0].storage -replace '\\', '/' if ($storage -match '/(?net[^/]+)/(?:(?[^/]+)/)?(?[^/]+)\.dll$') { if ($matches.rid) { $runTitle = "$($matches.lib) ($($matches.tfm), $($matches.rid), $Agent)" - } else { + } + else { $runTitle = "$($matches.lib) ($($matches.tfm)$x86RunTitleSuffix, $Agent)" } } diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Properties/AssemblyInfo.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Properties/AssemblyInfo.cs deleted file mode 100644 index 3b3de4c8..00000000 --- a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("WebApplication")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("WebApplication")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("ff416cd8-e3b3-4223-b8fd-e6b3b6720d71")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/WebApplication.csproj b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/WebApplication.csproj index 8dfe364d..4ad12211 100644 --- a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/WebApplication.csproj +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/TestProjects/WebApplication/WebApplication.csproj @@ -23,6 +23,7 @@ True + true @@ -64,14 +65,14 @@ - + - true + true True @@ -92,7 +93,7 @@ - + 10.0 @@ -127,4 +128,4 @@ --> - + \ No newline at end of file From fb451cc9a15f6e136ab11c98564bad4e4ea646a8 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Thu, 12 Dec 2024 11:44:23 -0800 Subject: [PATCH 877/889] fixed tests --- azure-pipelines/dotnet.yml | 12 ++++++++++-- .../Microsoft.VisualStudio.SlowCheetah.Vsix.csproj | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/azure-pipelines/dotnet.yml b/azure-pipelines/dotnet.yml index 638170d1..517923f3 100644 --- a/azure-pipelines/dotnet.yml +++ b/azure-pipelines/dotnet.yml @@ -8,8 +8,16 @@ parameters: steps: -- script: dotnet build src -t:build,pack --no-restore -c $(BuildConfiguration) /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" - displayName: 🛠 dotnet build + +- task: VSBuild@1 + inputs: + solution: src/SlowCheetah.sln + msbuildArgs: /t:build,pack /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" + configuration: $(BuildConfiguration) + displayName: 🛠 Build +# Tevin: delete later +# - script: dotnet build src -t:build,pack --no-restore -c $(BuildConfiguration) /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog" +# displayName: 🛠 dotnet build - ${{ if not(parameters.IsOptProf) }}: - powershell: azure-pipelines/dotnet-test-cloud.ps1 -Configuration $(BuildConfiguration) -Agent $(Agent.JobName) -PublishResults diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj index e7a66b2f..dd467dff 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj @@ -100,7 +100,7 @@ - + From da9d891effb4e2a92881f0063b618886960d389d Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Thu, 12 Dec 2024 13:08:53 -0800 Subject: [PATCH 878/889] made test not write to file anymore' --- .../BuildTests/ConfigTransformTestsBase.cs | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs index fdec22c5..4c9c811b 100644 --- a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs @@ -76,7 +76,6 @@ public void BuildProject(string projectName) // when using . // MSBuild NuGet packages proved to be difficult in getting in-proc test builds to run. string projectPath = Path.Combine(this.TestProjectsDir, projectName, projectName + ".csproj"); - //string msbuildPath = MSBuildExePath; string properties = "/p:" + string.Join(",", globalProperties.Select(x => $"{x.Key}={x.Value}")); var startInfo = new System.Diagnostics.ProcessStartInfo() @@ -88,18 +87,18 @@ public void BuildProject(string projectName) }; // Tevin: Delete later - string path = "C:\\src\\libtempslowcheetah\\test\\Microsoft.VisualStudio.SlowCheetah.Tests\\example.txt"; - - // Open the file for reading - using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Write)) - { - // Read from the file - using (StreamWriter writer = new StreamWriter(fs)) - { - writer.WriteLine($"Running msbuild.exe {startInfo.Arguments}"); - writer.WriteLine($"Running msbuild.exe filename {startInfo.FileName}"); - } - } + //string path = "C:\\src\\libtempslowcheetah\\test\\Microsoft.VisualStudio.SlowCheetah.Tests\\example.txt"; + + //// Open the file for reading + //using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Write)) + //{ + // // Read from the file + // using (StreamWriter writer = new StreamWriter(fs)) + // { + // writer.WriteLine($"Running msbuild.exe {startInfo.Arguments}"); + // writer.WriteLine($"Running msbuild.exe filename {startInfo.FileName}"); + // } + //} try { From dc2b4f05c40ffe50709c61f52df78e5ca7ecb5a0 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Thu, 12 Dec 2024 13:30:53 -0800 Subject: [PATCH 879/889] added runtimeidentifier to see if it works --- .../Microsoft.VisualStudio.SlowCheetah.VS.csproj | 1 + .../Microsoft.VisualStudio.SlowCheetah.Vsix.csproj | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj index dbac61f8..e5d4b5a3 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj @@ -8,6 +8,7 @@ false 10.0 true + win diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj index dd467dff..352b4fb5 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj @@ -33,6 +33,7 @@ false $(BaseOutputPath)$(Configuration)\net472\ Microsoft.VisualStudio.SlowCheetah + win true From 11ad254da00d727bb432f4c71562a5ac009e865b Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Mon, 30 Dec 2024 15:48:31 -0800 Subject: [PATCH 880/889] saving some progress before I go ahead and delete the vspackage resx since it seems redundent --- Directory.Packages.props | 2 +- ...crosoft.VisualStudio.SlowCheetah.VS.csproj | 14 +++- .../VSPackage.Designer.cs | 81 +++++++++++++++++++ ...osoft.VisualStudio.SlowCheetah.Vsix.csproj | 2 +- .../Microsoft.VisualStudio.SlowCheetah.csproj | 2 +- .../Resources/Resources.Designer.cs | 2 +- 6 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 src/Microsoft.VisualStudio.SlowCheetah.VS/VSPackage.Designer.cs diff --git a/Directory.Packages.props b/Directory.Packages.props index f25f97b3..5e4e89de 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -28,6 +28,6 @@ - + \ No newline at end of file diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj index e5d4b5a3..aa3f9bc0 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj @@ -7,7 +7,7 @@ Copyright © Microsoft Corporation. All rights reserved. false 10.0 - true + win @@ -22,9 +22,12 @@ - + + + + @@ -73,6 +76,11 @@ True Resources.resx + + True + True + VSPackage.resx + @@ -92,6 +100,8 @@ true VSPackage Designer + ResXFileCodeGenerator + VSPackage.Designer.cs diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/VSPackage.Designer.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/VSPackage.Designer.cs new file mode 100644 index 00000000..ccacc044 --- /dev/null +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/VSPackage.Designer.cs @@ -0,0 +1,81 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.VisualStudio.SlowCheetah.VS { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class VSPackage { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal VSPackage() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.VisualStudio.SlowCheetah.VS.VSPackage", typeof(VSPackage).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to SlowCheetah - XML config transforms. + /// + internal static string _110 { + get { + return ResourceManager.GetString("110", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to This package enables you to transform your app.config or any other XML file based on the build configuration. It also adds additional tooling to help you create XML transforms.. + /// + internal static string _112 { + get { + return ResourceManager.GetString("112", resourceCulture); + } + } + } +} diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj index 352b4fb5..e3ce2e9b 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj @@ -33,7 +33,7 @@ false $(BaseOutputPath)$(Configuration)\net472\ Microsoft.VisualStudio.SlowCheetah - win + true diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj b/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj index c1cd793b..5e7fcf92 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj @@ -25,7 +25,7 @@ - + diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Resources/Resources.Designer.cs b/src/Microsoft.VisualStudio.SlowCheetah/Resources/Resources.Designer.cs index 1faf678f..3857c6a2 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Resources/Resources.Designer.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Resources/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Microsoft.VisualStudio.SlowCheetah.Resources { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { From a21b0ecb9ae47aa75a2bcf6fa86b39bb8f8abe6b Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Thu, 2 Jan 2025 13:06:17 -0800 Subject: [PATCH 881/889] fixing small errors, but storing before changin some of these props files --- Directory.Build.props | 2 +- Directory.Packages.props | 3 +-- src/AssemblyInfo.cs | 2 +- .../Microsoft.VisualStudio.SlowCheetah.Tests.csproj | 9 --------- .../Microsoft.VisualStudio.SlowCheetah.VS.csproj | 6 ------ .../PackageHandlers/BackgroundInstallationHandler.cs | 2 +- .../PackageHandlers/BasePackageHandler.cs | 2 +- .../PackageHandlers/DialogInstallationHandler.cs | 2 +- .../NugetHandler/PackageHandlers/EmptyHandler.cs | 2 +- .../NugetHandler/PackageHandlers/IPackageHandler.cs | 2 +- .../NugetHandler/PackageHandlers/NuGetUninstaller.cs | 2 +- .../NugetHandler/PackageHandlers/NugetInstaller.cs | 2 +- .../PackageHandlers/TargetsUninstaller.cs | 2 +- .../PackageHandlers/UserInstallationHandler.cs | 2 +- .../NugetHandler/SlowCheetahNuGetManager.cs | 2 +- .../NugetHandler/VsProjectTypes.cs | 2 +- .../Options/AdvancedOptionsDialogPage.cs | 2 +- .../Options/AdvancedOptionsUserControl.cs | 2 +- .../Options/BaseOptionsDialogPage.cs | 2 +- .../Options/OptionsDialogPage.cs | 2 +- .../Options/OptionsUserControl.cs | 2 +- .../Package/AddTransformCommand.cs | 4 ++-- .../Package/BaseCommand.cs | 2 +- .../Package/PackageSolutionEvents.cs | 2 +- .../Package/PreviewTransformCommand.cs | 4 ++-- .../Package/SlowCheetahPackageLogger.cs | 2 +- .../Resources/Guids.cs | 2 +- .../Resources/PkgCmdID.cs | 2 +- .../SlowCheetahPackage.cs | 2 +- .../TransformationPreviewLogger.cs | 2 +- .../Utilities/PackageUtilities.cs | 2 +- .../Utilities/ProjectUtilities.cs | 2 +- .../Microsoft.VisualStudio.SlowCheetah.Vsix.csproj | 4 ++-- .../Build/TransformTask.cs | 2 +- .../Exceptions/TransformFailedException.cs | 2 +- .../Logging/ITransformationLogger.cs | 2 +- .../Logging/JsonShimLogger.cs | 2 +- .../Logging/TransformationTaskLogger.cs | 2 +- .../Logging/XmlShimLogger.cs | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../Transformer/ITransformer.cs | 2 +- .../Transformer/JsonTransformer.cs | 6 +++--- .../Transformer/TransformUtilities.cs | 2 +- .../Transformer/TransformerFactory.cs | 2 +- .../Transformer/XmlTransformer.cs | 2 +- stylecop.json | 2 +- .../BaseTest.cs | 2 +- .../BuildTests/ConfigTransformTestsBase.cs | 2 +- .../BuildTests/ConsoleAppTests.cs | 2 +- .../BuildTests/WebAppTests.cs | 2 +- .../Microsoft.VisualStudio.SlowCheetah.Tests.csproj | 11 +---------- .../TestUtilities.cs | 2 +- .../TransformTest.cs | 2 +- ...Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj | 11 ----------- .../PackageUtilitiesTest.cs | 2 +- 55 files changed, 57 insertions(+), 93 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index da14541b..38276086 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -27,7 +27,7 @@ embedded - + https://github.com/microsoft/slow-cheetah Microsoft Microsoft © Microsoft Corporation. All rights reserved. diff --git a/Directory.Packages.props b/Directory.Packages.props index 5e4e89de..03424787 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -10,14 +10,13 @@ - - + diff --git a/src/AssemblyInfo.cs b/src/AssemblyInfo.cs index 6aee887e..9731a830 100644 --- a/src/AssemblyInfo.cs +++ b/src/AssemblyInfo.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Runtime.InteropServices; diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj index 60b061bc..2c45c5c2 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj @@ -11,15 +11,6 @@ - - - - - - diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj index aa3f9bc0..2f907963 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj @@ -7,8 +7,6 @@ Copyright © Microsoft Corporation. All rights reserved. false 10.0 - - win @@ -22,12 +20,8 @@ - - - - diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/BackgroundInstallationHandler.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/BackgroundInstallationHandler.cs index d56e52da..4b25e036 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/BackgroundInstallationHandler.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/BackgroundInstallationHandler.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/BasePackageHandler.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/BasePackageHandler.cs index 49a69fd7..f487026d 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/BasePackageHandler.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/BasePackageHandler.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/DialogInstallationHandler.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/DialogInstallationHandler.cs index 600ff6e7..ea67ec25 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/DialogInstallationHandler.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/DialogInstallationHandler.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/EmptyHandler.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/EmptyHandler.cs index 4e4dd64c..a3643cc8 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/EmptyHandler.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/EmptyHandler.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/IPackageHandler.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/IPackageHandler.cs index ed3563c2..f867ad4f 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/IPackageHandler.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/IPackageHandler.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/NuGetUninstaller.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/NuGetUninstaller.cs index d29c00d7..1007ee4e 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/NuGetUninstaller.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/NuGetUninstaller.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/NugetInstaller.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/NugetInstaller.cs index f547edd5..a5336728 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/NugetInstaller.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/NugetInstaller.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/TargetsUninstaller.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/TargetsUninstaller.cs index f4502ab8..c3384ecc 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/TargetsUninstaller.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/TargetsUninstaller.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/UserInstallationHandler.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/UserInstallationHandler.cs index 66a74909..45715975 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/UserInstallationHandler.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/PackageHandlers/UserInstallationHandler.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/SlowCheetahNuGetManager.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/SlowCheetahNuGetManager.cs index 6092510c..428dae86 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/SlowCheetahNuGetManager.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/SlowCheetahNuGetManager.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/VsProjectTypes.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/VsProjectTypes.cs index 134e5c45..7d5e933d 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/VsProjectTypes.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/NugetHandler/VsProjectTypes.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/AdvancedOptionsDialogPage.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/AdvancedOptionsDialogPage.cs index ddb31ef6..2132f18f 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/AdvancedOptionsDialogPage.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/AdvancedOptionsDialogPage.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/AdvancedOptionsUserControl.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/AdvancedOptionsUserControl.cs index 5c857cb5..ce239a63 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/AdvancedOptionsUserControl.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/AdvancedOptionsUserControl.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/BaseOptionsDialogPage.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/BaseOptionsDialogPage.cs index a9d6e37f..d1a015db 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/BaseOptionsDialogPage.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/BaseOptionsDialogPage.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/OptionsDialogPage.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/OptionsDialogPage.cs index d211b4c6..771eb4d8 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/OptionsDialogPage.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/OptionsDialogPage.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/OptionsUserControl.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/OptionsUserControl.cs index 2d19c3ce..806133f2 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/OptionsUserControl.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Options/OptionsUserControl.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/AddTransformCommand.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/AddTransformCommand.cs index f176c834..464c7305 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/AddTransformCommand.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/AddTransformCommand.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line @@ -157,7 +157,7 @@ protected override void OnInvoke(object sender, EventArgs e) } // if it is a web project we should add publish profile specific transforms as well - var publishProfileTransforms = this.GetPublishProfileTransforms(hierarchy, projectFullPath); + IEnumerable publishProfileTransforms = this.GetPublishProfileTransforms(hierarchy, projectFullPath); if (publishProfileTransforms != null) { transformsToCreate.AddRange(publishProfileTransforms); diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/BaseCommand.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/BaseCommand.cs index fa73a199..75eca39e 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/BaseCommand.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/BaseCommand.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/PackageSolutionEvents.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/PackageSolutionEvents.cs index d2f18aa3..dd6599b2 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/PackageSolutionEvents.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/PackageSolutionEvents.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/PreviewTransformCommand.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/PreviewTransformCommand.cs index e64a37dd..5d85839a 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/PreviewTransformCommand.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/PreviewTransformCommand.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line @@ -261,7 +261,7 @@ private void PreviewTransform(IVsHierarchy hier, string sourceFile, string trans ProcessStartInfo psi = new ProcessStartInfo(advancedOptionsPage.PreviewToolExecutablePath, string.Format(CultureInfo.CurrentCulture, advancedOptionsPage.PreviewToolCommandLine, $"\"{sourceFile}\"", $"\"{destFile}\"")) { CreateNoWindow = true, - UseShellExecute = false + UseShellExecute = false, }; System.Diagnostics.Process.Start(psi); } diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/SlowCheetahPackageLogger.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/SlowCheetahPackageLogger.cs index b85cc9ea..2400c13b 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/SlowCheetahPackageLogger.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Package/SlowCheetahPackageLogger.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS { diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Resources/Guids.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Resources/Guids.cs index 16e104fc..99d7fc41 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Resources/Guids.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Resources/Guids.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Resources/PkgCmdID.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Resources/PkgCmdID.cs index c0a5a3b3..bbeea178 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Resources/PkgCmdID.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Resources/PkgCmdID.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/SlowCheetahPackage.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/SlowCheetahPackage.cs index 883331ee..152d3ff6 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/SlowCheetahPackage.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/SlowCheetahPackage.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/TransformationPreviewLogger.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/TransformationPreviewLogger.cs index b1851628..920014d6 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/TransformationPreviewLogger.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/TransformationPreviewLogger.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Utilities/PackageUtilities.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Utilities/PackageUtilities.cs index 221da9e0..e256c6b6 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Utilities/PackageUtilities.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Utilities/PackageUtilities.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Utilities/ProjectUtilities.cs b/src/Microsoft.VisualStudio.SlowCheetah.VS/Utilities/ProjectUtilities.cs index b19a1032..fb41a583 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Utilities/ProjectUtilities.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Utilities/ProjectUtilities.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj index e3ce2e9b..cbbcbcbe 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj @@ -83,13 +83,13 @@ - + {80A712EE-7B5C-44D3-A2AD-F918B893B6DF} diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Build/TransformTask.cs b/src/Microsoft.VisualStudio.SlowCheetah/Build/TransformTask.cs index c36840fa..51c07589 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Build/TransformTask.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Build/TransformTask.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Exceptions/TransformFailedException.cs b/src/Microsoft.VisualStudio.SlowCheetah/Exceptions/TransformFailedException.cs index 88e1f0b1..590c6415 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Exceptions/TransformFailedException.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Exceptions/TransformFailedException.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Logging/ITransformationLogger.cs b/src/Microsoft.VisualStudio.SlowCheetah/Logging/ITransformationLogger.cs index 1e734602..b118f068 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Logging/ITransformationLogger.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Logging/ITransformationLogger.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Logging/JsonShimLogger.cs b/src/Microsoft.VisualStudio.SlowCheetah/Logging/JsonShimLogger.cs index 4b93f0da..a93c195e 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Logging/JsonShimLogger.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Logging/JsonShimLogger.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Logging/TransformationTaskLogger.cs b/src/Microsoft.VisualStudio.SlowCheetah/Logging/TransformationTaskLogger.cs index 32d2ad4a..f414c0f9 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Logging/TransformationTaskLogger.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Logging/TransformationTaskLogger.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Logging/XmlShimLogger.cs b/src/Microsoft.VisualStudio.SlowCheetah/Logging/XmlShimLogger.cs index 4e1718bc..e6f51ac3 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Logging/XmlShimLogger.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Logging/XmlShimLogger.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Properties/AssemblyInfo.cs b/src/Microsoft.VisualStudio.SlowCheetah/Properties/AssemblyInfo.cs index 95be5ffa..9b960036 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Properties/AssemblyInfo.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Properties/AssemblyInfo.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Resources; diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/ITransformer.cs b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/ITransformer.cs index 31d41a3c..d00173df 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/ITransformer.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/ITransformer.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/JsonTransformer.cs b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/JsonTransformer.cs index a9a599cb..a779b495 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/JsonTransformer.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/JsonTransformer.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { @@ -59,7 +59,7 @@ public void CreateTransformFile(string sourcePath, string transformPath, bool ov // If the file should be overwritten or if it doesn't exist, we create it if (overwrite || !File.Exists(transformPath)) { - var encoding = TransformUtilities.GetEncoding(sourcePath); + System.Text.Encoding encoding = TransformUtilities.GetEncoding(sourcePath); File.WriteAllText(transformPath, Resources.Resources.JsonTransform_TransformFileContents, encoding); } } @@ -146,7 +146,7 @@ private bool TrySaveToFile(Stream result, string sourceFile, string destinationF try { string contents; - var encoding = TransformUtilities.GetEncoding(sourceFile); + System.Text.Encoding encoding = TransformUtilities.GetEncoding(sourceFile); using (StreamReader reader = new StreamReader(result, true)) { // Get the contents of the result stram diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformUtilities.cs b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformUtilities.cs index c33d24cc..d8741fc3 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformUtilities.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformUtilities.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformerFactory.cs b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformerFactory.cs index 31222f25..120a22f2 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformerFactory.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/TransformerFactory.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/XmlTransformer.cs b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/XmlTransformer.cs index f6817feb..bc26105c 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Transformer/XmlTransformer.cs +++ b/src/Microsoft.VisualStudio.SlowCheetah/Transformer/XmlTransformer.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah { diff --git a/stylecop.json b/stylecop.json index 1154b6fe..c125c72f 100644 --- a/stylecop.json +++ b/stylecop.json @@ -6,7 +6,7 @@ "companyName": "Microsoft Corporation", "copyrightText": "Copyright (c) {companyName}. All rights reserved.\nLicensed under the {licenseName} license. See {licenseFile} file in the project root for full license information.", "variables": { - "licenseName": "MIT License", + "licenseName": "MIT", "licenseFile": "LICENSE" }, "xmlHeader": false diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BaseTest.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BaseTest.cs index b5b5ff29..42d06fc6 100644 --- a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BaseTest.cs +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BaseTest.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs index 4c9c811b..aa81c390 100644 --- a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConfigTransformTestsBase.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConsoleAppTests.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConsoleAppTests.cs index 3ce3bfe8..16cd29dc 100644 --- a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConsoleAppTests.cs +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/ConsoleAppTests.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/WebAppTests.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/WebAppTests.cs index 431364e4..8b0605ec 100644 --- a/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/WebAppTests.cs +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/BuildTests/WebAppTests.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj b/test/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj index 38a4dca2..de73178b 100644 --- a/test/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/Microsoft.VisualStudio.SlowCheetah.Tests.csproj @@ -11,18 +11,9 @@ - - - - - - - + diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/TestUtilities.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/TestUtilities.cs index 9445c7a6..027235cf 100644 --- a/test/Microsoft.VisualStudio.SlowCheetah.Tests/TestUtilities.cs +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/TestUtilities.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/test/Microsoft.VisualStudio.SlowCheetah.Tests/TransformTest.cs b/test/Microsoft.VisualStudio.SlowCheetah.Tests/TransformTest.cs index 9ba19a01..7c07bbdd 100644 --- a/test/Microsoft.VisualStudio.SlowCheetah.Tests/TransformTest.cs +++ b/test/Microsoft.VisualStudio.SlowCheetah.Tests/TransformTest.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License license. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. #pragma warning disable SA1512 // Single-line comments must not be followed by blank line diff --git a/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj b/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj index c25827be..8c92893b 100644 --- a/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj +++ b/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/Microsoft.VisualStudio.SlowCheetah.VS.Tests.csproj @@ -5,19 +5,8 @@ false - - - - - - - diff --git a/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/PackageUtilitiesTest.cs b/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/PackageUtilitiesTest.cs index f21779f2..583ef49b 100644 --- a/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/PackageUtilitiesTest.cs +++ b/test/Microsoft.VisualStudio.SlowCheetah.VS.Tests/PackageUtilitiesTest.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See LICENSE file in the project root for full license information. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.VisualStudio.SlowCheetah.VS.Tests { From 21833ec341a21e1e3591a0cc2d3f1e53eaeddd18 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Fri, 17 Jan 2025 13:33:01 -0800 Subject: [PATCH 882/889] make it so that newtonsoft is no longer in our vsix --- Directory.Packages.props | 2 +- .../Microsoft.VisualStudio.SlowCheetah.VS.csproj | 5 +---- .../Microsoft.VisualStudio.SlowCheetah.Vsix.csproj | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 03424787..21333a8d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ 2.0.171 - + diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj index 2f907963..ef61d513 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj @@ -12,10 +12,7 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj index cbbcbcbe..a546b98e 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj @@ -60,7 +60,7 @@ CopyIfNewer - true + false Newtonsoft.Json.dll false From c1873c242269c3cc7daa9a097a0082a66e500f23 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Fri, 17 Jan 2025 14:09:36 -0800 Subject: [PATCH 883/889] add runtime identifier back --- .github/workflows/build.yml | 2 -- .../Microsoft.VisualStudio.SlowCheetah.VS.csproj | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ac94a073..678167d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,8 +22,6 @@ jobs: fail-fast: false matrix: os: - - ubuntu-22.04 - - macos-14 - windows-2022 steps: diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj index ef61d513..6ec687f1 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj @@ -7,6 +7,7 @@ Copyright © Microsoft Corporation. All rights reserved. false 10.0 + win From f29d8556b1f9304f9972def4fd9f665719795f75 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Fri, 17 Jan 2025 14:28:24 -0800 Subject: [PATCH 884/889] add back the runtime identifier --- .../Microsoft.VisualStudio.SlowCheetah.Vsix.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj index a546b98e..162d1723 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.Vsix/Microsoft.VisualStudio.SlowCheetah.Vsix.csproj @@ -33,7 +33,7 @@ false $(BaseOutputPath)$(Configuration)\net472\ Microsoft.VisualStudio.SlowCheetah - + win true From ce0f48b9b751aea72529ccf48bb81556bba86404 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Fri, 17 Jan 2025 14:55:03 -0800 Subject: [PATCH 885/889] try to fix github stuff --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 678167d8..2764f118 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,9 @@ jobs: run: azure-pipelines/variables/_pipelines.ps1 shell: pwsh - name: 🛠 build - run: dotnet build -t:build,pack --no-restore -c ${{ env.BUILDCONFIGURATION }} -warnAsError -warnNotAsError:NU1901,NU1902,NU1903,NU1904 /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog" + run: | + msbuild.exe src/Slowcheetah.sln /t:build,pack /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog" + # run: dotnet build -t:build,pack --no-restore -c ${{ env.BUILDCONFIGURATION }} -warnAsError -warnNotAsError:NU1901,NU1902,NU1903,NU1904 /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog" - name: 🧪 test run: azure-pipelines/dotnet-test-cloud.ps1 -Configuration ${{ env.BUILDCONFIGURATION }} -Agent ${{ runner.os }} shell: pwsh From af428f4582acee272f1effeaa80087bbfada5221 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Fri, 17 Jan 2025 16:13:53 -0800 Subject: [PATCH 886/889] try to add msbuild to github workflow and add signing for third party dll --- .github/workflows/build.yml | 2 ++ .../Microsoft.VisualStudio.SlowCheetah.csproj | 26 +++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2764f118..f4b9ae27 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,6 +28,8 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1 - name: ⚙ Install prerequisites run: | ./init.ps1 -UpgradePrerequisites diff --git a/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj b/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj index 5e7fcf92..8e81d134 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah/Microsoft.VisualStudio.SlowCheetah.csproj @@ -20,14 +20,7 @@ - - - - - - - - + @@ -58,10 +51,27 @@ + + + 3PartySHA2 + None + + + + + + + + + + + + all + From 87b4f487117d46aa9f39e2c4716000af9fa35d40 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Fri, 17 Jan 2025 16:19:20 -0800 Subject: [PATCH 887/889] try to change workflow for msbuild again --- .github/workflows/build.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4b9ae27..6eb2ddda 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,8 +28,6 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v1 - name: ⚙ Install prerequisites run: | ./init.ps1 -UpgradePrerequisites @@ -43,9 +41,12 @@ jobs: - name: ⚙️ Set pipeline variables based on source run: azure-pipelines/variables/_pipelines.ps1 shell: pwsh + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v2 + - name: 🛠 build - run: | - msbuild.exe src/Slowcheetah.sln /t:build,pack /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog" + run: msbuild src/Slowcheetah.sln /t:build,pack /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog" # run: dotnet build -t:build,pack --no-restore -c ${{ env.BUILDCONFIGURATION }} -warnAsError -warnNotAsError:NU1901,NU1902,NU1903,NU1904 /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog" - name: 🧪 test run: azure-pipelines/dotnet-test-cloud.ps1 -Configuration ${{ env.BUILDCONFIGURATION }} -Agent ${{ runner.os }} From 6c48e845587d7cbedb1417c04efc8fa61d7c5506 Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Tue, 21 Jan 2025 10:21:57 -0800 Subject: [PATCH 888/889] fixed symbols feature name --- azure-pipelines/variables/SymbolsFeatureName.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/variables/SymbolsFeatureName.ps1 b/azure-pipelines/variables/SymbolsFeatureName.ps1 index d6c133eb..1f702ba0 100644 --- a/azure-pipelines/variables/SymbolsFeatureName.ps1 +++ b/azure-pipelines/variables/SymbolsFeatureName.ps1 @@ -1 +1 @@ -'LibraryName' +'slow-cheetah' From 225c25487f9c3d72dd1ae7908e98b11d4710b92d Mon Sep 17 00:00:00 2001 From: Tevin Stanley Date: Tue, 21 Jan 2025 13:43:41 -0800 Subject: [PATCH 889/889] fix github build and update references to component governance --- .github/workflows/build.yml | 2 +- Directory.Packages.props | 2 ++ .../Microsoft.VisualStudio.SlowCheetah.VS.csproj | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6eb2ddda..dfae4d2d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: uses: microsoft/setup-msbuild@v2 - name: 🛠 build - run: msbuild src/Slowcheetah.sln /t:build,pack /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog" + run: msbuild src/Slowcheetah.sln /t:build,pack /p:Configuration=Release /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog" # run: dotnet build -t:build,pack --no-restore -c ${{ env.BUILDCONFIGURATION }} -warnAsError -warnNotAsError:NU1901,NU1902,NU1903,NU1904 /bl:"${{ runner.temp }}/_artifacts/build_logs/build.binlog" - name: 🧪 test run: azure-pipelines/dotnet-test-cloud.ps1 -Configuration ${{ env.BUILDCONFIGURATION }} -Agent ${{ runner.os }} diff --git a/Directory.Packages.props b/Directory.Packages.props index 21333a8d..15db8d16 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -19,6 +19,8 @@ + + diff --git a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj index 6ec687f1..85691f4f 100644 --- a/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj +++ b/src/Microsoft.VisualStudio.SlowCheetah.VS/Microsoft.VisualStudio.SlowCheetah.VS.csproj @@ -20,6 +20,8 @@ + +