Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to reference other projects with DllExport #156

Closed
tetradice opened this issue Jun 1, 2020 · 3 comments
Closed

How to reference other projects with DllExport #156

tetradice opened this issue Jun 1, 2020 · 3 comments

Comments

@tetradice
Copy link

Hello.
Probably I think I'm overlooking the basics, but I couldn't solve it by looking at the Wiki or Issues, so please help.

I have registered two projects in one solution.

  1. Util - Class library without DLLExport.
  2. DllExportTest - Class library with DLLExport. It references the Util project.

In this state, if you build DLLExportTest and call the function, FileNotFoundException will occur before entering the process. The content of the message is that "Util, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" cannot be found.

What kind of preparation does DllExport have to do to reference the project?

DLLExportTest/Main.cs

using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace DllExportTest
{
    public class Dll
    {
        [DllExport]
        public static bool load(IntPtr dllDirPathPtr, int len)
        {
            var util = new Util.UtilClass();

            return true;
        }
    }
}

Util/UtilClass.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace Util
{
    public class UtilClass
    {
    }
}

Config

WS000806

WS000807

@3F
Copy link
Owner

3F commented Jun 1, 2020

A yesterday's answer in #154 (comment) seems is similar to your case:

AssemblyResolve is one of the possible solutions. You can also try Pre-processing same as for Conari.

That's actually is duplicate of #86 (comment)

Config

In future case, copy-paste from Data tab is better. Thanks.

@tetradice
Copy link
Author

@3F Thanks! As with @Jesse-Schokker, using AssemblyResolve, I was able to load correctly and the problem was resolved. Thanks for your quick answer and great project.

In future case, copy-paste from Data tab is better. Thanks.

Sorry💦

@3F
Copy link
Owner

3F commented Jun 1, 2020

@tetradice Good! Thanks for using!

Sorry💦

Don't worry, just a recommendation since you have already provided minimal info for this issue. It simply covers more cases and requires less image manipulation etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants