Results 1 to 9 of 9

Thread: System.Data.SqlClient not found at run-time (installed release .exe)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2022
    Posts
    83

    System.Data.SqlClient not found at run-time (installed release .exe)

    I am using the VS2022 template (project) for setup and deployment. I am not using any sql in the Winform app (.NET 7.0). Occasionally, when compiling (building) the assembly, the assembly will populate a listing of System.Data.SqlClient in the setup dependencies. If I manually delete the System.Data.SqlClient dependency in the setup project, then build the setup, there are no issues.

    However, with the latest version of VS (Pro), I started noticing the exception System.Data.SqlClient not found during run-time of the installed .exe (bulit in \Release\bin). Whether or not this is due to the latest update of VS, I am wondering how to stop the compiled/installed app assembly from *looking for* System.Data.SqlClient. I have all the namespaces (Imports...) removed that mention Sql. The attached pic is from actual run-time of the installed .exe

    Name:  sql.jpg
Views: 395
Size:  15.6 KB

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    109,986

    Re: System.Data.SqlClient not found at run-time (installed release .exe)

    Unless something is broken, it would only be including the assembly in the installer if you have referenced it in the application project. Remove the reference and there should be no issue, I would think.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    109,986

    Re: System.Data.SqlClient not found at run-time (installed release .exe)

    The VB.NET forum is for questions about VB.NET. Questions about installers belong in the Application Deployment forum. Thread moved.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2022
    Posts
    83

    Re: System.Data.SqlClient not found at run-time (installed release .exe)

    Thanks!

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2022
    Posts
    83

    Re: System.Data.SqlClient not found at run-time (installed release .exe)

    Since I am using JSON, there are numerous JSON dependencies for System.Data.SqlClient listed throughout the app. Thus, I made sure the latest assembly was installed using Nuget, and the Imports System.Data.Sqlclient was listed at the top of the namespace listings. The I qui and rstarted VS2022 compiled, built the setup app and I still get the same error at run-time. So what's happening is that the app assembly is looking for version 4.6.0.0 (see pic above), even though I am using the redirect in app.config as follows:

    Code:
    	<dependentAssembly>
    		<assemblyIdentity name="System.Data.SqlClient" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    		<bindingRedirect oldVersion="0.0.0.0-4.6.0.0" newVersion="4.8.5.0" />
    	</dependentAssembly>
    By the way, I used the publicKeyToken of the new version (4.8.5), but at run-time the app assembly is not recognizing the redirect. Last, I searched "Entire Solution" for 4.6.0 and found nothing. So where could the reference call to an old assembly be coming from and why is the redirect not working?

  6. #6
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,383

    Re: System.Data.SqlClient not found at run-time (installed release .exe)

    Since I am using JSON, there are numerous JSON dependencies for System.Data.SqlClient listed throughout the app.
    Yeah, that's not tracking for me ... I don't see what JSON has to do with SQLClient in anyway... they're two separate animals. What library did you install for JSON parsing? I've been doing some work with JSON lately too, but never needed SQLClient ...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Mar 2022
    Posts
    83

    Re: System.Data.SqlClient not found at run-time (installed release .exe)

    On the other hand, if I uninstall system.data.sqlclient in nuget, and make sure the imports does not include the namespace, why is the app looking for the sql assembly?

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    109,986

    Re: System.Data.SqlClient not found at run-time (installed release .exe)

    Perhaps you should look at the stack trace for the exception to see where it's being thrown.

  9. #9
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,383

    Re: System.Data.SqlClient not found at run-time (installed release .exe)

    Quote Originally Posted by pel11 View Post
    On the other hand, if I uninstall system.data.sqlclient in nuget, and make sure the imports does not include the namespace, why is the app looking for the sql assembly?
    What library did you install for JSON parsing?


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width