ASP.NET Core 6: how to bring the console window to the foreground upon launch - asp.net-core

After creating a new project using the "ASP.NET Core Web App" template, when I run the project, I want the console window to automatically be brought to the foreground. Since I'm mainly developing a web API, I don't want the browser to launch (which I've done in launchsettings.json), but do want the console window to show.
I've verified that this is the default behaviour when creating a .NET Core 6 Console app, yet I can't find the settings responsible for this desired behaviour.

It can be achieved easily just by changing a debug setting. It may be a little bit different in old versions of Visual Studio!
VS2022
1. Open Launch Profiles window:
2. Select relevant profile from opened window and change Launch browser setting(uncheck it)
3. Save the change if there is any Save button. and run the project.

Related

Disable Webview in Console Application

I'm building a NET6 local multiplatform console application as shown:
But even with a single "Hello World" and without any reference or package being called, everytime I debug-execute the code a lot of "Webview2" is loaded on the Windows processes.
Worst: even stoping the debug session, these modules remains active and they seems to close only if i manually finalize them in Task Manager
Since the application is not an ASP.NET nor a Winform application, why Visual Studio 2022 loads Webview2?
Can I disable it?

VS2022: how to make ASP.NET Core 5 app show it's console window

In VS2019, when I start my ASP.NET Core 5 app, which just exposes an API, if that matters, a console window pops up for that app. There used to be some setting to decide whether to run it as a console / standalone app or host it in IIS Express. I always preferred the console / standalone version because it lets me see the logs in realtime.
In VS2022, when I start the very same project, no window appears at all, and, interestingly, neither do I see IIS Express starting up.
How can I get back to having the project start as a console app? (Except starting it from the command-line and then attaching the debugger.)
UPDATE:
ok, so at long last I noticed that, strangely, a minimized console window is being created and because I start a dozen projects (microservices), I didn't notice before, and procexplorer telling me that the executable had no window added to the confusion. So this is much less problematic, albeit still weird - why does this one particular application not start un-minimized? The only difference it has to all the other executables is that it uses ASP.net core while the others (all background services communicating via messagequeue) don't.
and this only in VS2022, in VS2019 all executables including this one start unminimize
You have to make sure, that you selected "IIS Express" as your debug profile
VS 2022 debug profile
I believe you are looking for this. Follow the steps highlighted in in each image:
Go to your project properties:
Then you will see that the console is open in the task bar.
In Visual Studio 2022 this is currently NOT POSSIBLE

Is it possible to change .cshtml View and see the changes instantly using .NET Core?

Context
In my .NET Framework 4.x ASP.NET MVC projects, when using the Visual Studio IDE, it was possible to edit a .cshtml view, save, then press ctrl+F5 in the browser and see the change immediately.
This seems to be no longer work in ASP.NET Core applications (using Visual Studio 2019 and .NET Core 3 Preview 5).
Question
Is this feature missing in ASP.NET Core? Is this a preview issue? Or am I missing something?
This is something that is no longer enabled by default as of ASP.NET Core 3, but it can be re-enabled as documented here:
Runtime compilation is enabled using the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation package. To enable runtime compilation, apps must:
Install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet package.
Update the project's Startup.ConfigureServices method to include a call to AddRazorRuntimeCompilation:
services
.AddControllersWithViews()
.AddRazorRuntimeCompilation();
I've marked Kirk's answer as accepted, but maybe this experience could be useful also.
My goal was a "quick edit (cshtml/css/js/ts) then see" iteration.
No need to add and mod anything... I discovered that .NET Core (3) and VS 2019 is so much faster, so in case if we do not want to debug in VS (which is the scenario in most cases when we are changing cshtml/css/js/ts) there is really great iteration:
Press ctrl+f5 to launch your web app (no debug) in browser
See, test (debug js/ts in Chrome)
Edit your cshtml/css/js/ts
Press ctrl+shift+b to build (fast!)
Switch to your browser and press ctrl+f5 to refresh your page (fast!)
Goto 2

how to open already Implemented asp.net mvc solution into my system?

unable to open Implemented solution into my system by using vs2013 and .net framework is 452, when i am trying to open solution First i get bellow dialogue box about TFS:-
Team Foundation Server version Control : The solution you are opening bound to source control on the following TeamFoundationServer http://tfs:8080/tfs/default connection. would you like to connect this server to try to enable source control integration? (yes/ no) , But i'm not using TFS here, then i clicked on No button then
Again I got one dialogue box with source control with in this dialogue box message like"The solution appears to be under source control, but its binding information cannot be found. Because it is not possible to recover this missing information automatically, the projects whose bindings are missing will be treated as not under source control." (Ok and help) i clicked on ok. then solution opened files with message load failed. ex:- In solution explorer projectName(load failed)
You can ignore the messages about the solution/project being under source control. That is not causing the project not to load.
You likely don't have some required Visual Studio plugin to open that project. The Output window should have more details as to why the project couldn't load. Typically this is because you don't have an older version of MVC installed.

custom Icon not displayed in mono application

I have a mono application developed with MonoDevelop as IDE. I'm working with windows 7.
I set a custom icon (embedded into the .exe).
When I run my application from inside MonoDevelop, all is fine.
But when I manually run "mono.exe ", my custom icon does not appears in the windows task bar. Instead, it appears a -it seems to me- predefined one.
How can I get my custom icon visible also when running my application from the command line? Starting always from inside MonoDevelop is not an option.
Thanks!
When you run your app from MonoDevelop, it runs using the .NET runtime. So Windows is able to pick up the app icon. When you run it using Mono, the executable app (from Windows' point of view) is Mono.exe. So you get Mono's icon.
I recommend that on Windows you run your app on .NET - even MonoDevelop runs on .NET on Windows. The Mono package for Windows is primarily intended for development (checking your app will run with Mono) and for specialized embedding purposes.