LocalDB named instance via the named pipes pipe name using Microsoft.Data.SqlClient

Connection string

This Microsoft SqlClient Data Provider for SQL Server connection string can be used for connections to SQL Server 2019, SQL Server 2017, SQL Server 2016, SQL Server 2014 and SQL Server 2012.

The Server=(localdb) syntax is not supported by .NET framework versions before 4.0.2. However the named pipes connection will work to connect pre 4.0.2 applications to LocalDB instances.

Server=np:\\.\pipe\LOCALDB#F365A78E\tsql\query;

Executing SqlLocalDB.exe info MyInstance will get you (along with other info) the instance pipe name such as "np:\\.\pipe\LOCALDB#F365A78E\tsql\query".