Can't run a C# web API in Visual Studio 2022 - c#

I am trying to run a web API written in C#,in Visual Studio code 2022 but I keep getting this error
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

I was having the exact same error, it turned out Visual Studio just needed an update.
Updated it and restarted the app and it went away.

Related

NanoFramework Device Explorer would not open

I was able to use nanoframework normally but somehow the DeviceExplorer no longer opens now.
I checked the ActivityLog.xml and it shows the following error:
819 ERROR SetSite failed for package [Visual Studio 2019 extension for nanoFramework. Enables creating C# Solutions to be deployed to a target board and provides debugging tools.]Source: 'nanoFramework.Tools.VS2019.Extension' Description: Could not load file or assembly 'Microsoft.VisualStudio.Threading, Version=16.9.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Threading, Version=16.9.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.VisualStudio.Threading, Version=16.9.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'at nanoFramework.Tools.VisualStudio.Extension.NanoFrameworkPackage.<InitializeAsync>d__65.MoveNext()at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)at nanoFramework.Tools.VisualStudio.Extension.NanoFrameworkPackage.InitializeAsync(CancellationToken cancellationToken, IProgress`1 progress)at Microsoft.VisualStudio.Shell.AsyncPackage.<>c__DisplayClass20_0.<<Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize>b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)at Microsoft.VisualStudio.Services.VsTask.GetResult() 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]. {046B40EB-1DE1-4D08-AF61-FDB7592B9BBD} 80070002 VisualStudio 2021/03/21 07:18:45.265
820 ERROR End package load [Visual Studio 2019 extension for nanoFramework. Enables creating C# Solutions to be deployed to a target board and provides debugging tools.] {046B40EB-1DE1-4D08-AF61-FDB7592B9BBD} 80070002 VisualStudio 2021/03/21 07:18:45.270
I want to highlight that my Visual Studio nanoframework extension is set to update automatically and it sounds like it recently got updated to 2019.5.0.34
I am using Visual Studio Profession 2019 16.8.3
Disabling/Enabling the extension, restarting the visual studio did not help.
Any clue what could be causing this issue?
You should update Visual Studio to 16.9 or higher.

Visual Studio UI Testing

I have done some extravagant web searching for a solution to no avail.
I am working with a UI tester written by a man who is no longer with the company.
Currently it is hanging up on opening the browser for testing the website.
I have no idea what I'm doing.
BrowserWindow.CurrentBrowser = "ie";
"An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Microsoft.VisualStudio.TestTools.UITesting.dll
Additional information: Could not load file or assembly 'Microsoft.VisualStudio.TestTools.UITest.WindowsStoreUtility, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified."
Figured out what the issue is. I can't run it directly. I have to pass it to MSTest.exe with arguments.
If you don't know where MSTest.exe is, here is where mine is, and most likely yours.
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe

Visual Studio Error - FSharp.Core, Version=4.3.1.0

I have encountered a very iritating problem using Visual Studio 2017 Community. When downloading any package from NPM (here for example System.Web.Http.Common) every time I get this error:
System.IO.FileNotFoundException: Could not load file 'FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
My project does not have any Fsharp files, it is pure ASP.NET project.
Update of VS did not help.
What am I supposed to do?

FileNotFound Exception when referencing LinqPad.exe

I am trying to use LinqPad's dump feature (https://stackoverflow.com/a/9437947/3375305) from within Visual Studio. (.netCore 1.1 Console App).
I have added a reference to LinqPad.exe, but whenever I try and run the program, a File Not Found exception is thrown.
System.IO.FileNotFoundException: 'Could not load file or assembly
'LINQPad, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=21353812cd2a2db5'. The system cannot find the file
specified.'
I have tried LinqPad 5.10, 5.10 AnyCPU, 5.21 AnyCPU (Beta)

How to Resolve Server Error in '/' Application (Configuration Error)

My web application was working perfectly minutes ago now I get this error when I run it.
How can I solve this issue since its not even part of my project files?
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'System.Web.Mobile, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE)) (C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config line 285)
Line 285: add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"**
I probably should have done this before posting the question.
I saved my work then restarted Visual Studio.
It worked for me as well after restarting visual studio.

Categories

Resources