SQL Connection in Vault 2026 with .net 8

SQL Connection in Vault 2026 with .net 8

matt_mwe
Participant Participant
627 Views
6 Replies
Message 1 of 7

SQL Connection in Vault 2026 with .net 8

matt_mwe
Participant
Participant

Hello everyone,

 

I'm struggling currently with migrating my Vault Add-In to .net 8

Especially with the task of migrating "System.Data.SQL".

I tried also the new "Microsoft.Data.SQL" but it always run in a "System.PlatformNotSupportedException: 'Microsoft.Data.SqlClient is not supported on this platform.'" error.

 

I also tried to fix from this post Solved: SQL Connection in AutoCAD 2025 - Autodesk Community, but it didn't work out for me.

 

What I tried so far:

- Adding <RuntimeIdentifier>win-x64</RuntimeIdentifier> in the Project file

- Putting all the DLL's next to the Addin DLL

- Trying it with the obsolete "System.Data.SQL" package

 

Does anyone have a working solution on that?

0 Likes
Accepted solutions (1)
628 Views
6 Replies
Replies (6)
Message 2 of 7

Nick_Hall
Collaborator
Collaborator
Accepted solution

Hi Matt

 

I've just migrated a Vault add-in to 2026/.net 8, and I had to

 

  1. Use Microsoft.Data.Sqlclient
  2. Copy these files to the output folder
    %USERPROFILE%\.nuget\packages\microsoft.data.sqlclient.sni.runtime\6.0.2\runtimes\win-x64\native\Microsoft.Data.SqlClient.SNI.dll
    %USERPROFILE%\.nuget\packages\microsoft.data.sqlclient\6.0.2\runtimes\win\lib\net8.0\Microsoft.Data.SqlClient.dll

After that, everything worked fine.

 

Hope that helps

Nick

0 Likes
Message 3 of 7

matt_mwe
Participant
Participant

Thank you very much!

This worked for me too.

 

@Nick_Hall: Could you provide any source, how you figured that out?

 

0 Likes
Message 4 of 7

Nick_Hall
Collaborator
Collaborator

Hi Matt

 

I started with this search - "Microsoft.Data.SqlClient is not supported on this platform"- from one error message I got when debugging.

 

This led me to this article - https://learn.microsoft.com/en-us/answers/questions/1663112/microsoft-data-sqlclient-5-2-0-fails-to-...

 

There is a reply from Tacito Fieker (it's first when you order by "most helpful") which says 

 

It was necessary to copy the file: "....nuget\packages\microsoft.data.sqlclient\5.2.2\runtimes\win\lib\net8.0\Microsft.Data.SQLClient.dll" to the BIN folder.

I also needed to copy: Microsoft.Data.SqlClient.SNI.dll & Microsoft.Identity.Client.dll

 

Then I dug around in %USERPROFILE%\.nuget and found the files I thought I would need. After some trial & error, I ended up with just the two I noted before.

 

It wasn't as quick as that description sounds, though. I went down the wrong path a few times before I got there.

 

Nick

 

Message 5 of 7

matt_mwe
Participant
Participant

@Nick_Hall Thank you for providing that.

 

Interesting enough that you have to use the packages from the .nuget folder. I tried it with the DLL's from a dummy console application that referenced `Microsoft.Data.SqlClient` without success.

0 Likes
Message 6 of 7

david.siegert63GB8
Participant
Participant

Hello @matt_mwe @Nick_Hall,

 

I found a cleaner solution and an explanation why Nicks solution works.

There are two things.

1) <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> add in your .csproj
 - OutputType Library by default does not copy dependencies to OutDir (Which makes sense, bcease this should only happen in the application that uses the library - there all dependencies should be copied). But because we build plugins, we need all dependencies with our library. This is what the Property CopyLocalLockFileAssemblies does.

 - There is also property EnableDynamicLoading, which does the same thing and a bit more: https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#enabledynamicloading

2) <RuntimeIdentifier>win-x64</RuntimeIdentifier> add in your .csproj

When you reference a nuget like Microsoft.Data.SqlClient, which includes native and runtime platform specific dlls which are now (when we use CopyLocalLockFileAssemblies)copied to outdir\runtimes directory. We need to tell the compiler which runtime dlls to copy to outdir thats where RuntimeIdentifier comes in.

 

TLDR;

add this to your csproj

<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

 

The result is that both dlls that Nick mentions in his solution are automatically copied to outdir.

 

 

Message 7 of 7

Nick_Hall
Collaborator
Collaborator

Thanks, David, that's really useful to know.

 

It would be helpful to have this information in the Vault SDK Help. Maybe @Markus.Koechl can help with that?

 

Nick