Posted on Leave a comment

error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again

When you try to build a .NET6 solution using .NET7 as the latest installed version of SDK you may notice the below issue.

C:\Program Files\dotnet\sdk\7.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(376,5): error NETSDK1127: The targeting pack Microsoft.NETCore.App is not installed. Please restore and try again.

This issue is related to some variables that are not set properly and the right location for the tools cannot be determined although they are installed inside the operating system.

The task is using the default .NET runner of Teamcity and the default MSbuild version is set to Cross-platform MSBuild.

Switch to another version of MSBuild will most probably resolve the issue. For example in the setup I was working switching to MSBuild Tools 2022 removed the issue and build could be performed successfully.

Posted on Leave a comment

Get /app/metrics remote error: tls handshake failure – Promotheus

Teamcity can be integrated with Grafana in order to gather statistics about builds and agents activity. In order to gather those teamcity metrics you will need a prometheus installation and then a configuration for the teamcity source.

When you connect teamcity as a target on prometheus you have two options regarding an https secure communication. Either you trust the not verified certificate and place that in the configuration file, or you should enable tls communication with certificates between teamcity and prometheus.

If you do not set one of the two options on prometheus you might end up with the issue:

Get /app/metrics remote error: tls handshake failure

The first option as discussed would be to trust the insecure certificate using https.

tls_config:
      insecure_skip_verify: true

The second option would be to communicate through certificates. First create a new folder inside your Prometheus installation and store the certificates for the teamcity server. Then you will need to point the files in the configuration.

    tls_config:
       ca_file:  /var/prometheus/ssl/signalocean.com.crt

The detailed options for tls_config in prometheus can be found below.

Configuration | Prometheus