I have a solution with target framework of 4.7.1. I have locally installed dotnet core sdks and able to issue build, publish commands.
My project file looks like this, with many references to dotnet core dlls
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net471</TargetFramework>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.3.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.4.1" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="2.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Session" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.0">
I have errors in Azure DevOps yaml while trying to use a specific .net sdk to build this solution.
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '2.x'
- task: DotNetCoreCLI@2
inputs:
command: 'build'
workingDirectory: '$(solution)'
The error reads There was an error when attempting to execute the process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe'. This may indicate the process failed to start. Error: spawn C:\hostedtoolcache\windows\dotnet\dotnet.exe
More importantly, I am not sure which dotnet core version should I use to build this project?
Locally, I have dotnet 5 sdk and able to publish successfully using dotnet publish commands. What commands should I ideally use in DevOps to build a net471 project?
Thanks, AK