AutoCAD 2025 .NET Core, Microsoft.Data.Sqlclient

AutoCAD 2025 .NET Core, Microsoft.Data.Sqlclient

kevin.bza
Advocate Advocate
2,627 Views
4 Replies
Message 1 of 5

AutoCAD 2025 .NET Core, Microsoft.Data.Sqlclient

kevin.bza
Advocate
Advocate

Greetings,
This guide helped a lot ... THANK YOU ...


https://info.quuxsoft.com/ftp/Migration_NET_Core%20English.pdf

 

My upgraded DLL for ACAD 2025 almost works.

Using the NUGET Microsoft.Data.Sqlclient, I managed to connect with the SQL server and run a query from a Windows Forms Desktop development.

Why is the entire dependent package output to the Debug folder on building the exe?
and I noticed a DLL with the sma name as the EXE in the Debug folder - why?

The DLL for ACAD does not connect to the SQL Server.
(Same code as the Windows Forms Desktop) - except ... the library contents were not copied to the Debug folder on building the DLL.
Error ....
The type of initializer ..... TSDPARSER threw an exception. on trying to connect to the SQL Server.

Thx for your patience,

I missed something .. maybe many somethings....

K.

0 Likes
Accepted solutions (1)
2,628 Views
4 Replies
Replies (4)
Message 2 of 5

kevin.bza
Advocate
Advocate
Accepted solution

Solved!  : )

In my case I just needed to include access to this file  .....  Microsoft.Data.SqlClient.SNI.dll

 

0 Likes
Message 3 of 5

jayala_com
Community Visitor
Community Visitor

Hi, I'm getting the same error, but with REVIT 2025, would you add more details to the solution?

I appreciate any help you can provide.

0 Likes
Message 4 of 5

norman.yuan
Mentor
Mentor

You need to edit the *.csproj file (right-click the project, then select "Edit project file") and add these 2 lines in the <PropertyGroup> section:

 

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

You can also use

<EnableDynamicLoading>true</EnableDynamicLoading>

 

instead of <CopyLocalLockFileAssemblies>. You may want to search the net for the differences between the two. Basically, both of them would copy the dependency DLLs from the Microsoft.Data.SqlClient Nuget package (or any Nuget package, for that matter) into the plugin (AutoCAD, or Revit) DLL output folder, when you compile the code with Visual Studio.

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 5

steve.ruff
Autodesk
Autodesk

I was having this problem with a Revit addin targeting versions 2020-2025. All build configs targeting net48 worked great, but the Revit 2025 version was unable to find "Microsoft.Data.SqlClient.SNI.dll". Adding the single property <RuntimeIdentifier>win-x64</RuntimeIdentifier> to my addin's .csproj file resolved the issue for me. Thank you @norman.yuan for the suggestion!