3F / DllExport

.NET DllExport with .NET Core support (aka 3F/DllExport aka DllExport.bat)
MIT License
938 stars 131 forks source link

Failing to compile in VS 2019 4.7.2 framework #145

Closed cadhelp closed 4 years ago

cadhelp commented 4 years ago

Thank you for the link, the template information was not there when clicking New issue. Steps to reproduce: Create a new Class Library .Net 4.7.2 Framework project. Install DllExport V1.7.0 and UnmanagedExports V1.2.7 both through NuGet at the project level when running VS 2019 as admin

I used this code to build

using System.Runtime.InteropServices;
using RGiesecke.DllExport;
namespace C2P
{
    class Test
    {       
        [DllExport("add", CallingConvention = CallingConvention.Cdecl)]
        public static int TestExport(int left, int right)
        {
            return left + right;
        }
    }
}

I have my target build set to x64

I choose to Build in VS 2019 and receive the error below:

Severity    Code    Description Project File    Line    Suppression State
Error       The "DllExportAppDomainIsolatedTask" task failed unexpectedly.
System.ArgumentException: Requested value 'Version47' was not found.

Server stack trace: 
   at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)
   at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
   at RGiesecke.DllExport.MSBuild.ExportTaskImplementation`1.<>c__DisplayClass8.<GetGetToolPathInternal>b__7(Version version, String toolName) in c:\Users\rober_000\Documents\Code\unmanaged-exports\RGiesecke.DllExport.MSBuild\ExportTaskImplementation.cs:line 568
   at RGiesecke.DllExport.MSBuild.ExportTaskImplementation`1.TryToGetToolDirForFxVersion(String toolFileName, Func`3 getToolPath, String& toolDirectory) in c:\Users\rober_000\Documents\Code\unmanaged-exports\RGiesecke.DllExport.MSBuild\ExportTaskImplementation.cs:line 725
   at RGiesecke.DllExport.MSBuild.ExportTaskImplementation`1.ValidateToolPath(String toolFileName, String currentValue, Func`3 getToolPath, String& foundPath) in c:\Users\rober_000\Documents\Code\unmanaged-exports\RGiesecke.DllExport.MSBuild\ExportTaskImplementation.cs:line 698
   at RGiesecke.DllExport.MSBuild.ExportTaskImplementation`1.ValidateFrameworkPath() in c:\Users\rober_000\Documents\Code\unmanaged-exports\RGiesecke.DllExport.MSBuild\ExportTaskImplementation.cs:line 680
   at RGiesecke.DllExport.MSBuild.ExportTaskImplementation`1.ValidateInputValues() in c:\Users\rober_000\Documents\Code\unmanaged-exports\RGiesecke.DllExport.MSBuild\ExportTaskImplementation.cs:line 396
   at RGiesecke.DllExport.MSBuild.ExportTaskImplementation`1.Execute() in c:\Users\rober_000\Documents\Code\unmanaged-exports\RGiesecke.DllExport.MSBuild\ExportTaskImplementation.cs:line 264
   at RGiesecke.DllExport.MSBuild.DllExportAppDomainIsolatedTask.Execute() in c:\Users\rober_000\Documents\Code\unmanaged-exports\RGiesecke.DllExport.MSBuild\DllExportAppDomainIsolatedTask.cs:line 241
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.Build.Framework.ITask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() C2P2

build.log

Please let me know if I can provide any further information.

3F commented 4 years ago

Is there any reason why are you ignoring our related issue-template? We need information from your environment.

The error points exactly to this. Please update info or it will be closed due to unknown specific problem only for your pc. Thanks,

3F commented 4 years ago

Install DllExport V1.7.0 and UnmanagedExports V1.2.7

Why both? You need only one.

I really don't understand why, why so many wrong articles and misunderstandings regarding the basic, really basic, use of the .NET DllExport solution. But simultaneous use of UnmanagedExports + 3F/DllExport this is something new at all. Don't know. -_-

UnmanagedExports V1.2.7

We don't support this. This is other project.

both through NuGet

I remind everyone that we do not provide official support for nuget. You can try of course (moreover, the default behavior for 1.7 has been changed a bit compared with 1.6.x for more convenience when starting from nuget; and more probably it will work for many env). But again, we have no official support and we cannot guarantee the normal work for all these cases.

build.log

I don't see any use of our tool. The error from your log points exactly to UnmanagedExports V1.2.7

I close this issue because this is not relevant to our project at all. Please open new if you've found errors regarding to this repo. Feel free to ask also about some migration issue since this is other solution 3F/DllExport. But please start with wiki