Similar question:
Let's say we have a basic .NET Standard library, which references an external DLL we got from Nuget such as System.Data.SqlClient
.
A class relies on the external DLL to function:
namespace BasicLibrary
{
public class Class1
{
public void Method()
{
var foo = new System.Data.Sql.SqlNotificationRequest();
}
}
}
We now build our library, targeting .NET Standard 2.0.
After doing that, we create a sample Console Application (.NET Core 3.0) and we add a reference to the library we previuosly built.
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
var bar = new BasicLibrary.Class1();
bar.Method();
}
}
}
The code builds fine, but as expected it crashes because it is missing a reference to System.Data.SqlClient
System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Data.SqlClient, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Is there a way to check at build time for missing assemblies?