I am trying to create a Azure SQL Managed Instance Server CLR Assembly to validate JSON data using JSON schema. The main Stored Procedure uses the Newtonsoft JSON schema DLL. For creating a single binary literal to create the Assembly as required by the Azure SQL server as input to the ‘sp_add_trusted_assembly’ stored procedure, I need to get a single DLL file. I am trying to use ILMerge package to create a single DLL file. Following is my project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net47</TargetFramework>
<LangVersion>5.0</LangVersion>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ilmerge" Version="3.0.41" />
<PackageReference Include="Microsoft.Build.Framework" Version="17.12.6" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.12.6" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.12.6" />
<PackageReference Include="Microsoft.SqlServer.Compact" Version="4.0.8876.1" />
<PackageReference Include="MSBuild.ILMerge.Task" Version="1.1.3" />
<PackageReference Include="newtonsoft.json.schema" Version="4.0.1" />
<PackageReference Include="System.Collections" Version="4.3.0" />
</ItemGroup>
`enter code here`</Project>
I have installed IL Merge from the Nuget package location. The package I am using is msbuild.ilmerge.task V 1.1.3
When running the build I am getting following error:
error MSB4062: The "MSBuild.ILMerge.Task" task could not be loaded from the assembly
C:\Users\cb38j.nuget\packages\msbuild.ilmerge.task\1.1.3\build
\tools\MSBuild.ILMerge.Task.dll. Could not load file or assembly
'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the
declaration is correct, that the assembly and all its dependencies are available,
and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
How can I create an assembly in CLR which uses multiple libraries?