C
C#•13mo ago
matt

Struggling with running a project in VSCode

2023-12-04 16:55:46.647 [info] Unhandled exception. System.BadImageFormatException: Could not load file or assembly 'c:\Users\X\.vscode\extensions\ms-dotnettools.csdevkit-1.0.14-win32-x64\components\CPS\platforms\win32-x64\node_modules\@microsoft\visualstudio-projectsystem-buildhost.win32-x64\Microsoft.VisualStudio.ProjectSystem.Server.BuildHost.dll'. An attempt was made to load a program with an incorrect format.
File name: 'c:\Users\X\.vscode\extensions\ms-dotnettools.csdevkit-1.0.14-win32-x64\components\CPS\platforms\win32-x64\node_modules\@microsoft\visualstudio-projectsystem-buildhost.win32-x64\Microsoft.VisualStudio.ProjectSystem.Server.BuildHost.dll'
2023-12-04 16:55:46.647 [info] Unhandled exception. System.BadImageFormatException: Could not load file or assembly 'c:\Users\X\.vscode\extensions\ms-dotnettools.csdevkit-1.0.14-win32-x64\components\CPS\platforms\win32-x64\node_modules\@microsoft\visualstudio-projectsystem-buildhost.win32-x64\Microsoft.VisualStudio.ProjectSystem.Server.BuildHost.dll'. An attempt was made to load a program with an incorrect format.
File name: 'c:\Users\X\.vscode\extensions\ms-dotnettools.csdevkit-1.0.14-win32-x64\components\CPS\platforms\win32-x64\node_modules\@microsoft\visualstudio-projectsystem-buildhost.win32-x64\Microsoft.VisualStudio.ProjectSystem.Server.BuildHost.dll'
34 Replies
ZacharyPatten
ZacharyPatten•13mo ago
please run a dotnet --info in the command line
matt
mattOP•13mo ago
No description
ZacharyPatten
ZacharyPatten•13mo ago
it looks like you have the 32 bit version of .NET installed. youwant the 64 bit most likely are you on windows?
matt
mattOP•13mo ago
Yes im on windows
ZacharyPatten
ZacharyPatten•13mo ago
open your environment variables and check your PATH do you know how to do that?
matt
mattOP•13mo ago
got it open Im in the System > Path > Edit Environment Variable
ZacharyPatten
ZacharyPatten•13mo ago
there should be a "PATH" variable for your user and the system it should include the path to dotnet
matt
mattOP•13mo ago
ignore the NVIDIA
No description
ZacharyPatten
ZacharyPatten•13mo ago
okay so yeah you have two dotnet's. the x86 one and the one on your W: drive try moving the x86 to the bottom
matt
mattOP•13mo ago
Yep
ZacharyPatten
ZacharyPatten•13mo ago
so that the Program Files\dotnet\ will be prefered essentially we want it to use 64 bit
matt
mattOP•13mo ago
Ah
ZacharyPatten
ZacharyPatten•13mo ago
I don't know if this will fix your issue but I have seen similar issues with otheer VSC users after you change the order do another dotnet --info
matt
mattOP•13mo ago
Yep thats all working now and saying I have SDKs
ZacharyPatten
ZacharyPatten•13mo ago
and it should include the Program Files path (without the x86) if it does, try restarting VSC and doing the same thing
matt
mattOP•13mo ago
Any idea around this error? Exception thrown while loading w:\noble\Downloads\X\X\X.csproj Microsoft.CodeAnalysis.MSBuild.Rpc.RemoteInvocationException: An exception of type System.AggregateException was thrown: A directory or directories in "msbuildSearchPaths" do not exist
ZacharyPatten
ZacharyPatten•13mo ago
I would probably have to see the code and try to replicate it to help with that one, but you are at least past your initial error it seems 🙂 keep in mind that Visual Studio is much more beginner friendly than VSC. VSC is decent once you know what you are doing, but it require extra manual crap (like the environment variables you just dealt with) and that makes it not beginner friendly is your code open source?
matt
mattOP•13mo ago
No its from a friend im trynna help code wise, I just aint set up C# before lol So should I just install Visual Studio instead?
ZacharyPatten
ZacharyPatten•13mo ago
very much yes. Visual Studio Community edition is free. Visual Studio is a fully featured IDE and much better than VSC for C# in general. I still like using VSC personally, but it is just not on Visual Studio's level
matt
mattOP•13mo ago
Okay cool installing it now, lets see what happens IG lol
ZacharyPatten
ZacharyPatten•13mo ago
can you also share the .csproj file?
matt
mattOP•13mo ago
ZacharyPatten
ZacharyPatten•13mo ago
okay... so... that looks like a windows forms app
matt
mattOP•13mo ago
yes it is can vsc not run that
ZacharyPatten
ZacharyPatten•13mo ago
which you definitely need visual studio for VSC doesn't have a windows forms designer at all you need VS for it
matt
mattOP•13mo ago
Ah thats the issue then
ZacharyPatten
ZacharyPatten•13mo ago
also this looks like a .NET Framework project .NET Framework is old and legacy now we are using ".NET" now
matt
mattOP•13mo ago
Whats the difference and how easy is it to migrate from .NET framework -> .NET
ZacharyPatten
ZacharyPatten•13mo ago
It is easy to migrate, the difference is that ".NET Framework" was Windows only. ".NET" is more or less an entirely new version of .NET that is cross platform Windows Forms apps are not cross platform, but ".NET" apps that don't use windows dependencies are cross platform
matt
mattOP•13mo ago
Oh ok Thank you
ZacharyPatten
ZacharyPatten•13mo ago
$newproject
MODiX
MODiX•13mo ago
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework. .NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended. https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
ZacharyPatten
ZacharyPatten•13mo ago
also, when you install Visual Studio, be sure to select this workload to install:
No description
ZacharyPatten
ZacharyPatten•13mo ago
you can adjust what workloads you have installed via the Visual Studio Installer. Just launcher it and choose "modify":
No description

Did you find this page helpful?