简体   繁体   中英

postsharp is failing to work on .net core

I am trying to use postsharp on .net core 2.

I have added Postsharp 5.1.19 (preview) however, I am getting the following error when I try to build the project.

/Users/me/.nuget/packages/postsharp/5.1.9-preview/build/PostSharp.targets(5,5): Error MSB4060: The "PostSharp30" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name. (MSB4060) `

Here is a detailed explanation which is essentially not aware that I am on MAC and still looking for (kernel32) and some dlls:

/Users/me/.nuget/packages/postsharp/5.1.9-preview/build/PostSharp.targets(5,5): Error MSB4061: The "PostSharp30" task could not be instantiated from "/Users/me/.nuget/packages/postsharp/5.1.9-preview/build/PostSharp.MSBuild.v5.1.9.Release.dll". System.TypeInitializationException: The type initializer for 'PostSharp.Compiler.Client.BuildClient' threw an exception. ---> System.DllNotFoundException: kernel32 at (wrapper managed-to-native) PostSharp.Compiler.Client.ProcessUtilities.GetCurrentProcess() at PostSharp.Compiler.Client.ProcessUtilities.GetParentProcesses () [0x00006] in <7cce0190f299453c822c4cfb425f86da>:0 at PostSharp.Compiler.Client.ProcessUtilities.DetectUnattendedProcess (System.String& log) [0x0002f] in <7cce0190f299453c822c4cfb425f86da>:0 at PostSharp.Compiler.Client.BuildClient..cctor () [0x00016] in <7cce0190f299453c822c4cfb425f86da>:0 --- End of inner exception stack trace --- at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr) at PostSharp.MSBuild.PostSharp30..ctor () [0x00018] in <7cce0190f299453c822c4cfb425f86da>:0 at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&) at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in /Users/builder/data/lanes /5533/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.Reflection/MonoMethod.cs:661 (MSB4061)`

How can I get this working?

As you can read in the announcement :

PostSharp 5.1 will still only support Windows as the only build platform.

So even though .NET Core projects are supported, you can build with PostSharp only on Windows, and as you said - you are on MAC.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM