Yellow triangle in Visual Studio Package References

There are so many different reasons of getting this generic error. My particular use case is impacted by gitignore file. The project is configured to use package configuration and the lib (dll) were ignored in gitignore file.

I had a working solution on my local. I commited this solution to ADO main. I went to ADO and created a working branch from main branch. I open working branch and started getting these yellow triangles.

I decided to use MVC package as a test case. These are working solution lib files;

These are not working solution lib files (branch created from main).

You can see “System.Web.Mvc.dll” is missing in second picture.

How did I fix it?

The simplest way is to go to main branch in ADO and delete packages folder;

  1. Clone the repository locally
  2. Make the changes to the local version
  3. Commit the changes locally
  4. Push the changes back up to the GitHub repository

Goto each file and select Git and Add;

The folder will be back in the view;

Make sure to comment this line in gitignore file;

# NuGet Packages
# *.nupkg
# The packages folder can be ignored because of Package Restore
# SHAHZAD - Don't uncomment this line
# **/packages/*
# except build/, which is used as an MSBuild target.
# !**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
# *.nuget.props
# *.nuget.targets

Problem solved.

What is X.509 certificate?

X.509 is a standard format for public key certificates, digital documents that securely associate cryptographic key pairs with identities such as websites, individuals, or organizations.

First introduced in 1988 alongside the X.500 standards for electronic directory services, X.509 has been adapted for internet use by the IETF’s Public-Key Infrastructure (X.509) (PKIX) working group

Common applications of X.509 certificates include:

  1. SSL/TLS and HTTPS for authenticated and encrypted web browsing
  2. Signed and encrypted email via the S/MIME protocol
  3. Code signing
  4. Document signing
  5. Client authentication
  6. Government-issued electronic ID

For more info, read below;

X.509 FAQ

Hosting multiple domain under one app service

Azure DevOps .NETFramework Version not found

Running build pipeline for a web application targeting .NETFramework Version 4.6.1 using 2022 build agent, I have received this error;

The reference assemblies for .NETFramework,Version=v4.6.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks 

The solution is to change the build agent to 2019.

Using appsettings.json in Asp.net core 6 Program.cs file

In case that we have in appsettings;

"settings": {
    "url": "myurl",
    "username": "guest",
    "password": "guest"
  }

and we have the class;

public class Settings
    {
        public string Url { get; set; }
        public string Username { get; set; }
        public string Password { get; set; }
    }

we can use also;

var settings = builder.Configuration.GetSection("Settings").Get<Settings>();

var url = settings.Url;

Reference

https://stackoverflow.com/questions/69390676/how-to-use-appsettings-json-in-asp-net-core-6-program-cs-file