question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is .Net Standard 2.0 supported?

See original GitHub issue

Hello I’m using VS 2019, I created a new .Net Standard Class Library C# project targeting netstandard2.0. I installed DllExport: dotnet add package DllExport --version 1.7.4 And wrote a small code:

using CoreAudio;
using System;
using System.Collections.Generic;
using static System.Console;
using RGiesecke.DllExport;
using System.Runtime.InteropServices;

namespace MyTests
{
    public class ExportProgram
    {
        //[DllExport]
        [DllExport("Init", CallingConvention.StdCall)]
        public static string TestExport()
        {
            return "999";
        }
    }
}

I get this warning during the build: warn : Package ‘UnmanagedExports 1.2.7’ was restored using ‘.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8’ instead of the project target framework ‘.NETStandard,Version=v2.0’. This package may not be fully compatible with your project.

I can’t see the functions on the dll using dumbin /exports.

But on the other hand, .Net Framework has no issue and DllExport works just fine, I can see the exported function using dumpbin /exports and I can call it using rundll32. And I used the code below:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CoreAudio;
using static System.Console;
using RGiesecke.DllExport;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace MyTests
{
    public class ExportProgram
    {
        //[DllExport]
        [DllExport("Init", CallingConvention.StdCall)]
        public static string TestExport()
        {
            MessageBox.Show("Hello, world, from C#!");
            return "999";
        }
    }
}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
3Fcommented, Jul 19, 2022

Hello,

Yes .NET Standard 2.0 is supported https://github.com/3F/DllExport/wiki/.Net-Core

Please follow the information from the issue template and provide requirement data to diag your case.

Please also read https://github.com/3F/DllExport/wiki/Quick-start

> “warn : Package ‘UnmanagedExports 1.2.7’ was restored using…”

Also make sure you only use DllExport tool and not UnmanagedExports.1.2.7 https://github.com/3F/DllExport/issues/196#issuecomment-996028881

You need to edit it manually if your project file is corrupted somehow or simply try to delete everything before continue. Then follow steps from the wiki.

n. I may be slow to respond due to many reasons beyond my control,     sorry

0reactions
3Fcommented, Oct 11, 2022

Hello,

Yes .NET Standard 2.0 is supported https://github.com/3F/DllExport/wiki/.Net-Core

Please follow information from the issue template and provide requirement data to diag your case.

Please also read https://github.com/3F/DllExport/wiki/Quick-start

warn : Package ‘UnmanagedExports 1.2.7’ was restored using…

Also make sure you only use DllExport and not UnmanagedExports.1.2.7 https://github.com/3F/DllExport/issues/196#issuecomment-996028881

You need to edit it manually if your project file is corrupted somehow or simply try to delete everything. Then follow steps from the wiki.

n. I can be very slow for many reason in response, sorry

Read more comments on GitHub >

github_iconTop Results From Across the Web

Announcing .NET Standard 2.0
The .NET Standard 2.0 specification is now complete. It is supported in .NET Core 2.0, in the .NET Framework 4.6.1 and later versions, ......
Read more >
Please stop lying about .NET Standard 2.0 support!
But... why? The short answer is that .NET Core 2.1 and .NET Core 3.0 are now out of support. According to the original...
Read more >
.NET Core and .NET Standard 2.0 - Info Support Blog
NET platforms that support .NET Standard 2.0 as long as they use API's that are part of the standard without requiring any changes...
Read more >
What is .Net Standard? How it is different from .Net Core ...
NetStandard is 2.0 and the upcoming version of .Net Core is likely to support 2.0. Refer the below .NetStandard and Supported Platforms matrix...
Read more >
.NET — .NET Standard 2.0 Deprecation, Support for .NET 6 ...
As you may also know, .NET Standard 2.0 support is being dropped by Microsoft and many third-parties as well. For instance, EF Core...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found