How to create Console App for ASP.NET Core in Visual Studio For Mac - visual-studio-mac

I don't see an equivalent way to create a console app in Visual Studio for the Mac. That is, the equivalent of
dotnet new console
When I want asp.net core does not seem to show up as an option. I'm assuming I've missed it since it's kind of a basic thing.
Thanks

In Visual Studio for Mac you can use the File | New Solution... menu and within the dialog that shows up, select the .NET Core | App category on the side. Then you'll see the option to create a Console Application.

Related

Visual Studio for Mac 2022 - Hot Reload?

I am a fairly new to developing applications on Mac OS. I am using Visual Studio for Mac 2022 - Preview. I am all up to date and have created a ASP.NET MVC Web Application using .NET 6. I have started the debugger using the generated project. I make a change to the Index.cshtml file but that change fails to be reflected in the browser after saving the file. Any ideas if Hot Reload works in Visual Studio for Mac? I dont see any button to toggle the Hot Reload as all screenshots i have seen are for Windows Visual Studio. Any help would be appreciated as stopping and starting the debugger each time a change is made is very inconvenient. Thanks.
EDIT:
I have installed the Nuget Package
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
And then updated my Program.cs file as follows:
// Add services to the container.
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();
My changes to .cshtml files still do not want to recompile after saving.
Any more help would be appreciated.
Visual Studio for Mac
Version: 17.0 Preview (17.0 build 5186)
Created a new Web Application (Model-View-Controller) project.
I got it to work on the latest preview version of Visual Studio 2022 for Mac. You will need to add the NuGet package, and also add the service to your builder in the program.cs file as an extra service:
builder.services.AddRazorPages().AddRazorRuntimecompilation();
https://learn.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-6.0&tabs=visual-studio#enable-runtime-compilation-for-all-environments
I don't know of any way to do it within Visual Studio, but if you navigate to the folder with your .csproj in Terminal, you can type
dotnet watch
and it will load your app. Then you can make changes within Visual Studio, save, and the browser will automatically reload. The only problem is since it's running from the command line, it won't hit breakpoints in your program (I don't know of any way to do so anyway).
As mentioned above, adding builder.Services.AddRazorPages().AddRazorRuntimeCompilation() works well, the only thing that you have to reload the page manually though, while your project is running.

How can I prevent Visual Studio (2019) from opening "VS Debug Console" and just use the old .NET Core Host console?

It seems like with VS 2019 (Enterprise?), there is a new type of console application host available that even stays unclosed after I stop debugging. When starting multiple projects, the first console application that starts up will be of this new type.
I am searching for a way to prevent VS to use this console for the "main"-project, and simply use the same console for every project I am starting. I have started the same solution with 4 ASP.NET Core projects inside VS 2017 and Visual Studio did not start any console with 'dotnet.exe' in the title. So for is seems like this is a new thing in 2019.
The reason for this question is because I am having some trouble with this new console. The project often does not start at all and the colors of the console are all green. But that shouldn't be topic of this question.
So is there a way to prevent Visual Studio 2019 from starting this new console?
There's a setting under Tools->Options->Debugging->Automatically close the console when debugging stops that will restore the old behavior.

how to set up windows phone develop environment and using F# to develop application?

I have already download the windows phone develop tools but I don't know how to using F# to developing the app, currently it's C#.
Installing a template for 'F# and Windows Phone' into Visual Studio makes life a little easier. If you open Visual Studio and go to Tools->Extension Manager it will open the Extension Manager dialog. From there, if you select the online gallery and type 'F# Windows Phone' into the search box you can find a couple of templates that should help you get started. Most of them were written by Daniel Mohl. His blog can be found here Daniel Mohl

Is there any way to make Visual Studio 2010 stop starting my MVC projects?

I have a Visual Studio 2010 Solution that contains a few library projectes, a few WPF projects and an ASP.NET MVC 3 project. When i start any project the MVC project get started in the development-server.
Is there some way to stop this behaviour?
Edit:
I just checked to make sure I´m to doing too much wrong. If you start a new solution with a console/whatever project and add an mvc3 project, everytime you start the console project the mvc project gets started as well.
Not sure if this is buggy or an intended feature, but it is kind of strange that the behaviour is so different from normal projects.
If you don't need MVC project for certain period of time, you can unload it (Right-click on the project and select Unload project).
Another option is to select local IIS as a web server (If you have it installed). This way it won't start development server.
You can always choose another project as the default project to start up. You can right-click on the project and set as startup project.
Make sure all your web projects are set to use local IIS rather than the Visual Studio Development server. Unlike the development server, IIS doesn't do anything with a new build until you actually try to load a page.

ASP .NET MVC Freezes Visual Studio during new Project Creation

I'm using VS 2008 with SP1, on WinXP Pro, and I successfully installed the MVC package from Microsoft. I start a new project, select the MVC web project type, and give it a name and folder. When I press go it hangs forever.
The "ProjectName" folder is created, but nothing else is there.
I can create and open all my other projects without any issues.
Any ideas what's causing this issue? I can't try the MVC framework if I can't create a project!
If you use Process Monitor & Process Explorer, you can probably find out what VS is waiting for.
PM: http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
PE: http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
I had a similar issue: Instead of uninstalling Visual Studio add-ons I tried the fix.
I found this blog post form the VS team:
http://blogs.msdn.com/webdevtools/archive/2009/03/03/hotfix-available-for-asp-net-mvc-crashes-with-azure-power-commands-resharper.aspx
that points to a fix:
https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827&wa=wsignin1.0
It Worked!
Give a try to ASP.NET MVC 2 Preview 2.

Resources