In Microsoft SQL Server, I want to call a dll assembly as a trigger
This is my C# code :
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WriteTimeInfile
{
public class Program
{
public static void Main(string[] args)
{
File.AppendAllText(@"C:\Users\Vivien\Desktop\date.txt",
DateTime.Now.ToString() + Environment.NewLine);
}
}
}
This is my properties panel:
Then I create the assembly in SQL Server, it seems to work and create an assembly:
CREATE ASSEMBLY triggertest
FROM 'C:\Users\Vivien\Documents\visual studio 2015\Projects\WriteTimeInfile\WriteTimeInfile\bin\Release\WriteTimeInfile.dll'
WITH PERMISSION_SET = SAFE
But when I try to create the trigger, i try to do like it is explained in this link:
CREATE TRIGGER tri_Publishes_clr
ON STATION
FOR INSERT
AS EXTERNAL NAME triggertest.[WriteTimeInfile.WriteTimeInfile.Program].Main
I get an error
Could not find Type 'WriteTimeInfile.WriteTimeInfile.Program' in assembly 'WriteTimeInfile'.
Nothing works
Could you help me please?

PERMISSION_SET = SAFEand writing to a file won't work either.SAFEwon't work here. Please see the two notes I just added to the my answer (under the line).