We have a Visual Studio solution containing multiple projects. Till now, they have all been in C#. However, we decided:
- We want to add performance testing;
- We want to use k6 as the performance testing tool;
- We want to write the tests in TypeScript; and
- The performance tests should live in the same repo and preferably the same solution as what it is testing.
Locally, I've successfully created a TypeScript project in Visual Studio 2022 within the Visual Studio solution we wish to test. While I don't know how to execute these tests from Visual Studio itself instead of the command line, I don't presently care about that.
I've pushed the performance tests to our Azure DevOps repo and created a pull request. In order to complete the PR and merge to master, the build must succeed, and this is where I am presently stuck.
I've added 'Install Node.js' and 'Install TypeScript' to the azure-pipelines.yml and those tasks appear to work, but ultimately the build jobs fail.
My yaml file currently looks like this:
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
jobs:
- job: buildServer
pool:
vmImage: 'windows-2022'
steps:
- task: NodeTool@0
displayName: 'Install Node.js'
inputs:
versionSpec: 16.x
- script: npm install --save-dev typescript
displayName: 'Install TypeScript'
- task: UseDotNet@2
displayName: 'Install .NET 6 SDK'
inputs:
packageType: 'sdk'
version: '6.0.x'
performMultiLevelLookup: true
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'NuGet.config'
verbosityRestore: 'Normal'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\bin\$(BuildConfiguration)\**\Enpal.SalesforceCache.Test.dll
!**\xunit.runner.visualstudio.testadapter.dll
!**\xunit.runner.visualstudio.dotnetcore.testadapter.dll
searchFolder: '$(System.DefaultWorkingDirectory)'
runTestsInIsolation: true
codeCoverageEnabled: true
- task: PublishTestResults@2
inputs:
testResultsFormat: 'XUnit'
testResultsFiles: '**/TEST-*.xml'
searchFolder: '$(Agent.TempDirectory)\TestResults'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)'
includeRootFolder: true
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
- job: buildAndPushClientNuget
pool:
vmImage: 'windows-2022'
steps:
- task: NodeTool@0
displayName: 'Install Node.js'
inputs:
versionSpec: 16.x
- script: npm install --save-dev typescript
displayName: 'Install TypeScript'
- task: UseDotNet@2
displayName: 'Install .NET 6 SDK'
inputs:
packageType: 'sdk'
version: '6.0.x'
performMultiLevelLookup: true
- task: NuGetToolInstaller@1
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'NuGet.config'
verbosityRestore: 'Normal'
# Build nuget
- task: DotNetCoreCLI@2
displayName: 'dotnet pack'
inputs:
command: 'custom'
custom: 'pack'
arguments: '-c $(buildConfiguration) -o $(Build.ArtifactStagingDirectory) -p:Build=$(Build.BuildId) --include-symbols'
# publish artifacts
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
# Publish nuget
- task: NuGetCommand@2
condition: ne(variables['Build.Reason'], 'PullRequest')
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'enpal'
# Publish symbols
- task: PublishSymbols@2
condition: ne(variables['Build.Reason'], 'PullRequest')
inputs:
SearchPattern: '**/bin/**/*.pdb'
SymbolServerType: 'TeamServices'
DetailedLog: false
The buildServer/VSBuild task fails with:
"D:\a\1\s\SalesforceCache.sln" (default target) (1) ->
"D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj" (default target) (6) ->
(ResolveAssemblyReferences target) ->
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: Found conflicts between different versions of "Microsoft.AspNetCore.Mvc.Core" that could not be resolved. [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: There was a conflict between "Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" and "Microsoft.AspNetCore.Mvc.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60". [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: "Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was chosen because it was primary and "Microsoft.AspNetCore.Mvc.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was not. [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: References which depend on "Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [C:\Users\VssAdministrator\.nuget\packages\microsoft.aspnetcore.mvc.core\2.2.5\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Core.dll]. [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: C:\Users\VssAdministrator\.nuget\packages\microsoft.aspnetcore.mvc.core\2.2.5\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Core.dll [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: Project file item includes which caused reference "C:\Users\VssAdministrator\.nuget\packages\microsoft.aspnetcore.mvc.core\2.2.5\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Core.dll". [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: C:\Users\VssAdministrator\.nuget\packages\microsoft.aspnetcore.mvc.core\2.2.5\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Core.dll [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: References which depend on "Microsoft.AspNetCore.Mvc.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" []. [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: D:\a\1\s\Enpal.SalesforceCache.Client\bin\Release\net6.0\Enpal.SalesforceCache.Client.dll [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: Project file item includes which caused reference "D:\a\1\s\Enpal.SalesforceCache.Client\bin\Release\net6.0\Enpal.SalesforceCache.Client.dll". [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: D:\a\1\s\Enpal.SalesforceCache.Client\bin\Release\net6.0\Enpal.SalesforceCache.Client.dll [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
"D:\a\1\s\SalesforceCache.sln" (default target) (1) ->
"D:\a\1\s\SalesforceCache.PerformanceTest\SalesforceCache.PerformanceTest.njsproj" (default target) (8) ->
(CoreCompile target) ->
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VisualStudio\v17.0\Node.js Tools\Microsoft.NodejsToolsV2.targets(64,5): error : TypeScript compiler is not installed. Please execute 'npm install --save-dev typescript' [D:\a\1\s\SalesforceCache.PerformanceTest\SalesforceCache.PerformanceTest.njsproj]
560 Warning(s)
1 Error(s)
Time Elapsed 00:00:45.57
##[error]Process 'msbuild.exe' exited with code '1'.
Finishing: VSBuild
You'll note 'npm install --save-dev typescript' has already been executed in the earlier script and that succeeded.
Then buildAndPushClientNuget/dotnet pack fails with:
Successfully created package 'D:\a\1\a\Enpal.SalesforceCache.Client.1.0.0.51800.nupkg'.
Successfully created package 'D:\a\1\a\Enpal.SalesforceCache.Client.1.0.0.51800.symbols.nupkg'.
C:\hostedtoolcache\windows\dotnet\sdk\6.0.402\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: Found conflicts between different versions of "Microsoft.AspNetCore.Mvc.Core" that could not be resolved. [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\hostedtoolcache\windows\dotnet\sdk\6.0.402\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: There was a conflict between "Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" and "Microsoft.AspNetCore.Mvc.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60". [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\hostedtoolcache\windows\dotnet\sdk\6.0.402\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: "Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was chosen because it was primary and "Microsoft.AspNetCore.Mvc.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was not. [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\hostedtoolcache\windows\dotnet\sdk\6.0.402\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: References which depend on "Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [C:\Users\VssAdministrator\.nuget\packages\microsoft.aspnetcore.mvc.core\2.2.5\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Core.dll]. [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\hostedtoolcache\windows\dotnet\sdk\6.0.402\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: C:\Users\VssAdministrator\.nuget\packages\microsoft.aspnetcore.mvc.core\2.2.5\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Core.dll [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\hostedtoolcache\windows\dotnet\sdk\6.0.402\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: Project file item includes which caused reference "C:\Users\VssAdministrator\.nuget\packages\microsoft.aspnetcore.mvc.core\2.2.5\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Core.dll". [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\hostedtoolcache\windows\dotnet\sdk\6.0.402\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: C:\Users\VssAdministrator\.nuget\packages\microsoft.aspnetcore.mvc.core\2.2.5\lib\netstandard2.0\Microsoft.AspNetCore.Mvc.Core.dll [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\hostedtoolcache\windows\dotnet\sdk\6.0.402\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: References which depend on "Microsoft.AspNetCore.Mvc.Core, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" []. [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\hostedtoolcache\windows\dotnet\sdk\6.0.402\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: D:\a\1\s\Enpal.SalesforceCache.Client\bin\Release\net6.0\Enpal.SalesforceCache.Client.dll [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\hostedtoolcache\windows\dotnet\sdk\6.0.402\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: Project file item includes which caused reference "D:\a\1\s\Enpal.SalesforceCache.Client\bin\Release\net6.0\Enpal.SalesforceCache.Client.dll". [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
C:\hostedtoolcache\windows\dotnet\sdk\6.0.402\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3277: D:\a\1\s\Enpal.SalesforceCache.Client\bin\Release\net6.0\Enpal.SalesforceCache.Client.dll [D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\Enpal.SalesforceCache.Client.AspNet.csproj]
Enpal.SalesforceCache.Client.AspNet -> D:\a\1\s\Enpal.SalesforceCache.Client.AspNet\bin\Release\net6.0\Enpal.SalesforceCache.Client.AspNet.dll
Successfully created package 'D:\a\1\a\Enpal.SalesforceCache.Client.AspNet.1.0.0.51800.nupkg'.
Successfully created package 'D:\a\1\a\Enpal.SalesforceCache.Client.AspNet.1.0.0.51800.symbols.nupkg'.
Enpal.SalesforceCache.Client.Helper -> D:\a\1\s\Enpal.SalesforceCache.Client.Helper\bin\Release\net6.0\Enpal.SalesforceCache.Client.Helper.dll
Successfully created package 'D:\a\1\a\Enpal.SalesforceCache.Client.Helper.1.0.0.51800.nupkg'.
Successfully created package 'D:\a\1\a\Enpal.SalesforceCache.Client.Helper.1.0.0.51800.symbols.nupkg'.
##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
##[error]Dotnet command failed with non-zero exit code on the following projects :
Finishing: dotnet pack
No idea what to make of it, but the warnings precede adding k6 and while annoying and it would be great to get rid of them, they seem harmless.
How can I fix the pipeline so the build will succeed?
(Actually executing the tests as part of my build process is still an open concern, but I'm not necessarily looking for that answer here.)