diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml
index cf1d957..ecad6cf 100644
--- a/build/azure-pipelines.yml
+++ b/build/azure-pipelines.yml
@@ -3,11 +3,6 @@ trigger:
include:
- main
-resources:
- containers:
- - container: windows
- image: nventive/vs_build-tools:17.2.5
-
variables:
- name: NUGET_VERSION
value: 6.2.0
@@ -19,9 +14,6 @@ variables:
value: GooseAnalyzers.sln
- name: IsReleaseBranch # Should this branch name use the release stage
value: $[or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/feature/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'))]
-# Pool names
-- name: windowsPoolName
- value: 'windows 2022'
stages:
- stage: Build
@@ -32,11 +24,11 @@ stages:
matrix:
Packages:
ApplicationConfiguration: Release
- ApplicationPlatform: NuGet
+ ApplicationPlatform: Any CPU
GeneratePackageOnBuild: true
pool:
- name: $(windowsPoolName)
+ vmImage : windows-2022
variables:
- name: PackageOutputPath # Path where nuget packages will be copied to.
@@ -45,8 +37,6 @@ stages:
workspace:
clean: all # Cleanup the workspaca before starting
- container: windows
-
steps:
- template: stage-build.yml
@@ -57,7 +47,7 @@ stages:
- job: Publish_NuGet_External
pool:
- name: $(windowsPoolName)
+ vmImage : windows-2022
workspace:
clean: all # Cleanup the workspaca before starting
diff --git a/build/stage-build.yml b/build/stage-build.yml
index 2b6c19f..362468f 100644
--- a/build/stage-build.yml
+++ b/build/stage-build.yml
@@ -16,44 +16,30 @@
versionSpec: $(NUGET_VERSION)
checkLatest: false
-- task: MSBuild@1
- displayName: 'Restore solution packages'
- inputs:
- solution: $(Build.SourcesDirectory)/src/$(SolutionFileName)
- msbuildLocationMethod: version
- msbuildVersion: latest
- msbuildArchitecture: x86
- msbuildArguments: >
- /t:restore
- configuration: $(ApplicationConfiguration)
- platform: $(ApplicationPlatform)
- clean: false
- maximumCpuCount: true
- restoreNugetPackages: false
- logProjectEvents: false
- createLogFile: false
+# For some reason, we need to build the package first before any other command (like dotnet pack).
+- script: >
+ dotnet build src/GooseAnalyzers/GooseAnalyzers.csproj
+ --configuration $(ApplicationConfiguration)
+ -p:PackageVersion=$(GitVersion.SemVer)
+ -p:ContinousIntegrationBuild=true
+ displayName: 'Build $(ApplicationConfiguration)'
-- task: MSBuild@1
- displayName: 'Build solution in $(ApplicationConfiguration) | $(ApplicationPlatform)'
- inputs:
- solution: $(Build.SourcesDirectory)/src/$(SolutionFileName)
- msbuildLocationMethod: version
- msbuildVersion: latest
- msbuildArchitecture: x86
- configuration: $(ApplicationConfiguration)
- platform: $(ApplicationPlatform)
- clean: false
- maximumCpuCount: true
- restoreNugetPackages: false
- logProjectEvents: false
- createLogFile: false
- msbuildArguments: > # Set the version of the packages, will have no effect on application projects (Heads).
- /p:PackageVersion=$(GitVersion.SemVer)
- /p:ContinousIntegrationBuild=true
-
-- script: dotnet test src --no-build --configuration $(ApplicationConfiguration) --logger trx --collect "Code coverage"
+- script: >
+ dotnet pack src/GooseAnalyzers/GooseAnalyzers.csproj
+ --configuration $(ApplicationConfiguration)
+ -p:PackageVersion=$(GitVersion.SemVer)
+ -p:ContinousIntegrationBuild=true
+ --no-build
+ displayName: 'Pack $(ApplicationConfiguration)'
+
+# Note that we specify IsPackable=false otherwise another package with the wrong version is generated by dotnet test.
+- script: >
+ dotnet test src
+ -p:IsPackable=false
+ --configuration $(ApplicationConfiguration)
+ --logger trx
+ --collect "Code coverage"
displayName: 'Run tests'
- condition: and(succeeded(), eq(variables['ApplicationPlatform'], 'NuGet'))
- task: PublishTestResults@2
displayName: 'Publish test results'
diff --git a/src/GooseAnalyzers/GooseAnalyzers.csproj b/src/GooseAnalyzers/GooseAnalyzers.csproj
index 10799b6..dc5b154 100644
--- a/src/GooseAnalyzers/GooseAnalyzers.csproj
+++ b/src/GooseAnalyzers/GooseAnalyzers.csproj
@@ -13,7 +13,6 @@
GooseAnalyzers
GooseAnalyzers
A collection of .NET analyzers and DiagnosticSuppressors for C#.
- true
README.md
analyzers;roslyn;diagnostics
Apache-2.0
@@ -21,9 +20,6 @@
true
- true
- true
- snupkg
@@ -44,6 +40,11 @@
+
+ false
+ true
+
+