vs2019 C# console app does not run as expected - .net-core

Visual Studio 2019 is not creating and executing a console app like previous versions of VS.
If I open a new project, put this code in Main():
Console.WriteLine("hello");
Console.ReadKey();
and hit F5, the app appears to run, then exit with code 0. The console doesn't wait for a key input to close, and breakpoints in the source do not hit.
The EXE should be in this folder
c:\projects\test-app\bin\debug\
but it is actually in:
c:\projects\test-app\bin\debug\netcoreapp3.0
and when I run it from that location outside the IDE it opens a console and immediately closes it, apparently not running the code in Main().
Going through the exact same steps with Visual Studio 2017 runs the app as expected.
I can live with the final exe being located to a different folder but VS2019 doesn't even seem to be running any of my code. Am I missing something?

Related

Visual Studio created Qt Project not opening terminal window when running

I have the problem, that I wrote an executable (windows .exe) in Visual Studio 2019 with Qt 5.12 (x64). It is supposed to be a console (no-gui-, server-) application. And it works just fine. But when I start the application I get not console window. In other applications of the same type I do get the terminal console window. AND (and this is why I wanted that) I can see debug output. I already tried "subsystem:windows" -> "subsystem:console" but with no success. Does anyone know a setting I might change there to get the console showing up again?

Visual Studio 2022 VUE3 Project Won't Start "Unable to start debugging"

Background: I have a VUE3 WebApp created using the VS2022 templates
https://learn.microsoft.com/en-us/visualstudio/javascript/tutorial-create-vue-app?view=vs-2022
that was working well on a desktop (Windows 10 Pro) and a laptop (Windows 11 Home); i.e. I could open Visual Studio 2022; have the WebApp as the start-up project; click run/debug and it would run up.
Current Issue: On the desktop this continues to work as expected; however on the laptop when I go to startup the WebApp I get a message "Unable to start debugging. The startup project cannot be launched. Ensure that the correct project is set as the startup project. .... Additionally make sure its debug settins are correctly configured in project properties"
Project Properties: the two machines have the same project properties; nothing really in there other than Startup Command is npm run serve
I don't believe I've changed anything and the two machines are using the same source control repository and branch; just wondering how I work around this / what might have changed. I've done Visual Studio 2022 Updates on both machines (so up to current version on both machines). One difference is on the WebApp project if I right click, select Debug, on the laptop the options are all greyed-out; on the desktop you can select "Start new instance", "Start new instance with debugging", etc..
Any ideas on what is happening here? Or troubleshooting steps I can take to resolve?

Self-Contained Single-File Win Form app does not run

I am on VS 2019 16.8.3 with .Net 5.0.
I have created a simple Win Form project without any NuGet or project dependency. I have made sure it runs out of the IDE.
When I published the project to a self-contained single file exe, it does not run. The Task explorer briefly showed the exe and switch it to suspended before killing it. The exe works fine after I republished it either without the single-file or the self-contained option. It seems like both options cannot co-exist.
Any idea?

Visual Studio 2017 Doesn't Run Core Apps with IIS Express

I am having an issue with Visual Studio 2017 RC where when I run an MVC and/or WebAPI app using IIS Express the app never actually runs. Instead I get stuck with a page in the browser indicating it is trying to attach and from there it goes no further. If I open another tab/window in the browser and try to navigate directly to the launch URL, it just spins forever. Likewise when I run this using the dot net run command, the app launches and runs fine.
There do not seem to be any errors that I can see, just that the browser spins indefinitely without actually ever loading the page/endpoint.
Note: this occurs for most any circumstance. Newly created project in VS with no changes, known working project from previous versions, etc.
You could follow or upvote the issue: https://developercommunity.visualstudio.com/content/problem/11391/aspnet-core-iis-express-httplocalhost51733-failed.html
Looks like our workarounds meanwhile are
dotnet run
Publish to local IIS. Which is working for me.
(Untested: downgrade from core-1.1 to core-1.0)
If you aren't familiar with VS2017/asp.net:
You have, or can reveal via View Menu-->Other Toolbars :
Debug toolbar --> dropdowncombobutton saying "[green arrow>] IIS Express"
Click on the dropdown downarrow part of the button.
You should see a Run {yourprojectname} option.
This is the equivalent of dotnet run {yourprojectname} from the commandline.
You can configure the options that appear in the dropdown with
Right-click on project in solution explorer --> Properties --> Debug
I had this same issue and after digging around for a while I discovered that I had dotnet preview v1.0.0-preview2 installed under Programs Files (x86) and a non-preview version in x64. I think VS is launching the x86 (preview) version but expecting to see the full version. To fix this, I did the following.
from programs and feature uninstall every visible dotnet core. (note: for me this did not remove the x86 preview)
go to https://www.microsoft.com/net/download/core#/sdk and install BOTH x86 and x64 SDK packages
open command line and from the root directory check run: dotnet --version (at the time of writing it was 1.0.4)
fire up .net core project in VS 2017 and run.
When I did all of the above, I was able to start up the site in IIS Express from VS.

Visual Studio 2012 - There is an error in XML document (0,0) when trying to close the program

I"m getting this weird error when I try and close Visual Studio 2012 or do a publish to the Azure cloud. It comes up with an alert box that says "There is an error in XML document (0, 0)" and won't let me close the program and I have to end process in order to exit. It also appears when I right click the cloud project and select publish from the context menu. I am able to package the project however. Which I find odd.
Any ideas at all on what could be the issue? I tried re-installing both VS and Azure SDK and I still receive the error. I also uninstalled my extensions and I'm still receiving the error. Not really sure what to do about it.
EDIT
I'm only having this issue in VS2012. I can open the same project in VS2010 and not have any issues closing the program or publishing it to Azure

Resources