Azure Function - Error while import Microsoft.Data.SqlClient dll in Azure function csx file
I have one requirement to use the system.data.sqlclient library in the Azure Function V4 on the portal.
When I tried it this way but it return the error.
Could you please help me how to use the library in the Azure Function on the portal.
This is a run.csx file
using System.Data.SqlClient;
using System;
public static void Run(TimerInfo myTimer, ILogger log)
{
var conn = new SqlConnection("MyConnectionString");
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
}
I am getting this error while executing the function on the portal.
run.csx(7,20): error CS1069: The type name 'SqlConnection' could not be found in the namespace 'System.Data.SqlClient'. This type has been forwarded to assembly 'System.Data.SqlClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly
I have develop function App on the VS Code and use the library it's working fine as well as when I downgrade my function App from V4 to V3. It's working fine with same code but when I am trying to upgrade the function App with V4, it returns the error.