3

I am having a problem with Visual Studio 2017 compiling a DLL project:

I did "Install-Package UnmanagedExports" on Package Manager Console...

The error:

The "RGiesecke.DllExport.MSBuild.DllExportAppDomainIsolatedTask" task could not be loaded from the assembly C:\Users\Tom\Desktop\CSharpProjects\MSBuildDLL\MSBuildDLL\packages\UnmanagedExports.1.2.7\tools\RGiesecke.DllExport.MSBuild.dll. Could not load file or assembly 'RGiesecke.DllExport, Version=1.6.0.1449, Culture=neutral, PublicKeyToken=479f08790debacee' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

I compiled the exact same code on Visual Studio 2013 and it worked great but unfortunately it doesn't work on VS 2017. I have searched everywhere for a solution to this issue and didn't find anything that solve the problem.

The C# code:

namespace DLLTest
{
    public class Test
    {
        [DllExport(CallingConvention = CallingConvention.Cdecl)]
        static public int Add(int a, int b)
        {
            return a + b;
        }
    }
}
6
  • 1
  • Thank you Robert, I have already checked that but didn't understand what exactly should I do ? Can you please tell me ?
    – TomQL
    Jul 5, 2018 at 19:15
  • 1
    My guess is that installing .NET 3.5 will solve the problem. (.NET 3.5 is no longer included by default in Visual Studio 2017 or recent versions of Windows) Jul 5, 2018 at 19:17
  • 1
    Thank you very much Robert. Your guess was correct. It took me over an hour to install the .Net 3.5 because of Win10 issues. But after it was installed, the problem disappeared! Thank you again :D
    – TomQL
    Jul 5, 2018 at 20:36
  • @RobertHarvey, Since your comment resolved this issue, would you please convert your comment to the answer so that it can be beneficial to other community members reading this thread.
    – Leo Liu
    Jul 6, 2018 at 3:29

1 Answer 1

7

Thanks to @RobertHarvey for his guess in the comments above.

I had this same problem after setting up a brand new workstation and installing Visual Studio 2019. I resolved the problem by:

  1. Installing Microsoft Build Tools 2015
  2. Installing .NET 3.5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.