Azure DevOps Pipelene doesn't compile .netstandard 2.0 projects - azure-devops

I'm stuck in a rut with this proble. After converting some solution projects in .netstandard 2.0 the pipeline doesn't compile. Other are .NET Framework 4.8 projects.
Here the errors
Installed SDKs: No .NET SDKs were found.
Install the [6.0.400] .NET SDK or update
[E:\myApplicationFolder\global.json] to match an installed SDK.
Download a .NET SDK: https://aka.ms/dotnet-download
I tried the following steps:
installed VS 2022 and tells to the pipeline to use VS 2022 msbuild
installed the .NET sdk
created the global.json choerent with the solution
checked the environment variables (they point to C:\Program Files\dotnet)
checked the version of .NET SDK
This is the global.json
{
"sdk": {
"version": "6.0.400"
}
}
There are the configuration on the pipeline
I don't have any troubles building the solution with msbuild from powershell.
Any other suggestions? Thanks

Many problems, Azure DevOps isn't updated to the latest version and can't manage .NET 6.0 solutions. I had to specify the msbuild of VS 2022 also to restore nuget packages

Related

Azure Devops - Compatibility problems moving from .NET Core 3.1 to .NET 5 at Nuget Package

I have a .NET Core solution which was running well using .NET Core 3.1 using a Pipeline on Azure Devops. Everything was working fine on the Pipeline.
After moving from .NET Core 3.1 to .NET 5.0, I started to have some strange troubles running the pipeline, specifically with Nuget packages.
I can build with no problems, but when it starts to pack using Nuget Package, I've got this error:
[error] The nuget command failed with exit code(1)
NU1202: Package Microsoft.EntityFrameworkCore 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0). Package Microsoft.EntityFrameworkCore 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
Some weird fact is that this solution is running fine at the local machine.
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.8.8.9</Version>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
I already tried to change the OS on the Build, but I've got this error:
The current available version of MSBuild is 16.7.0.37604. Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently available.
Does someone have an idea?
Package Microsoft.EntityFrameworkCore.Relational 5.0.0 supports:
netstandard2.1 (.NETStandard,Version=v2.1)
This is because it was using an old version of Nuget. You can try to change it to 5.x and restore.
Here is a case with similar issue you can refer to.

Does Azure Pipeline Support .NET Core 3.1.7?

This is the error I get:
This is my configuration:
Can anyone help me?
I fix that for the latest .NET release.
The issue can be fixed with this line of code in your pipeline (.yaml) file.
steps:
- task: UseDotNet#2
displayName: 'Use .NET Core sdk 6.0.x'
inputs:
version: 6.x
includePreviewVersions: true
Just add the above step to your YAML file.
When you set the .NET Core SDK version to 3.x, it automatically download and install the latest in major version SDK 3.1.401, but SDK 3.1.401 is included in
Visual Studio 16.7.1. Since the hosted agent installed Visual Studio 16.6.30320.27, which doesn't include SDK 3.1.401, you would get the error during the build.
Currently, you could set the .NET Core SDK version to 3.1.302, or 3.1.107, which should solve your issue.
https://dotnet.microsoft.com/download/dotnet-core/3.1
This issue has been reported to product team in the following case, you can follow the case to track the status:
https://developercommunity.visualstudio.com/content/problem/1145815/net-coremsbuild-tooling-not-finding-right-version.html

Dotnet restore not working

