В основном каждый раз, когда я пытаюсь открыть файл С# из единства, я получаю:
сообщение "один или несколько проектов в решении были загружены неправильно. подробности см. в окне вывода"
за которым следует «Обнаружено исключение. Это может быть вызвано расширением. Вы можете получить дополнительную информацию, изучив файл…» Этот файл очень длинный, поэтому я вставлю только ошибки:
568 ERROR LegacySitePackage failed for package [CSharpPackage]Source: 'Microsoft.VisualStudio.LanguageServices' Description: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService.AbstractPackage`2.Initialize() at Microsoft.VisualStudio.LanguageServices.CSharp.LanguageService.CSharpPackage.Initialize() at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp) WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. {13C3BBB4-F18F-4111-9F54-A0FB010D9194} 80070002 VisualStudio 2019/04/08 11:04:50.397
569 ERROR SetSite failed for package CSharpPackage {13C3BBB4-F18F-4111-9F54-A0FB010D9194} 80070002 VisualStudio 2019/04/08 11:04:50.403
570 ERROR End package load [CSharpPackage] {13C3BBB4-F18F-4111-9F54-A0FB010D9194} 80070002 VisualStudio 2019/04/08 11:04:50.408
574 ERROR LegacySitePackage failed for package [CSharpPackage]Source: 'Microsoft.VisualStudio.LanguageServices' Description: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService.AbstractPackage`2.Initialize() at Microsoft.VisualStudio.LanguageServices.CSharp.LanguageService.CSharpPackage.Initialize() at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp) WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. {13C3BBB4-F18F-4111-9F54-A0FB010D9194} 80070002 VisualStudio 2019/04/08 11:04:50.413
575 ERROR SetSite failed for package CSharpPackage {13C3BBB4-F18F-4111-9F54-A0FB010D9194} 80070002 VisualStudio 2019/04/08 11:04:50.413
576 ERROR End package load [CSharpPackage] {13C3BBB4-F18F-4111-9F54-A0FB010D9194} 80070002 VisualStudio 2019/04/08 11:04:50.413
614 ERROR LegacySitePackage failed for package [CSharpPackage]Source: 'Microsoft.VisualStudio.LanguageServices' Description: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService.AbstractPackage`2.Initialize() at Microsoft.VisualStudio.LanguageServices.CSharp.LanguageService.CSharpPackage.Initialize() at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp) WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. {13C3BBB4-F18F-4111-9F54-A0FB010D9194} 80070002 VisualStudio 2019/04/08 11:04:51.586
615 ERROR SetSite failed for package CSharpPackage {13C3BBB4-F18F-4111-9F54-A0FB010D9194} 80070002 VisualStudio 2019/04/08 11:04:51.592
616 ERROR End package load [CSharpPackage] {13C3BBB4-F18F-4111-9F54-A0FB010D9194} 80070002 VisualStudio 2019/04/08 11:04:51.596
641 ERROR Extension will not be loaded because an extension with the same ID 'Microsoft.Windows.DevelopmentKit.Desktop' is already loaded at C:\PROGRAM FILES (X86)\COMMON FILES\MICROSOFT\EXTENSIONMANAGER\EXTENSIONS\MICROSOFT\WINDOWS KITS\10\DESKTOP SDK... C:\PROGRAM FILES (X86)\COMMON FILES\MICROSOFT\EXTENSIONMANAGER\EXTENSIONS\MICROSOFT\WINDOWS KITS\8.1\DESKTOP SDK\ Extension Manager 2019/04/08 11:04:51.967
642 ERROR Extension will not be loaded because an extension with the same ID 'Microsoft.Windows.DevelopmentKit.WindowsStore' is already loaded at C:\PROGRAM FILES (X86)\COMMON FILES\MICROSOFT\EXTENSIONMANAGER\EXTENSIONS\MICROSOFT\WINDOWS KITS\10\WINDOWS STORE SDK... C:\PROGRAM FILES (X86)\COMMON FILES\MICROSOFT\EXTENSIONMANAGER\EXTENSIONS\MICROSOFT\WINDOWS KITS\8.1\WINDOWS STORE SDK\ Extension Manager 2019/04/08 11:04:51.968
661 ERROR A MEF Component threw an exception at runtime: Microsoft.VisualStudio.Composition.CompositionFailedException: An exception was thrown while initializing part "Microsoft.CodeAnalysis.Diagnostics.DiagnosticService". ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. at Microsoft.CodeAnalysis.Diagnostics.DiagnosticService..ctor(IAsynchronousOperationListenerProvider listenerProvider) --- End of inner exception stack trace --- at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.b__0() Microsoft.VisualStudio.ComponentModelHost.VsShellComponentModelHost 2019/04/08 11:04:53.135
662 ERROR A MEF Component threw an exception at runtime: Microsoft.VisualStudio.Composition.CompositionFailedException: An exception was thrown while initializing part "Microsoft.CodeAnalysis.Diagnostics.DiagnosticService". ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. at Microsoft.CodeAnalysis.Diagnostics.DiagnosticService..ctor(IAsynchronousOperationListenerProvider listenerProvider) --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) --- End of inner exception stack trace --- at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.b__0() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import, RuntimeExport export, Func
3 lazyFactory) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import) at System.Linq.Enumerable.WhereSelectArrayIterator
2.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable
1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.b__0() Microsoft.VisualStudio.ComponentModelHost.VsShellComponentModelHost 2019/04/08 11:04:53.140711 ERROR Microsoft.VisualStudio.Composition.CompositionFailedException: An exception was thrown while initializing part "Microsoft.CodeAnalysis.Diagnostics.DiagnosticService". ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. at Microsoft.CodeAnalysis.Diagnostics.DiagnosticService..ctor(IAsynchronousOperationListenerProvider listenerProvider) --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) --- End of inner exception stack trace --- at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.b__0() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import, RuntimeExport export, Func
3 lazyFactory) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import) at System.Linq.Enumerable.WhereSelectArrayIterator
2.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable
1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState) at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0() at Microsoft.VisualStudio.Composition.DelegateServices.<>c__DisplayClass2_0
1.b__0() at System.Lazy1.CreateValue() at System.Lazy
1.LazyInitValue() at System.Lazy1.get_Value() at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator
1.GatherTaggers(ITextBuffer textBuffer) Editor or Editor Extension
>
Я удалил переустановленные компоненты визуальной студии, обновил единство и создал новые проекты в единстве, удалил файлы и папки и другие вещи с помощью
и это: Сообщение об ошибке «Не найдено экспортов, соответствующих названию контракта ограничения»
и это: https://answers.unity.com/questions/1243747/visual-studio-error.html
Сведения об ошибке окна вывода: «C:...\unity\f1febc1088bcc6547ad7f93828b356f1\sprint 02\Assembly-CSharp.csproj: ошибка: не удалось открыть проект «Assembly-CSharp», поскольку не удалось создать компилятор Visual C# 2017. При вызове COM-компонента возвращена ошибка HRESULT E_FAIL».
я использую Visual Studio Enterprise 2017 версии 15.9.11 и
версия единства 2018.3.11f1 персональная.
инструменты Microsoft Visual Studio для Unity 3.9.0.3 включены
Какие компоненты VS вы устанавливали? Вы запускали VS вне единства? вы уверены, что он не просто сидит в окне и говорит, как вы хотите настроить VS?
Саад - в настройках - внешние инструменты у меня есть варианты «открыть по расширению файла», «Visual Studio 2017» или «Обзор». BugFinder - я перешел к установщику Visual Studio - изменить - рабочие нагрузки и снял флажок "Разработка игр с единством", щелкнул и щелкнул изменить. После модификации я вернулся и проверил «Разработчик игр ...» и изменил. VS отлично работает, когда я использую его сам по себе, например. откройте его, а затем напишите код на C# или C++. Окна ошибок в VS информативны и, похоже, не спрашивают меня, как настроить.
Я удалил предприятие VS и установил сообщество VS. Затем я смог открыть VS через единство для редактирования кода. Я задался вопросом, почему это должно иметь значение между предприятием VS и сообществом, поэтому я удалил сообщество и переустановил предприятие. И.... сработало. Итак, резюмируем: удаление и переустановка Visual Studio устранила мою проблему.
если вы следуете docs.microsoft.com/en-us/visualstudio/cross-platform/…, у вас будет версия сообщества Visual Studio. Попробуйте изменить его в настройках предпочтений единства.