4

我正在尝试在 Visual Studio 中用 C# 构建 Dll。使用了 NuGet RGiesecke.DllExport。但是由于某种原因,它在构建 Dll 时会返回一些错误。下面是描述。

错误
“DllExportAppDomainIsolatedTask”任务意外失败。System.ArgumentException:未找到请求的值“Version46”。

服务器堆栈跟踪:

   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() NativeExports3
4

2 回答 2

5

这是关于DllExport包裹的问题。

VS2017 编译失败---Issue #29 Error The "DllExportAppDomainIsolatedTask" task failed unexpectedly. System.ArgumentException: Requested value 'Version46' was not found.

你可以看看这个类似的问题,你应该使用更高版本的DllExport nuget 包。(至少 1.5.2)。

于 2019-09-09T10:05:59.893 回答
1

我安装了 Microsoft Build Tools 2015 并解决了我的问题。

https://www.microsoft.com/en-us/download/details.aspx?id=48159

于 2022-02-03T09:58:54.207 回答