❔ Creating new projects - Attach instead of Run
When I create any new C# project in Visual Studio 2022 (latest update, but cannot confirm whether the update is what broke it or not), the solution folder appears empty, and I cannot "Run" the program. It tries to get me to "Attach" instead.
When I close the project and try to open the .sln file, the project opens correctly, but it still doesn't give me "Run"
When I try to open the project from within visual studio, same issue.
When I try to open really old C# projects that I have, I get a warning saying that one or more projects in the solution were not loaded correctly.
I am not having this issue with any C++ projects. I can open old projects, create new projects, etc. and there are no issues.
53 Replies
$newproject
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
This doesn't solve my problem at all. I just created a WPF Application, verifying with this picture that I did NOT select .NET Framework, and the project still doesn't work.
open it up in a normal file explorer
are all the files there?
I tried. All files are there. No Run button
Open a terminal.
dotnet --info
show me the moneyYep, I know what this is
Please enlighten me because I do not. Thank you
okay, open up your environment variable editing thingy
Id love to tell you the name but mine is in swedish :d
"edit the systems environment variables" is the name loosly translated
you mean via visual studio?
nah
through the OS?
windows
ya
ok
this one
got it
ok, so in the bottom one, find your path
and click "edit"
literally "Path"
Right
okay, show me what it says?
won't let me edit:
might need to run as admin
one moment
mhm yeah seems so
we want it to look like this
This is what I got:
yep okay
so near the bottom you have
(x86)\dotnet
you probably also have a C:\Program files\dotnet
even further down
take the non-x86 one, and click "move up" until its ABOVE the other one
okay?Okay. One moment
like so?
yepyep
okay, now restart VS
and your terminal windows
awesome. will do.
this will make
dotnet
by default use the x64 SDK
this is a good thingyeah, that seemed to do the trick
👍
Figured it would
can you give me a reference as to what was wrong because I like to understand why things don't work.
2nd person today with this issue 🙂
okay, so VS actually uses the
dotnet
command under the hoodwill brb, please keep explaining if you have time.
do you know what an SDK is?
yes
software development kit
look at this screenshot from your paste 🙂
NO SDKS INSTALLED
now, I dont think you are an idiot. I think you installed an SDK
yeah, I did notice that, but I was going along with your instructions lol.
I think you installed the x64 SDK, as you should have
and that was correct
ah
but, your system already had the x86 RUNTIME installed
not the sdk, the runtime
these both provide a
dotnet
command thouso the x86 stuff was above the x64 stuff
that's starting to make sense, yeah
and your x86 one took president over the other one due to path order, yes
so we adjusted the order, making x64 default
and voila, you have an SDK
okay, that makes a whole lot of sense, thank you so much.
have a good day
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.