Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.Net Core Web API Exception - Can't Find System.Data.Linq

ASP.Net Core Web API Exception - Can't Find System.Data.Linq

Scheduled Pinned Locked Moved Web Development
csharpasp-netdotnethelpwpf
11 Posts 5 Posters 20 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Kevin Marois

    I have an existing WPF app with a BL and DAL all written in .Net 4.5.2, I'm now trying to call the DAL from a new Asp.Net Core 5.0 Web API. I pass through the Controller into the BL fine, but when I hit the line that calls into the DAL it throws

    System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.'

    System.Data.Linq isn't in the WPF app's bin folder because it's a .net assembly. I tried copying it into the Web API's Bin folder but that didn't work. Is there some problem with me calling a .Net 5 Core Wab API from a WPF app?

    If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

    D Offline
    D Offline
    Dave Kreskowiak
    wrote on last edited by
    #2

    As far as I know, no, you cannot use a .NET Framework 4.5.2 .DLL in a .NET Core 5 app. You could migrate the 4.5.2 code to .NET Standard 2, then you could use it in both Framework and Core apps, but this solution is not ideal. You best solution would be to migrate your WPF and libraries to .NET Core 5.

    Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
    Dave Kreskowiak

    K 1 Reply Last reply
    0
    • D Dave Kreskowiak

      As far as I know, no, you cannot use a .NET Framework 4.5.2 .DLL in a .NET Core 5 app. You could migrate the 4.5.2 code to .NET Standard 2, then you could use it in both Framework and Core apps, but this solution is not ideal. You best solution would be to migrate your WPF and libraries to .NET Core 5.

      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
      Dave Kreskowiak

      K Offline
      K Offline
      Kevin Marois
      wrote on last edited by
      #3

      Wow, that $ucks. The end goal is to stand up an API so I can hit it from both the WPF app and a Xamarin Forms app. I could still do this using a .Net Framework Web API.

      If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

      realJSOPR 1 Reply Last reply
      0
      • K Kevin Marois

        I have an existing WPF app with a BL and DAL all written in .Net 4.5.2, I'm now trying to call the DAL from a new Asp.Net Core 5.0 Web API. I pass through the Controller into the BL fine, but when I hit the line that calls into the DAL it throws

        System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.'

        System.Data.Linq isn't in the WPF app's bin folder because it's a .net assembly. I tried copying it into the Web API's Bin folder but that didn't work. Is there some problem with me calling a .Net 5 Core Wab API from a WPF app?

        If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #4

        LINQ to SQL has been effectively end-of-life since 2009. It was never ported to .NET Core or .NET 5/6/... The recommended workaround is to switch to using Entity Framework Core. But that's obviously a huge change, and will require a lot of testing, since some of your queries may no longer work, and the behaviour will be different in some cases. There's a third-party clone of L2S which is marked as .NET Standard 2.0, so it might work for you: NuGet Gallery | Mindbox.Data.Linq 5.0.0[^] GitHub - mindbox-moscow/data-linq: A clone of Microsoft System.Data.Linq to allow multi-DLL extensibility and EF compatibility.[^]


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        K realJSOPR 2 Replies Last reply
        0
        • Richard DeemingR Richard Deeming

          LINQ to SQL has been effectively end-of-life since 2009. It was never ported to .NET Core or .NET 5/6/... The recommended workaround is to switch to using Entity Framework Core. But that's obviously a huge change, and will require a lot of testing, since some of your queries may no longer work, and the behaviour will be different in some cases. There's a third-party clone of L2S which is marked as .NET Standard 2.0, so it might work for you: NuGet Gallery | Mindbox.Data.Linq 5.0.0[^] GitHub - mindbox-moscow/data-linq: A clone of Microsoft System.Data.Linq to allow multi-DLL extensibility and EF compatibility.[^]


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          K Offline
          K Offline
          Kevin Marois
          wrote on last edited by
          #5

          I could stand up a .Net Core API using a new DAL with EF and slowly port things over.

          If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

          A 1 Reply Last reply
          0
          • K Kevin Marois

            Wow, that $ucks. The end goal is to stand up an API so I can hit it from both the WPF app and a Xamarin Forms app. I could still do this using a .Net Framework Web API.

            If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

            realJSOPR Offline
            realJSOPR Offline
            realJSOP
            wrote on last edited by
            #6

            I'm convinced that Core is a steaming pile of shit. But that's just me. Now, instead of having one common assembly, I have to have two - one for framework, and one for whore core, which defeats the purpose of having a common library.

            ".45 ACP - because shooting twice is just silly" - JSOP, 2010
            -----
            You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
            -----
            When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

            Richard DeemingR 1 Reply Last reply
            0
            • Richard DeemingR Richard Deeming

              LINQ to SQL has been effectively end-of-life since 2009. It was never ported to .NET Core or .NET 5/6/... The recommended workaround is to switch to using Entity Framework Core. But that's obviously a huge change, and will require a lot of testing, since some of your queries may no longer work, and the behaviour will be different in some cases. There's a third-party clone of L2S which is marked as .NET Standard 2.0, so it might work for you: NuGet Gallery | Mindbox.Data.Linq 5.0.0[^] GitHub - mindbox-moscow/data-linq: A clone of Microsoft System.Data.Linq to allow multi-DLL extensibility and EF compatibility.[^]


              "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

              realJSOPR Offline
              realJSOPR Offline
              realJSOP
              wrote on last edited by
              #7

              Instead of doing all that, just roll your own DAL and do either sql queries or stored procs to get/put data. You have much more control in a smaller package without having to understand or deal with how Microsoft thinks the world of database access should work. Generally speaking all ORM tools are garbage.

              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
              -----
              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
              -----
              When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

              1 Reply Last reply
              0
              • realJSOPR realJSOP

                I'm convinced that Core is a steaming pile of shit. But that's just me. Now, instead of having one common assembly, I have to have two - one for framework, and one for whore core, which defeats the purpose of having a common library.

                ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                -----
                You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                -----
                When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                Richard DeemingR Offline
                Richard DeemingR Offline
                Richard Deeming
                wrote on last edited by
                #8

                #realJSOP wrote:

                Now, instead of having one common assembly, I have to have two

                Or have one that targets .NET Standard 2.0, which should generally work in .NET Framework 4.7.2 or later, .NET Core 2.0 or later, and .NET 5/6/etc. .NET Standard | Microsoft Docs[^] And if you really need to use features which aren't available in .NET Standard, you can target multiple frameworks in a single project[^] (so long as it's a new "SDK"-style project). It's a PITA, but it works.


                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                K 1 Reply Last reply
                0
                • Richard DeemingR Richard Deeming

                  #realJSOP wrote:

                  Now, instead of having one common assembly, I have to have two

                  Or have one that targets .NET Standard 2.0, which should generally work in .NET Framework 4.7.2 or later, .NET Core 2.0 or later, and .NET 5/6/etc. .NET Standard | Microsoft Docs[^] And if you really need to use features which aren't available in .NET Standard, you can target multiple frameworks in a single project[^] (so long as it's a new "SDK"-style project). It's a PITA, but it works.


                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                  K Offline
                  K Offline
                  Kevin Marois
                  wrote on last edited by
                  #9

                  I just need to get an API up & running. I have no reason to target .Net Core, so .Net Framework would be fine.

                  If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

                  1 Reply Last reply
                  0
                  • K Kevin Marois

                    I have an existing WPF app with a BL and DAL all written in .Net 4.5.2, I'm now trying to call the DAL from a new Asp.Net Core 5.0 Web API. I pass through the Controller into the BL fine, but when I hit the line that calls into the DAL it throws

                    System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.'

                    System.Data.Linq isn't in the WPF app's bin folder because it's a .net assembly. I tried copying it into the Web API's Bin folder but that didn't work. Is there some problem with me calling a .Net 5 Core Wab API from a WPF app?

                    If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

                    A Offline
                    A Offline
                    aquatecinnovativee
                    wrote on last edited by
                    #10

                    Laravel Development Services

                    1 Reply Last reply
                    0
                    • K Kevin Marois

                      I could stand up a .Net Core API using a new DAL with EF and slowly port things over.

                      If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.

                      A Offline
                      A Offline
                      aquatecinnovativee
                      wrote on last edited by
                      #11

                      Web Development Services

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups