参考外部DLL编译c#项目时出错

参考外部DLL编译c#项目时出错,dll,Dll,我正在尝试编译依赖于外部DLL的文件 因此,首先我通过以下方式编译DLL项目源代码: dotnet build NtApiDotNet\NtApiDotNet.Core.csproj -c Release 我获得了NtApiDotNet.dll,所以在那里之前一切都很好 但是,我试图用下面的命令行编译引用前面DLL的c#源代码: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /unsafe /platform:anycpu /r

我正在尝试编译依赖于外部DLL的文件

因此,首先我通过以下方式编译DLL项目源代码:

dotnet build NtApiDotNet\NtApiDotNet.Core.csproj -c Release
我获得了NtApiDotNet.dll,所以在那里之前一切都很好

但是,我试图用下面的命令行编译引用前面DLL的c#源代码:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /unsafe /platform:anycpu /r:NtApiDotNet.dll /out:poc.exe .\PulseLogPrivesc.cs
我获得以下错误日志条目:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /unsafe /platform:anycpu /r:NtApiDotNet.dll /out:poc.exe .\PulseLogPrivesc.cs
Microsoft (R) Visual C# Compiler version 4.7.2556.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240

PulseLogPrivesc.cs(72,17): error CS0012: The type 'System.Object' is defined in an assembly that is
        not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0,
        Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
NtApiDotNet.dll: (Location of symbol related to previous error)
PulseLogPrivesc.cs(72,17): error CS0012: The type 'System.IDisposable' is defined in an assembly that
        is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0,
        Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
NtApiDotNet.dll: (Location of symbol related to previous error)
PulseLogPrivesc.cs(72,17): error CS0012: The type 'System.IConvertible' is defined in an assembly that        is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0,
        Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
NtApiDotNet.dll: (Location of symbol related to previous error)
PulseLogPrivesc.cs(72,17): error CS0012: The type 'System.ValueType' is defined in an assembly that is        not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0,
        Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
NtApiDotNet.dll: (Location of symbol related to previous error)
NtApiDotNet.dll: error CS0455: Type parameter 'A' inherits conflicting constraints 'System.ValueType'
        and 'System.IConvertible'
PulseLogPrivesc.cs(169,21): error CS0012: The type 'System.Enum' is defined in an assembly that is not        referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0,
        Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
NtApiDotNet.dll: (Location of symbol related to previous error)
PulseLogPrivesc.cs(174,13): error CS0012: The type 'System.Runtime.InteropServices.SafeBuffer' is
        defined in an assembly that is not referenced. You must add a reference to assembly
        'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
NtApiDotNet.dll: (Location of symbol related to previous error)
PulseLogPrivesc.cs(186,21): error CS1061: 'NtApiDotNet.NtMappedSection' does not contain a definition
        for 'ReadArray' and no extension method 'ReadArray' accepting a first argument of type
        'NtApiDotNet.NtMappedSection' could be found (are you missing a using directive or an assembly        reference?)
PulseLogPrivesc.cs(191,21): error CS1061: 'NtApiDotNet.NtMappedSection' does not contain a definition
        for 'WriteArray' and no extension method 'WriteArray' accepting a first argument of type
        'NtApiDotNet.NtMappedSection' could be found (are you missing a using directive or an assembly        reference?)
我试图在不同的文件夹中找到外部DLL:当前目录,csc.exe目录。 你知道有什么问题吗

我还试图从VisualStudio编译DLL,但我得到了

不要将.NETCore与.NETFramework混合使用。让Visual Studio帮助您解决此问题。我使用Visual Studio收到的错误消息进行了编辑,我真的不知道如何处理此问题…您的VS版本可能太旧,不知道如何处理.NETCore项目。考虑更新到VS2019,社区版是免费下载。感谢提示,不幸的是,VS2019正在编译我的DLL,但是CSC.EXE命令行仍然失败……不要混合。磊科与.NETFramework。让Visual Studio帮助您解决此问题。我使用Visual Studio收到的错误消息进行了编辑,我真的不知道如何处理此问题…您的VS版本可能太旧,不知道如何处理.NETCore项目。考虑更新到VS2019,社区版是免费下载的。感谢提示,不幸的是,VS2019正在编译我的DLL,但是CSC.EXE命令行仍然失败…