diff --git a/.gitignore b/.gitignore index f67aada6..c0959006 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ # Working folders ~build/ ~publish/ +~packages/ # Build results [Bb]in/ diff --git a/Directory.Build.rsp b/Directory.Build.rsp new file mode 100644 index 00000000..0f20c892 --- /dev/null +++ b/Directory.Build.rsp @@ -0,0 +1,4 @@ +-NoLogo +-MaxCPUCount +-NodeReuse:False +-Verbosity:Normal \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0eadc212..319dae48 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,27 +9,17 @@ pr: - rel/* pool: - vmImage: windows-2022 + vmImage: windows-latest + +variables: + BuildConfiguration: Release jobs: - job: BuildBits + displayName: Build and Test solution timeoutInMinutes: 60 steps: - # Install NuGet - - task: NuGetToolInstaller@0 - displayName: Install NuGet 6.0 - inputs: - versionSpec: 6.0.0 - - # Install NerdBank GitVersioning - - task: DotNetCoreCLI@2 - displayName: Install NBGV tool - inputs: - command: custom - custom: tool - arguments: update -g nbgv - # Set Build Version - script: nbgv cloud displayName: Set NBGV version @@ -38,35 +28,41 @@ jobs: - pwsh: build/Update-Headers.ps1 -Verify displayName: Verify headers + # Restore solution + - script: dotnet restore -p:Configuration=$(BuildConfiguration) + displayName: Restore solution + # Build solution - - script: dotnet build -c Release + - script: dotnet build --no-restore -c $(BuildConfiguration) displayName: Build solution - # Run .NET 6 tests - - script: dotnet test -c Release -f net6.0 -l "trx;LogFileName=VSTestResults_net6.0.trx" + # Test solution # + + # Run .NET 6 unit tests + - script: dotnet test --no-build -c $(BuildConfiguration) -f net6.0 -l "trx;LogFileName=VSTestResults_net6.0.trx" displayName: Run .NET 6 unit tests - # Run .NET Core 3.1 tests - - script: dotnet test -c Release -f netcoreapp3.1 -l "trx;LogFileName=VSTestResults_netcoreapp3.1.trx" + # Run .NET Core 3.1 unit tests + - script: dotnet test --no-build -c $(BuildConfiguration) -f netcoreapp3.1 -l "trx;LogFileName=VSTestResults_netcoreapp3.1.trx" displayName: Run .NET Core 3.1 unit tests - # Run .NET Framework 4.7.2 tests - - script: dotnet test -c Release -f net472 -l "trx;LogFileName=VSTestResults_net472.trx" + # Run .NET Framework 4.7.2 unit tests + - script: dotnet test --no-build -c $(BuildConfiguration) -f net472 -l "trx;LogFileName=VSTestResults_net472.trx" displayName: Run .NET Framework 4.7.2 unit tests # Publish test results - task: PublishTestResults@2 displayName: Publish test results inputs: - testResultsFormat: 'VSTest' - testResultsFiles: '**/VSTestResults*.trx' + testResultsFormat: VSTest + testResultsFiles: ~build/*/TestResults/VSTestResults*.trx condition: always() - # Create the NuGet package(s) - - script: dotnet pack -c Release - displayName: Create NuGet package(s) + # Pack solution + - script: dotnet pack --no-build -c $(BuildConfiguration) + displayName: Pack solution - # Sign package(s) + # Sign packages - pwsh: build/Sign-Package.ps1 displayName: Authenticode sign packages env: diff --git a/build/Community.Toolkit.Common.props b/build/Community.Toolkit.Common.props index c647bfe1..e3e6c4ee 100644 --- a/build/Community.Toolkit.Common.props +++ b/build/Community.Toolkit.Common.props @@ -19,9 +19,11 @@ + NU1507 true true $(TF_BUILD) + $(MSBuildProjectName.Replace('CommunityToolkit.', '')) @@ -33,8 +35,8 @@ - ~build\ - ~publish\ + $(RepositoryDirectory)~build\$(ProjectName)\ + $(RepositoryDirectory)~publish\$(ProjectName)\ $(BuildDir)bin\ $(BuildDir)obj\ @@ -44,6 +46,8 @@ $(RepositoryDirectory)~packages\bin\ $(RepositoryDirectory)~packages\obj\ + + $(BuildDir)TestResults\ \ No newline at end of file