Native dll can't be found .Net Core, but can be found .Net Framework












3















I have a .Net Standard project which references a native dll, which I've built for all targets.



I then published the project on a private nuget feed, using a nuspec along the lines of:



<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
...
</metadata>
<files>
<file src="..binNetStandard20Managed.dll" target="libnetstandard2.0" />
<file src="..binNetStandard20Managed.xml" target="libnetstandard2.0" />
<file src="..bin2017Win32ReleaseNative.dll" target="buildnetstandard2.0x86" />
<file src="..bin2017x64ReleaseNative.dll" target="buildnetstandard2.0x64" />
<file src="..bin2016linux-x64ReleaseNative.dll" target="buildnetstandard2.0linux-x64" />
<file src="..bin2016osx-x64ReleaseNative.dll" target="buildnetstandard2.0osx-x64" />
<file src="sharedCorebuildManaged.targets" target="buildnetstandard2.0Managed.targets" />
<file src="sharedCorelibManaged.config" target="libnetstandard2.0" />
</files>
</package>


Now when I install that nuget package to a .Net Core App running on windows 10, and I run the app targeting x86 I get an error:




Unhandled Exception: System.DllNotFoundException: Unable to load DLL
'Native.dll': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)




The strange thing is, that if I change the app to a .Net Framework app, targeting the same architecture, everything runs fine.



Does anyone have any ideas why this might be?










