Я пытаюсь начать очень маленький начальный проект в Visual Studio Code
C#
. Моя ОС Ubuntu-18.04
У меня есть версия узла v12.15.0
npm
версия 6.13.4
Версия визуального кода 1.42.0
Я установил sudo apt-get install dotnet-sdk-3.1
, и установка прошла успешно. Процедура установки исходит из официальных инструкций для Ubuntu-18.04
1) wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
2) Установка осуществляется следующим образом:
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-3.1
Это результат dotnet --info
ниже:
emanuele@pc:~$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.102
Commit: 573d158fea
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/3.1.102/
Host (useful for support):
Version: 3.1.2
Commit: 916b5cba26
.NET Core SDKs installed:
3.1.102 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Установка прошла успешно в качестве окончательного результата.
Я перешел на Visual Studio и создал новый проект, набрав текст :
1) sudo npm install -g yo bower grunt-cli gulp generator-aspnet
2) yo aspnet
и правильно получили приветствие, как показано ниже, и выбрали Веб-приложение , поскольку я хотел бы использовать google-drive API
Подходят для применения в будущем:
Инструкция доступна как показано ниже, но когда я dotnet run
или sudo dotnet run
, я получаю следующее сообщение:
Что Iam также сообщает в случае, если кто-то хочет скопировать / вставить:
A compatible installed .NET Core SDK for global.json version [1.0.0-rc4-004771] from [/home/emanuele/Desktop/dredge-doc/dredge-doc/global.json] was not found
Install the [1.0.0-rc4-004771] .NET Core SDK or update [/home/emanuele/Desktop/dredge-doc/dredge-doc/global.json] with an installed .NET Core SDK:
3.1.102 [/usr/share/dotnet/sdk]
Ниже приведен результат журнала вывода:
Starting OmniSharp server at 2/21/2020, 10:15:31 AM
Target: /home/emanuele/Desktop/dredge-doc
OmniSharp server started.
Path: /home/emanuele/.vscode/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/run
PID: 13881
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on ubuntu 18.4 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 16.4 - "/home/emanuele/.vscode/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/home/emanuele/.vscode/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.4 - "/home/emanuele/.vscode/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /home/emanuele/.vscode/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/omnisharp/.msbuild/Current/Bin
CscToolPath = /home/emanuele/.vscode/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /home/emanuele/.vscode/extensions/ms-vscode.csharp-1.21.12/.omnisharp/1.34.13/omnisharp/.msbuild
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in '/home/emanuele/Desktop/dredge-doc'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
No solution files found in '/home/emanuele/Desktop/dredge-doc'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/emanuele/Desktop/dredge-doc/dredge-doc/dredge-doc.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/home/emanuele/Desktop/dredge-doc'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/home/emanuele/Desktop/dredge-doc' on host 12704.
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /home/emanuele/Desktop/dredge-doc/dredge-doc/dredge-doc.csproj
A compatible installed .NET Core SDK for global.json version [1.0.0-rc4-004771] from [/home/emanuele/Desktop/dredge-doc/dredge-doc/global.json] was not found
Install the [1.0.0-rc4-004771] .NET Core SDK or update [/home/emanuele/Desktop/dredge-doc/dredge-doc/global.json] with an installed .NET Core SDK:
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file '/home/emanuele/Desktop/dredge-doc/dredge-doc/dredge-doc.csproj'.
/home/emanuele/Desktop/dredge-doc/dredge-doc/dredge-doc.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found. /home/emanuele/Desktop/dredge-doc/dredge-doc/dredge-doc.csproj
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject (System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, System.Object[] args) [0x00040] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject[T1] (System.Boolean condition, System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00003] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1] (Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, T1 arg0) [0x00000] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].ExpandAndLoadImportsFromUnescapedImportExpressionConditioned (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, System.Collections.Generic.List`1[Microsoft.Build.Construction.ProjectRootElement]& projects, Microsoft.Build.BackEnd.SdkResolution.SdkResult& sdkResult, System.Boolean throwOnFileNotExistsError) [0x00254] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].ExpandAndLoadImports (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement, Microsoft.Build.BackEnd.SdkResolution.SdkResult& sdkResult) [0x00027] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].EvaluateImportElement (System.String directoryOfImportingFile, Microsoft.Build.Construction.ProjectImportElement importElement) [0x0000d] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].PerformDepthFirstPass (Microsoft.Build.Construction.ProjectRootElement currentProjectOrImport) [0x000e6] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].Evaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Framework.BuildEventContext buildEventContext) [0x0014c] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Evaluator`4[P,I,M,D].Evaluate (Microsoft.Build.Evaluation.IEvaluatorData`4[P,I,M,D] data, Microsoft.Build.Construction.ProjectRootElement root, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, System.Int32 maxNodeCount, Microsoft.Build.Collections.PropertyDictionary`1[T] environmentProperties, Microsoft.Build.BackEnd.Logging.ILoggingService loggingService, Microsoft.Build.Evaluation.IItemFactory`2[S,T] itemFactory, Microsoft.Build.Evaluation.IToolsetProvider toolsetProvider, Microsoft.Build.Evaluation.ProjectRootElementCacheBase projectRootElementCache, Microsoft.Build.Framework.BuildEventContext buildEventContext, Microsoft.Build.BackEnd.SdkResolution.ISdkResolverService sdkResolverService, System.Int32 submissionId, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext, System.Boolean interactive) [0x00044] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.Reevaluate (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00063] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00035] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.ReevaluateIfNecessary (Microsoft.Build.BackEnd.Logging.ILoggingService loggingServiceForEvaluation, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00000] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.ReevaluateIfNecessary (Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00007] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Project+ProjectImpl.Initialize (System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x0012b] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings, Microsoft.Build.Evaluation.Context.EvaluationContext evaluationContext) [0x00075] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, System.String subToolsetVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection, Microsoft.Build.Evaluation.ProjectLoadSettings loadSettings) [0x00000] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.Project..ctor (System.String projectFile, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion, Microsoft.Build.Evaluation.ProjectCollection projectCollection) [0x00000] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.String toolsVersion) [0x000f7] in <d7593966a5ec48e0baa47768c52e35a5>:0
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject (System.String fileName, System.String toolsVersion) [0x00000] in <d7593966a5ec48e0baa47768c52e35a5>:0
at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore (System.String filePath) [0x0003f] in <274bc1b8e17a461caeeca97c1d1fc005>:0
at OmniSharp.MSBuild.ProjectLoader.BuildProject (System.String filePath) [0x0000d] in <274bc1b8e17a461caeeca97c1d1fc005>:0
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load (System.String filePath, OmniSharp.MSBuild.ProjectIdInfo projectIdInfo, OmniSharp.MSBuild.ProjectLoader loader) [0x00015] in <274bc1b8e17a461caeeca97c1d1fc005>:0
at OmniSharp.MSBuild.ProjectManager+<>c__DisplayClass29_0.<LoadProject>b__0 () [0x00000] in <274bc1b8e17a461caeeca97c1d1fc005>:0
at (wrapper delegate-invoke) System.Func`1[System.ValueTuple`3[OmniSharp.MSBuild.ProjectFile.ProjectFileInfo,System.Collections.Immutable.ImmutableArray`1[OmniSharp.MSBuild.Logging.MSBuildDiagnostic],OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs]].invoke_TResult()
at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject (System.String projectFilePath, System.Func`1[TResult] loader) [0x0001b] in <274bc1b8e17a461caeeca97c1d1fc005>:0
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: /home/emanuele/Desktop/dredge-doc/dredge-doc/dredge-doc.csproj
Посты, которые я использовал, чтобы помочь мне решить проблемы:
1) fail-omnisharp-msbuild-projectmanager * 10 67 *
2) этот , так как моя ОС также Ubuntu-18.04
, но это не кажется мне выполнимым решением, потому что это потребовало ручной установки файла. Я не уверен, что это правильная процедура, которой нужно следовать.
3) Это полезно , однако пользователь использовал Windows, поэтому я не уверен, что это также может быть исправимым решением
Если у кого-то была такая же проблема, как у меня, спасибо за руководство по решению этой проблемы.