因此,根据Internet上的教程,我已经安装了C#扩展名和.Net,以及所有其他内容,我有一个工作区...并且做了一些其他工作,例如在终端中输入一些dotnet命令。一切正常,没有问题,但是每当我打开脚本/文件...最初创建的脚本/文件-Program.cs都包含默认的“ Hello World!”。程序...,然后显示一条错误消息,提示它无法加载项目。不过,当我在终端中编写dotnet运行时,它的输出没有任何问题。
我已经在Internet上看到了许多类似的线程,但是还没有任何工作适合我。我只是不知道怎么回事。这就是为什么我在这里问这个问题并将错误消息放在这里的原因,以便我可以了解我的情况出了什么问题。由于我是VS Code的新手,所以……不知道到底出了什么问题。
这是在输出标签中显示的错误消息-
Starting OmniSharp server at 13/7/2019, 3:46:46 PM
Target: e:\CSharp Workspace
OmniSharp server started.
Path: C:\Users\Arpit Srivastava\.vscode\extensions\ms-vscode.csharp-1.20.0\.omnisharp\1.32.20\OmniSharp.exe
PID: 16516
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: Visual Studio Community 2017 15.9.28307.222 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
2: StandAlone 15.0 - "C:\Users\Arpit Srivastava\.vscode\extensions\ms-vscode.csharp-1.20.0\.omnisharp\1.32.20\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Community 2017 15.9.28307.222 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'e:\CSharp Workspace'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.WorkspaceInitializer
Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
[info]: OmniSharp.MSBuild.ProjectSystem
No solution files found in 'e:\CSharp Workspace'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'e:\CSharp Workspace\CSharp Workspace.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'e:\CSharp Workspace'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: e:\CSharp Workspace\CSharp Workspace.csproj
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'e:\CSharp Workspace' on host 7936.
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file 'e:\CSharp Workspace\CSharp Workspace.csproj'.
e:\CSharp Workspace\CSharp Workspace.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found. e:\CSharp Workspace\CSharp Workspace.csproj
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, SdkResult& sdkResult, Boolean throwOnFileNotExistsError)
at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult)
at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(ILoggingService loggingService, BuildEventContext buildEventContext)
at Microsoft.Build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 129
at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 72
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectIdInfo projectIdInfo, ProjectLoader loader) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectFile\ProjectFileInfo.cs:line 94
at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 304
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: e:\CSharp Workspace\CSharp Workspace.csproj
相反,如果我尝试运行程序,则会在输出中得到它-
scriptcs' is not recognized as an internal or external command,
operable program or batch file.