When I try to create assembly in SQL 2008 from .Net assembly (.Net 3.5) I am getting the below error, error says that I have to set either of the below properties as true, h
This works for:
In your project settings, select "External Access":
On publish, the error message says that it cannot accept "EXTERNAL_ACCESS" unless the assembly is set to "Trustworthy".
So, in the project settings, set the assembly to "Trustworthy":
This meant that I was able to run a sample user defined function that listed files on the local hard drive.
If the security is still too restrictive, add the attribute DataAccess = DataAccessKind.Read
to your UDF, e.g.:
[Microsoft.SqlServer.Server.SqlFunction(FillRowMethodName = "FindFiles", DataAccess = DataAccessKind.Read, TableDefinition = "FileName nvarchar(500), FileSize bigint, CreationTime datetime")]
On SQL Server 2016
+ Visual Studio 2015
, you might also have to do the following:
use master;grant unsafe assembly to [Domain\Username];
Administrator
mode to give them sufficient permissions to publish UNSAFE
assemblies.If nothing works, try connecting using username sa
and your administrator password. This will always work, regardless of whether Visual Studio is run in Administrator
mode or not.
Updated list of compatible VS + SQL Server combinations.