Starting a Visual Studio project in CLR for T-SQL integration

I'm using Visual Studio 2017, first of all, you need to start a new project 

After that, create a new class in CLR:


To publish it in production:

 

We can publish in production, but the best recommendation is to copy the files to the destination, also, manually apply the scripts in SQL.

I decided to build a new database called DBA for that kind of deployment, to make it work, I need to allow these configurations:

 

USE DBA
go
 
EXEC sp_changedbowner 'sa'
GO
 
ALTER DATABASE DBA SET trustworthy ON
GO
 
sp_configure 'clr enabled'
GO
 
sp_configure 'clr enabled', 1
GO
 
RECONFIGURE
GO
 
sp_configure 'clr enabled'
GO
 
 
These next steps are not required as long you are getting any errors:
 
--// It will allow your script to run the System C# references 
CREATE ASSEMBLY [System.Runtime.Serialization] FROM 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Runtime.Serialization.dll' WITH PERMISSION_SET = UNSAFE 
 
--// It will allow your script to run the CSharp references 
CREATE ASSEMBLY [microsoft.csharp] FROM 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.CSharp.dll' WITH PERMISSION_SET = UNSAFE