How to setup Visual Studio to open work items in the IDE?

Open “Tools/Options” and search for “Work Items” tab.

Select “Visual Studio (compatibility mode).

Setting up compatibility mode in Visual Studio
Setting up compatibility mode in Visual Studio.

Read more

How to validate XML file according to schema in C#?

In this example XML document is fully loaded into memory. So, it is not suitable for large files.

//  Creating schema set.
var schemas = new XmlSchemaSet();
schemas.Add("http://creditinfo.com/schemas/Sample/Data", "Data.xsd");

//  Checking document validity according to schema.
var d = XDocument.Load(fileName);
var message = "";

d.Validate(schemas, (o, e) => {
    message += e.Message + Environment.NewLine;
}, true);
if (message != "") {
    throw new Exception(message);
}

How to set up configuration parameters of .NET Core service deployed in Azure?

Connect to deployed service via FTP and open appsettings.json corresponding to release build. Add configuration object having the same structure as assumed by the application.

Example

 "AzureStorageConfig": {
    "ConnectionString": "...",
    "FileContainerName": "..."
 }

Corresponding .NET class has following structure.

 public class AzureStorageConfig
 {
     public string ConnectionString { get; set; }
     public string FileContainerName { get; set; }
 }

It is used as template of constructor parameter.

public class BlobStorage : IStorage
{
    private readonly AzureStorageConfig storageConfig;
    public BlobStorage(IOptions storageConfig)
    {
        this.storageConfig = storageConfig.Value;
    }
}

ASP.NET Core AppSettings for Azure App Service

Deploy ASP.NET Core apps to Azure App Service

Azure Tips and Tricks