dotnet Version: 1.1.0 (global.json)
NuGet Version : 4.4.1.4656
VS2017 v15.5.2 (as Administrator)
.NET Core 1.1
The solution I am trying to build
Update I:
I just changed the project to run under target framework .NET Core v2.0 & sdk version 2.1.3 and I only get these kind of errors:
Severity Code Description Project File Line Suppression State
Error NU1202 Package Microsoft.Extensions.FileProviders.Physical 1.1.0
is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0).
Package Microsoft.Extensions.FileProviders.Physical 1.1.0 does not
support any target
frameworks. AspNetCoreExample C:\Users\Admin\Source\Repos\Examples\src\AspNetCoreExample\AspNetCoreExample.csproj 1
Update II:
While the following solves the current issue, i am not sure if it solves the root cause for this issue.
Delete the global nuget.config file %AppData%/Nuget/Nuget.config.
I fixed this issue by doing the following:
I migrated the project to .net core 2.0 and changed the global.json to point to sdk 2.1.3.
Removed all references in AspNetCoreExample manually and added the latest version for all of them.
Issues with target framework 1.1
When doing a restore from the solution in VS 2017:
When doing the restore from cmd (dotnet restore)
Running dotnet restore in Package Manager Console
NuGet.targets(103,5): error : Access to the path 'System.Runtime.dll'
is denied
.NET Core SDKs installed:
.NET Host
Now when opening the solution I get:
Comparing the log entries you pasted to their AppVeyor build,
https://ci.appveyor.com/project/Autofac/examples
Your machine's NuGet configuration seems to be broken. Analyze that and fix the issues.
You should add this code to your .csproj file
<RuntimeFramework>2.0.3</RuntimeFramework>
This worked for me.

Visual Studio Team Services ASPNET CORE build failure

I'm trying to setup a build definition for a new ASPNET Core webapp.
The setup of the build definition is exactly this:
Official Docs
The build fails at building the solution with this error:
Issues
Build
File name doesn't indicate a full path to a executable file.
GETSDKTOOLINGINFO (0, 0)
The project is configured to use .NET Core SDK version 1.0.0-preview2-003131 which is not installed or cannot be found under the path C:\Program Files\dotnet. These components are required to build and run this project. Download the version of .NET Core SDK specified in global.json or update the SDK version in global.json to the version that is installed.
Process 'msbuild.exe' exited with code '1'.
Any guess on how to solve this?
Thanks
Francesco
You need to install the corresponding version of .Net SDK to build agent machine.
You can refer to this article to download .Net Core 1.0.0-preview2-003131 and install it on your build machine.
Assuming you are using hosted build agent. According to Software on the hosted build server, the hosted build server is deployed with the following .NET Framework:
.NET 4.6
.NET 4.5.2
.NET 4.5.1
.NET 4.5
.NET 3.5 SP1
.NET Core 1.0 with Preview 2 Tooling
You may try to deploy an on-premises build agent and install .NET Core 1.0.1 SDK 1.0.0-preview2-003131 to work with VSTS: https://www.visualstudio.com/en-us/docs/build/admin/index#deploy_agent.
If you insist on using hosted build agent, then you need to use version of Microsoft.NETCore.App that is installed in VSTS, for example:
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
In my case, it was just a change in global.config:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003121"
}
}
As long as 1.0.0-preview2-003131 is not available on VSO build hosts

Build error on Appveyor with newest ASP.NET 5

I'm trying to build an ASP.NET 5 web api and build it on Appveyor. I get this error:
Build started
git clone -q --branch=master https://github.com/nikolaschou/TodolistService01.git C:\projects\todolistservice01
git checkout -qf 3c97bb95ecf54662069b6ae8fa25a60f598a564d
msbuild "TodolistService.sln" /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
Microsoft (R) Build Engine version 14.0.24720.0
Copyright (C) Microsoft Corporation. All rights reserved.
Cannot find DNX runtime dnx-clr-win-x86.1.0.0-rc1-update1 in the folder: C:\Users\appveyor.dnx\runtimes
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets(126,5): error : The Dnx Runtime package needs to be installed. See output window for more details. [C:\projects\todolistservice01\src\TodolistService\TodolistService.xproj]
Command exited with code 1
This project is based on .NET framework 4.6.1 and ASP.NET 5. The references are DNX 4.5.1 and DNX Core 5.0.
Feel free to reproduce the error by building this public repository:
https://github.com/nikolaschou/TodolistService01
Can anyone explain why it fails? Is Appveyor not yet ready for these new versions?
Basically, you have to do two things:
install .NET framework
restore packages
This is appveyor.yml to build your project:
os: Visual Studio 2015
install:
- dnvm upgrade -r clr
- dnu restore
build:
verbosity: minimal
Build results: https://ci.appveyor.com/project/FeodorFitsner/todolistservice01
Also, you may need to select right version in your global.json:
{
"sdk": {
"version": "1.0.0-rc1-final"
}
}