Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/275.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# 带VS代码的网页抓取——类型';对象';在未引用的程序集中定义_C#_Selenium Webdriver_Visual Studio Code - Fatal编程技术网

C# 带VS代码的网页抓取——类型';对象';在未引用的程序集中定义

C# 带VS代码的网页抓取——类型';对象';在未引用的程序集中定义,c#,selenium-webdriver,visual-studio-code,C#,Selenium Webdriver,Visual Studio Code,我在这里已经看到这个问题出现过好几次了,但我并不真正理解答案/问题,所以就这样 我在构建的所有内容中都会遇到此错误: 类型“Object”是在未引用的程序集中定义的。 必须添加对程序集“System.Private.CoreLib”的引用, 版本=4.0.0.0,区域性=中性,PublicKeyToken=7cec85d7bea7798e' 这是我的密码 using System; using OpenQA.Selenium.Firefox; using OpenQA.Selenium;

我在这里已经看到这个问题出现过好几次了,但我并不真正理解答案/问题,所以就这样

我在构建的所有内容中都会遇到此错误:

类型“Object”是在未引用的程序集中定义的。 必须添加对程序集“System.Private.CoreLib”的引用, 版本=4.0.0.0,区域性=中性,PublicKeyToken=7cec85d7bea7798e'

这是我的密码

using System;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium;


    class Program
    {
        static void Main()
        {

            IWebDriver driver = new FirefoxDriver();
        }
    }
这是我的csproj文件

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.2</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Selenium.Firefox.WebDriver" Version="0.24.0"/>
    <PackageReference Include="Selenium.WebDriver" Version="4.0.0-alpha02"/>
    <PackageReference Include="Selenium.Support" Version="4.0.0-alpha02"/>
  </ItemGroup>
</Project>

Exe
netcoreapp2.2
webdriver在路径中,并且确实在bin中。如果我删除了对
IWebDriver
的引用,那么项目就可以正常构建,因此这里肯定是有什么东西导致了这个问题。有什么建议吗