I migrate my project to .NET Core and some things work unexpectedly: For example - i adding package "Npgsql": "3.1.0-alpha6" and write simple
public class Program
{
public static void Main(string[] args)
{
using (var pgConnection = new NpgsqlConnection("Server=localhost;Port=5432;Database=*;User Id=*;Password=*;"))
{
pgConnection.Open();
string sql = @"SELECT COUNT(*) FROM blog.posts";
var cmd = new NpgsqlCommand(sql, pgConnection);
var res = cmd.ExecuteScalar();
Console.WriteLine(res);
}
Console.Read();
}
}
It run OK with Debug run in Visual Studio with dnx-rc1-final. But when I publish it - it can't run, because
System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
This package used by Npgsql and when I try to generate outputs for assembly and try to compile into nuget packages - it's not working.
Why Debug run in Visual Studio find references on System.Net.Security, Version=4.0.0.0 and why published code can't do it ?