2

I have a WinForm Application which uses the System.Data.SqlClient package for connecting to the database.

If I start the application with Visual Studio (Debug/Release, Any CPU/x86/x64), everything works as expected, but if I create a Release with the Release Wizard (VDROJ-File) I cannot start the application anymore. I always get an exception

System/Microsoft.Data.SqlClient is not supported on this platform

I am using a .NET 6 application and tried already to change System.Data.SqlClient to Microsoft.Data.SqlClient and I also installed all available runtimes (Microsoft.Data.SqlClient.SNI.runtime, runtime.native.System.Data.SqlClient.sni, ...)

I don't know why everything is working when I start the application from Visual Studio, and why it is not working when I install the application with the wizard.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Nehl-IT
  • 523
  • 3
  • 15
  • Did you download following : https://learn.microsoft.com/en-us/sql/connect/ado-net/download-microsoft-sqlclient-data-provider?view=sql-server-ver16 – jdweng Sep 15 '22 at 01:58
  • Yes I already installed everything, otherwise it would not work with vs.. It also works if I publish a "Clickable-Application". The only problem is, that the application does not work, if I create a setup with the vs installer extension (https://learn.microsoft.com/en-us/visualstudio/deployment/installer-projects-net-core?view=vs-2022) – Nehl-IT Sep 15 '22 at 08:28
  • Seem like it is an installer issue. The csproj file is text. If you compare the two csproj files where it works and doesn't work do you see any differences? In the bin folder do you see and dll that are different between working and non working? If you find any differences report to Microsoft. – jdweng Sep 15 '22 at 08:48

1 Answers1

0

I found the problem.. The Installer Extension does not copy all neccesarry files in the folder. It misses applicationname.deps.json. If you copy this file in the install folder, everything works as expected.

See this link

Nehl-IT
  • 523
  • 3
  • 15