My first SQLCLR project is resisting all attempts to deploy...
I get the error
The following error might appear if you deploy a SQL CLR project that
was built for a version of the .NET Framework that is incompatible
with the target instance of SQL Server: "Deploy error SQL01268: CREATE
ASSEMBLY for assembly failed because assembly failed verification". To
resolve this issue, open the properties for the project, and change
the .NET Framework version.
C:...\SqlClr.dll : Deploy error : Could
not create a type for parameter MyModel.Customer customer
The command
select * from sys.dm_clr_properties
returns
directory C:\Windows\Microsoft.NET\Framework64\v2.0.50727\
version v2.0.50727
state CLR is initialized
The Target framework for the project is .NET Framework 2.0
The object referenced in the error message MyModel.Customer is included in the SqlClr project via a Link (Add Existing Item / Add as Link) from another project that is using .NET Framework 4.0, but my understanding is the other project's .NET version should have no bearing.
What might I be missing?
If you are referencing an assembly that is dependent upon .NET 4.0, you're likely in for trouble. My understanding is that SQLCLR assemblies must be based on .NET versions 2.0 through 3.5, because versions 2.x and later prior to 4.0 are really just extensions based on 2.0. That tends to coincide with some information I read recently about an explicit decision for the SQLCLR not to support Framework 4.0.
Related
I just started with Authentication and authorization for SPAs of Dotnet core 3.0 by using
dotnet new angular -o <output_directory_name> -au Individual
and it created a new project with Angular as a client side app and ASP.net core as a backend. Now I want to use MySQL with this template.
I have tried using two providers for this
MySql.Data.EntityFrameworkCore
Pomelo.EntityFrameworkCore.MySql
but both of them are not supported with Entityframework core 3.0 and asking me to downgrade to Entityframework core 2.2. When I downgraded to Entityframework core 2.2 another package named Microsoft.AspNetCore.ApiAuthorization.IdentityServer starts breaking as it requires Entityframework core version 3.0 and above.
Can somebody please tell me how to setup this template of Authentication and Authorization for SPAs for MySQL?
It turned out I had to wait some time for Pomelo Entity Framework Team to release the .NET Core 3.0 Supported version which is available now. All the other things are now working as expected.
I used Visual Studio 2017 to create ASP.NET Web Forms with reference: MySql.data.dll. It works well on my Laptop. I upload all files on my server, I get Compilation Error
Compiler Error Message: CS0246: The type or namespace name 'MySql' could not be found (are you missing a using directive or an assembly reference?)
Web Forms target Framework: 2.0. My server support ASP.NET version 2.0
I have done many ways that I can search. But nothing change.
The last, I tried change version MySql.Data.dll file, change version framework, use some free hosting to test, but same error
You need to install the MySql Connector/NET on the web server.
To solve this problem download MySql.Data.dll from
https://www.cryptool.org/trac/CrypTool2/export/2020/trunk/AppReferences/x64/MySql.Data.dll
Then right click on your project name, click on add reference and select MySql.Data.dll file
I'm trying to create a service to run dtsx packages in .net core 2.1. In .net framework you could reference using Microsoft.SqlServer.Management.IntegrationServices which would allow you to connect to Sql Server and run dtsx packages. Is there a way to reference that in .net core 2.1?
I am currently building a Windows store application using visual studio 2012 in 4.5.1 framework
I have added the reference PresentationCore.dll for the 'bitmapImage' and i am confronted by an error saying 'There has been a mismatch between the processor architecture of the project being build MSIL & processor architecure of presentationCore'
I have tried the method concerning the use of the configuration manager and still seems to not work, would anybody be able to give me any in sight?
PresentationCore.dll is from the Windows Presentation Foundation. You cannot add a WPF DLL to a Windows Store app as you will be mixing between .NETFramework (desktop) and .NETCore (WinRT).
I have a vast library of C/C++ functions, which needs to be called from SQL Server 2008.
I have written a C# adapter class which loads these functions from Win32 DLL with DllImport and exposes them to .Net code. This works perfectly fine in most .Net applications.
Now, I was trying to use the same technique with SQL Server CLR. I create a set of CLR functions and stored procedures, which call the adapter class. This does not work as an attempts to load unmanaged DLL results in System.BadImageFormatException.
I can do this with extended stored procedures, but that method is deprecated and may be discontinued in any new release of SQL Server.
What would be the proper way of calling unmanaged functions from CLR stored procedure? My guess that this should be done out-of-process.
I am trying to make my stored proc call a Web service which exposes these functions. This sounds like a good idea, but so far I am having a problem deploying the SQLCLR assembly which makes Web service call. I cannot load System.ServiceModel.dll assembly version=3.0.0.0, which has dependency on System.Web.dll assembly version 2.0.0.0.
Loading System.Web assembly gives me the following error:
Assembly 'System.Web' references assembly 'system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: version, culture or public key mismatch). Please load the referenced assembly into the current database and retry your request.
I have found the solution for the problem of deploying System.Web assembly. Instead of deploying it from C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.dll, it should be deployed from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\System.Web.dll. Then all other required assemblies get deployed too.
The list of assemblies in the order of deployment:
C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\SMdiagnostics.dll
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\System.Web.dll
C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Messaging.dll
C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.IdentityModel.dll
C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.IdentityModel.Selectors.dll
C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\Microsoft.Transactions.Bridge.dll
Interesing discussion here : MSDN - Unmanaged code in SQL CLR. I suspect it's due to how the DLL's are loaded by the engine. They present a series of options including hosting the code outside the sql server in another service and accessing the code using WCF or perhaps COM. The Final option is to perhaps recompile your code to pure managed C++ but this may not be an option for legacy code.
Understanding CLR Integration in SQL Server 2005 presents more information on how the process works.
To further restrict the code that is allowed to exist and execute
inside SQL Server each assembly must be registered with a set of
permissions. Three pre-defined sets are available to use; SAFE,
EXTERNAL_ACCESS and UNSAFE
...
You should also review CLR Integration Security, and detemrine the trust levels need for the code you're executing and whether you will be able to access use the code within the CLR process anyway.