Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用Visual Studio代码引用程序集?_C#_Visual Studio Code - Fatal编程技术网

C# 如何使用Visual Studio代码引用程序集?

C# 如何使用Visual Studio代码引用程序集?,c#,visual-studio-code,C#,Visual Studio Code,我想在使用OSX上的Visual Studio代码编写的控制台应用程序中引用System.Drawing.dll。i、 我想使用这些语句 using System.Drawing; using System.Drawing.Imaging; 要避免此生成错误 Program.cs(56,20): error CS0246: The type or namespace name `Bitmap' could not be found. Are you missing an assembly re

我想在使用OSX上的Visual Studio代码编写的控制台应用程序中引用System.Drawing.dll。i、 我想使用这些语句

using System.Drawing;
using System.Drawing.Imaging;
要避免此生成错误

Program.cs(56,20): error CS0246: The type or namespace name `Bitmap' could not be found. Are you missing an assembly reference?

我找不到这方面的教程,我甚至不知道dll在.net core或mono或visual studio代码使用的任何版本中是否可用。

mono提供了一个您可以利用的工具,其中包括对
系统的支持。在.csproj文件中绘制
,将依赖项添加为
项目组中的
PackageReference
,然后运行
dotnetrestore
nuget restore
。例如:

<ItemGroup>
  <Reference Include="System" />
  <Reference Include="System.Xml" />
  <Reference Include="System.Core" />
  <Reference Include="Xamarin.iOS" />
  <PackageReference Include="Realm" Version="2.1.0" />
  <PackageReference Include="xunit">
    <Version>2.3.1</Version>
  </PackageReference>
</ItemGroup>

2.3.1

查看完整的解释。

新的.NET核心SDK还原命令是dotnet restore


若要在Visual Studio代码中添加任何组合引用,请参阅我的。

GDI和GDI+在OS X上不可用。因此,我可以使用类似的工具吗?从菜单添加:项目:添加引用:网络选项卡:系统。Drawing@Peter,@jdweng“Visual Studio代码”中没有项目菜单,问题不是如何添加System.Drawing。它问我如何使用Visual Studio代码添加对任何程序集的引用。这个答案不再正确,因为较新版本的.NET Core中没有使用project.json(移动到.csprojproject文件格式)。谢谢@PerLundberg我更新了我的答案以反映这一点。如何引用wsdl web服务?我可以把地址加进去吗。Csproject and restore project?@a程序员我不熟悉WSDL,但据我所知,
nuget restore
/
dotnet restore
仅适用于nuget软件包。我无法添加System.Web.Script以使用JavaScriptSerializer。