share|improve this question





























    3















    I have a .Net Standard project which references a native dll, which I've built for all targets.



    I then published the project on a private nuget feed, using a nuspec along the lines of:



    <?xml version="1.0" encoding="utf-8"?>
    <package>
    <metadata>
    ...
    </metadata>
    <files>
    <file src="..binNetStandard20Managed.dll" target="libnetstandard2.0" />
    <file src="..binNetStandard20Managed.xml" target="libnetstandard2.0" />
    <file src="..bin2017Win32ReleaseNative.dll" target="buildnetstandard2.0x86" />
    <file src="..bin2017x64ReleaseNative.dll" target="buildnetstandard2.0x64" />
    <file src="..bin2016linux-x64ReleaseNative.dll" target="buildnetstandard2.0linux-x64" />
    <file src="..bin2016osx-x64ReleaseNative.dll" target="buildnetstandard2.0osx-x64" />
    <file src="sharedCorebuildManaged.targets" target="buildnetstandard2.0Managed.targets" />
    <file src="sharedCorelibManaged.config" target="libnetstandard2.0" />
    </files>
    </package>


    Now when I install that nuget package to a .Net Core App running on windows 10, and I run the app targeting x86 I get an error:




    Unhandled Exception: System.DllNotFoundException: Unable to load DLL
    'Native.dll': The specified module could not be found.
    (Exception from HRESULT: 0x8007007E)




    The strange thing is, that if I change the app to a .Net Framework app, targeting the same architecture, everything runs fine.



    Does anyone have any ideas why this might be?










    share|improve this question



























      3












      3








      3








      I have a .Net Standard project which references a native dll, which I've built for all targets.



      I then published the project on a private nuget feed, using a nuspec along the lines of:



      <?xml version="1.0" encoding="utf-8"?>
      <package>
      <metadata>
      ...
      </metadata>
      <files>
      <file src="..binNetStandard20Managed.dll" target="libnetstandard2.0" />
      <file src="..binNetStandard20Managed.xml" target="libnetstandard2.0" />
      <file src="..bin2017Win32ReleaseNative.dll" target="buildnetstandard2.0x86" />
      <file src="..bin2017x64ReleaseNative.dll" target="buildnetstandard2.0x64" />
      <file src="..bin2016linux-x64ReleaseNative.dll" target="buildnetstandard2.0linux-x64" />
      <file src="..bin2016osx-x64ReleaseNative.dll" target="buildnetstandard2.0osx-x64" />
      <file src="sharedCorebuildManaged.targets" target="buildnetstandard2.0Managed.targets" />
      <file src="sharedCorelibManaged.config" target="libnetstandard2.0" />
      </files>
      </package>


      Now when I install that nuget package to a .Net Core App running on windows 10, and I run the app targeting x86 I get an error:




      Unhandled Exception: System.DllNotFoundException: Unable to load DLL
      'Native.dll': The specified module could not be found.
      (Exception from HRESULT: 0x8007007E)




      The strange thing is, that if I change the app to a .Net Framework app, targeting the same architecture, everything runs fine.



      Does anyone have any ideas why this might be?










      share|improve this question
















      I have a .Net Standard project which references a native dll, which I've built for all targets.



      I then published the project on a private nuget feed, using a nuspec along the lines of:



      <?xml version="1.0" encoding="utf-8"?>
      <package>
      <metadata>
      ...
      </metadata>
      <files>
      <file src="..binNetStandard20Managed.dll" target="libnetstandard2.0" />
      <file src="..binNetStandard20Managed.xml" target="libnetstandard2.0" />
      <file src="..bin2017Win32ReleaseNative.dll" target="buildnetstandard2.0x86" />
      <file src="..bin2017x64ReleaseNative.dll" target="buildnetstandard2.0x64" />
      <file src="..bin2016linux-x64ReleaseNative.dll" target="buildnetstandard2.0linux-x64" />
      <file src="..bin2016osx-x64ReleaseNative.dll" target="buildnetstandard2.0osx-x64" />
      <file src="sharedCorebuildManaged.targets" target="buildnetstandard2.0Managed.targets" />
      <file src="sharedCorelibManaged.config" target="libnetstandard2.0" />
      </files>
      </package>


      Now when I install that nuget package to a .Net Core App running on windows 10, and I run the app targeting x86 I get an error:




      Unhandled Exception: System.DllNotFoundException: Unable to load DLL
      'Native.dll': The specified module could not be found.
      (Exception from HRESULT: 0x8007007E)




      The strange thing is, that if I change the app to a .Net Framework app, targeting the same architecture, everything runs fine.



      Does anyone have any ideas why this might be?







      c# .net-core interop






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 3 at 17:57









      πάντα ῥεῖ

      73.7k1077144




      73.7k1077144










      asked Jan 3 at 17:57









      Yair HalberstadtYair Halberstadt

      1,058523




      1,058523
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I guess, there is a conflict in your project about which CPU architecture to target. The line win7-x86 instructs NuGet to use the x86 version of Native.DLL and AnyCPU instructs the app to compile as AnyCPU, which means the process may run as x64. This mismatch is likely the source of the error.






          share|improve this answer
























          • I'm afraid that's not it - there is no conflict. Thanks though

            – Yair Halberstadt
            Jan 4 at 9:15












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54027431%2fnative-dll-cant-be-found-net-core-but-can-be-found-net-framework%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I guess, there is a conflict in your project about which CPU architecture to target. The line win7-x86 instructs NuGet to use the x86 version of Native.DLL and AnyCPU instructs the app to compile as AnyCPU, which means the process may run as x64. This mismatch is likely the source of the error.






          share|improve this answer
























          • I'm afraid that's not it - there is no conflict. Thanks though

            – Yair Halberstadt
            Jan 4 at 9:15
















          0














          I guess, there is a conflict in your project about which CPU architecture to target. The line win7-x86 instructs NuGet to use the x86 version of Native.DLL and AnyCPU instructs the app to compile as AnyCPU, which means the process may run as x64. This mismatch is likely the source of the error.






          share|improve this answer
























          • I'm afraid that's not it - there is no conflict. Thanks though

            – Yair Halberstadt
            Jan 4 at 9:15














          0












          0








          0







          I guess, there is a conflict in your project about which CPU architecture to target. The line win7-x86 instructs NuGet to use the x86 version of Native.DLL and AnyCPU instructs the app to compile as AnyCPU, which means the process may run as x64. This mismatch is likely the source of the error.






          share|improve this answer













          I guess, there is a conflict in your project about which CPU architecture to target. The line win7-x86 instructs NuGet to use the x86 version of Native.DLL and AnyCPU instructs the app to compile as AnyCPU, which means the process may run as x64. This mismatch is likely the source of the error.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 3 at 19:56









          NativeKepler11NativeKepler11

          546




          546













          • I'm afraid that's not it - there is no conflict. Thanks though

            – Yair Halberstadt
            Jan 4 at 9:15



















          • I'm afraid that's not it - there is no conflict. Thanks though

            – Yair Halberstadt
            Jan 4 at 9:15

















          I'm afraid that's not it - there is no conflict. Thanks though

          – Yair Halberstadt
          Jan 4 at 9:15





          I'm afraid that's not it - there is no conflict. Thanks though

          – Yair Halberstadt
          Jan 4 at 9:15




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54027431%2fnative-dll-cant-be-found-net-core-but-can-be-found-net-framework%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Mossoró

          Error while reading .h5 file using the rhdf5 package in R

          Pushsharp Apns notification error: 'InvalidToken'