Single Page UI in C# [8 of 11]
![Single Page UI in C# [8 of 11]](https://sec.ch9.ms/ch9/4ed7/b2d39e0b-c7ba-48d7-a578-468c89894ed7/Xamarin101SinglePageUICsharp_512.jpg)
This is a quick tutorial for getting started with C# in VS Code on Windows with .NET Core!
Excellent introduction for VS Code with C#!
Very neat, to the point, and fun. Excellent!
Fast and furious coding :)
Very well !!!
I like this girl, I would like to watch more videos like this, and know more about VS code.
Very nice video! More please.
Rockstar. Please post a git/GitHub demo using VSC
Excellent. Please create more of those!
Next time please spend a couple of seconds explaining in more detailing what is happening.
e.g when you execute "dotnet restore" - what exactly is happening here? You skip a bit over the details for the sake of brevity.
@GammaMonkey: A git demo with VSC is a great idea. I'll put that on my list.
@The Wizard of Oz: I like this wizard. Thanks for watching!
*@IPowerPanda: "dotnet restore" links required build assets to you new C# project and creates the all-powerful project.json file. The project.json file is what VS Code uses to recognize that this folder has a project in it. You can get a better idea of what data it stores on your project here. Let me know if that helps. :)
*Edit for @IPowerPanda: Actually I went back to my video and my first answer is not accurate. (Sorry!) "dotnet restore" actually creates the project.lock.json. There is an awesome explanation of this on stackoverflow here.
Very well! More please.
any support for WPF or XAML ?
Nice, thank you.
Very nice video!
@SteveRichter: If you are only concerned with windows environments, you can actually target .NET Framework in VSCode which would have XAML and WPF support. This is super useful for folks who want to quickly launch projects and don't need all the features in Visual Studio for what they are working on and just want something light-weight to work with on a windows machine. My tutorial uses .NET Core to compile and that does not support WPF nor XAML cross-platfom.
Porting System.XAML to .NET Core is definitely a popular request! We have an open issue on GitHub that details the discussion. Basically, the community really wants it, but the team is first trying to implement a set of standard libraries in .NET Core. See out roadmap here.
Also thanks everyone for the positive feedback! I am working on a Mac set-up tutorial next. :)
Hi,
all is ok. but.
I repeated your steps on linux (ubuntu 16.04) and found that there is no
predefined right for c# launch,json file. may you please describe how to do it ? or may be send sample, please or send link how to learn to do such files for c# right ?
@NikolaiKekish: Looks like that I found answer.
"If you open the folder containing your project.json, the C# extension can automatically generate these files for you. When you open a project and the C# extension is installed, you should see the following prompt in VS Code:"
from https://github.com/gregg-miskelly/omnisharp-vscode/blob/daily-build-docs/debugger.md
@NikolaiKekish:Hey there! I am so sorry. I should have made it clearer that this tutorial was only for a windows environment. I just had a co-worker point this out to me too, so you are not alone. I plan on making different tutorials for mac and linux soon because they each will look a bit different.
For now, this may help:
The page on github that you found is for using the daily builds. I wouldn't recommend this for a beginner tutorial, but yes, the project.json files are automatically generated.
Generally, ubuntu 16.04 (for @NikolaiKekish) should download VS Code from the .deb file here. Then follow the steps to install the .NET SDK here. Download the C# extension in the same way I showed you in the tutorial by clicking on the extensions tab and selecting the C# extension in VS Code. The rest of the tutorial should be basically the same from there.
...
For mac users having similar problems:
Mac users need Homebrew and OpenSSL installed (directions here) in order to install the .NET SDK. I plan on walking through those steps in my next video. Also, the Console.Beep library that I call is not available on mac, fyi, so I'll use a different example to demonstrate intellisense and omnisharp are working.
git/GitHub for VS Code examples PLEEEASE!!!
Getting an error - "launch: launch.json must be configured. Change 'program' to the executable file that you would like to debug."
In this example where and what path should be in launch.json
@kendrahavens: many thanks. I tested .net core on linux. it works fine.
I found out that there is no mysql support (only in beta) so it is not good for me.
Maybe do you know right way to use mysql from .net core?
@marcin: Hmm, I'm trying to understand why that error would come up. After omnisharp and the debugger finish installing a pop-up at the top appears to add required build assets. If you click "yes" when the required build assets pop-up appears the launch.json file would be configured automatically. Could you comment some screenshots? I got the same error when I clicked "no" when the prompt to add required build assets appeared. That might be your problem. I do this at 3:17 in my video. Looks like you will need to add it manually if you clicked no. Find help for that here. (I would recommend just starting a new project and hitting "Yes" and then copying over your code.) Let me know if that helps. :)
@NikolaiKekish: Good question! This is the stack overflow tracking this topic. This is a walk-through of getting set up. I haven't tried it out myself, but I hope this helps. :)
what a cute expert... and she is also short, clear and precise... let her do more presentations...
I would like to see how to use win10-built-in-ubuntu for development directly from visual studio (on windows), both in C# and C++ (and maybe even VB.NET)...
I did enjoy the video and learned from it. Thanks.
Excellent! I was looking for something like this.
Comment removed at user's request.
That was excellent Kendra, the enthusiasm was beeping refreshing.
Thanks you, I from Ecuador....and you are is a great teacher..... This class was excellent...lady Kendra ;)
Really Simple and Straight, awaiting for more regarding the Net Core.
are you in MicroSoft since a month only, or just started taking care of the Net Core since a month, whatever the case, wish you all the best.
Can you pls add to you list preparing a one about publishing/distributing the app without using a paid service (i.e. without using Azure).
Thanks
I made a Chinese version, please visit here
http://i.youku.com/i/UMzg0NDg0ODEyMA==/videos
Lovely and light introduction, thank you :)
Great!!!
Hi can you do a tutorial for a hello world with VS Code and ASP.Net Web Pages. I would like to see how you get the debugging setup with razor code. I've tried a few times from scratch but have only been able to copy larger ASP.net core examples and then run the .cshtml files in that but I dont want to use the MVC model. I did it using Visual Studio 2015 Community but I would like to do it on my Linux
Thanks Andrew
BTW great job on the vids
I am going to egregiously +1 the previous posters request for VS Code and ASP.NET web Pages debuggin
Thnks so much, Finally i can write a simple app in VS Code :S
Excellent! Start to finish... that's perfect. And a Classic "Hello World!"
thanks so much,but when I want to run my first project, in terminal
here is the error:
C:\Users\c#\code\HelloWorld>dotnet new
Access to the path 'C:\Users\c#\code\HelloWorld\Program.cs' is denied.
please help me kendra
@pouria:Have you checked using different folders? it looks like some administrator privileges aren't working, folders outside users, running as administrator or checking your Microsoft user could fix the problem? i have heard of strange locked folders in windows before
@pouria:Sorry, I didn't get back to you sooner! As @gabrielqv: said, it sounds like a folder permissions problem. I would first open up the command prompt in "Run as Administrator" and try to run "dotnet new" again. That often solves file permission problems. If that doesn't work I would google "access to the path is denied" for tutorials on how to check and change the permissions on my folders. Let me know if this helps!
Great video. It looks like this is the new thing that we now need to learn. I was told that this will replace WPF. Is that right?
Awesome intro video... loved the "Holy BEEP!" finale. :)
Excellent start! It would be great to have a tutorial that shows how to connect a .NET Core class to a legacy ASP.NET web service.
We want to move to .NET Core in phases and the client is obviously the first step but our server is still running an ASP.NET web service (SOAP).
Hi.
When do you publish a new video but, instead of showing steps of a regular VSCode and NetCore installation, why not tty with the VSCode portable version -the IDe packaged in a zip folder- together with the zip package version of the .net Core version? In other words, no the executable packages, intead use the .zip packages distribution?
Hi @kendrahavens have you tried installing visual studio 2017? I am in a school project and looking for a lightweight solution for c# programming, was happy with code, but some people (incorrectly) told me that I needed to do some form apps so I needed visual studio, 2015 worked fine before, but after installing code and seeing good results with only 10% percent of the 9gigs installation I tried my luck with Visual c# sharp 2010 (the last version that seems to fit in 1 GB!!) however errors arose even only when starting the project, saying that the 4.0 framework couldn't be found (but it was installed !)..
As VS2015 worked ok and I heard there was a lightweight 2017 version with a 700mbs install I tried my luck with the Release candidate, but nope, 700mb are only for a basic text editor I can't even run a console app, for that it downloads an extra 3 gigs... so taking into account data caps (no offline install for 2017) and that I can't work anymore with visual code it all got pretty annoying :(
code works if I use " dotnet run " but I can't make it work with the play button as before so no debugging at all.
does frameworks interfere that bad with each other? or is this a problem with 2017? csproj ? sorry for the rant, I hope things get sorted and I don't spam this video box
A good video that quickly got me up and running very quickly with C# in Visual Studio Code.
At first, I was thinking to myself "A beep for an example? Really?" but the presenter integrated it into her presentation hilariously!
@Bill: No. .NET Core is a great solution for people who want to build cross-platform apps. WPF and the .NET Framework are still awesome options for windows development.
@soraco: That's great! I'll see if I can do that tutorial or maybe check with the ASP.NET monsters to see if they've already covered something similar. Is migrating from ASP.NET to ASP.NET Core the basic challenge here?
@Mazndzukic:That's definitely an option. I, personally, like this way because users are more likely to understand they are two different components that will have different releases at different times. I see that as important from a developer standpoint so you know which one to file bugs on or which one to troubleshoot when something is acting oddly. They each have different documentation associated with them as well. I'll keep it in mind though! Easier installs is always nice! :)
@gabrielqv: That does sound frustrating. :S So, which environment are you working in now Visual Studio or Visual Studio Code?The frameworks should not interfere with each other. Sometimes multiple installs of different Visual Studio versions can cause problems. However, Visual Studio and Visual Studio Code can be installed alongside each other with no issue. Are you still working with a form app? (Sorry for the delayed reply!)
Thanks, everyone still reading these comments for the positive replies!
Awesome Video...Eager to explore more in VS Code. Could you please add video for Web application development samples.
Hello Kendra,
Many thanks for such a friendly and straight to the point getting started video.
I've encountered a problem while trying to debug the .cs script. During the debugging command I've got the following error:
ERROR: Unable to start debugging. Unexpected CLRDBG output from command "-exec-run". Only 64-bit processes can be debugged.
The program 'c:\Educational\Projects\C#\bin\Debug\netcoreapp1.0\C#.dll' has exited with code 42 (0x0000002a).
I am running the Visual Studio Code over windows 8.1 and I've installed .Net Core SDK with x86 option. Are you aware about similar debugging issues?
Thank you again,
Cris
Beautiful video. Beautiful teacher. Simply perfect!
@Cristian: Interesting. Does the command "dotnet run" work?
Microsoft needs more Kendra!
concise video Holy BEEEEEPPP!. Loved the ending. Nice job - long time C# coder, was missing it on OSX. Not any more :)
@kendrahavens: Of course, the command works all right.
Hope that you also had a video about asp.net core mvc showing on how to scaffold using a controller with entity framework in visual studio code. and also by showing us how to create a full blown web application like a blog using the asp.net core MVC using just only VS code. nice video by the way.:)
I just love your videos and the way you teach us, keep up this awesome job!! Thank you so much!
I cannot get past the dotnet restore command. I get an error saying that the access to the path is denied! Any advice?
I think the webpage for .Net Core has changed since your original video.
1. Download Visual Studio 2015
second paragraph does not mention .Net Core SDK
I clicked on the "Command Line/Other" tab. I found the
"Install .NET Core SDK" there and downloaded it.
Everything else went just like the video except when I clicked program.cs. That is when Omnisharp and I think the .Net Debugger
were downloaded and the Terminal CMD.EXE box switched to
Output.
I thought I installed OmniSharp C# extensions when I started VS Code.
So do Why did it need to be installed again?
I switched back to terminal using Control-`(backtick) and ran program.cs. It ran with no problem.
Also at the top of VS Code window below the menu bar there is a line saying
Warn Required assets to build and debug are missing from 'HELLOWORLD'.Add them? Don't Ask Again | Not Now |Yes
I chose Yes and below HELLOWORLD I have three(3) directories
.vscode, bin, obj
I am using VS Code 1.8.1
By the way I confused setting a breakpoint when you mentioned hitting F5 in your video.
For laptop users you may have to hold down the fn key when you hit F5. Dohhhh.
Great for beginner to explore .net core and vs code :)
ooops I meant:
By the way I confused setting a breakpoint with Debugging when you mentioned hitting F5 in your video.
For laptop users you may have to hold down the fn key when you hit F5. Dohhhh.
Let me squeeze one last question in:
Can you install VS Code and Visual Studio Community on the same machine?
I installed VS Code in order to learn how to install C# support in VS Code.
Now I am ready to try writing C# code to write sharepoint CSOM- I think that means Client Service Object Model- code in C# with Visual Studio Community edition.
Thank you
Excellent, exactly what I was looking for.
Nice video series. MS has come a long ways since I was an FTE. I Noticed that in the video the browser was Chrome and the default search engine was Google. While I was at MS I always argued for letting the best app\tool win (I also used Chrome\Google), and if MS product teams needed to step up to beat the competitors, then so be it. In the past, including competitor software in public facing videos required upper management approval. :)
Hello, I was actually scratching my head on how to actually start this. One thing though. I have tried to go step by step on the project, however I can't seem to get to the debugging part. I never get the "Required assets to build and debug are missing from your project" and when I try to go to debug, I need to set it up manually.
Kendra, I think I am in love with you and VSCode
Hello Kendra,
Many thanks for such a friendly and straight to the point getting started video.
I've encountered a problem while trying to debug the .cs script. During the debugging command I've got the following error:
ERROR: Unable to start debugging. Unexpected CLRDBG output from command "-exec-run". Only 64-bit processes can be debugged.
The program 'c:\Educational\Projects\C#\bin\Debug\netcoreapp1.0\C#.dll' has exited with code 42 (0x0000002a).
I am successfully compiled and executed the code with (dotnet run command). This problem is only with DEBUG option.
I am running the Visual Studio Code over windows 8.1 and I've installed .Net Core SDK with x86 option first and after seeing this error, i observed that my machine is x64 and the i install SDK fro x64, still i am getting the same error. Could you please help me with this.
Thank you again,
Srikanth Potla.
Hello Kendra,
Thanks for the video, the above debugger issue got fixed for me. I just uninstalled VS Code and other sdk installers. And started freshly with VS Code installation and installed SDK for x64 bit. It started working for me this time.
This will be helpful for others who are facing the same issue.
Thanks,
Srikanth Potla.
@Cristian: Sorry it took me longer to get back to you! I was enjoying the Holidays. Looks like you aren't the only one having this problem on 8.1. It's an open issue on the C# extension. It also looks like @srikanth potla: had the same problem. Maybe try his solution.
@srikanth potla: I'm glad it worked out!
@Stan Denman: Sorry for the late response! Try running terminal in Administrator mode if you are still having this problem. If that doesn't work it looks like there is an open issue related to this, though you'd have to verify if the problem is similar.
@aquakool2003: Thank you so much for the feedback! :) It is so hard to keep these up-to-date. I'll keep your comments in mind for the next videos. Especially about the F5 confusion. The C# extension downloads the intellisense and opening the actual .cs file loads the OmniSharp debugging capability. You can totally install VSCode and VS side-by-side. I highly recommend it!
@Neal Noble: Yep! Life its quite different. :D
@Vytautas: That's strange. If the pop up does not appear I suggest initializing a new project and opening the .cs file. It should appear then. You can copy your code into the new project if that works. Let me know if that works.
Link : picture
public static void Main(string[] args) { Console.WriteLine("ُEnter Youre Name : "); String name = Console.ReadLine(); Console.Write("Hello Mr : " + name); Console.ReadKey(); }
I've a problem.
Microsoft Windows [Versión 10.0.14393]
(c) 2016 Microsoft Corporation. Todos los derechos reservados.
C:\Users\Samano Cedillo\Documents\Visual Studio 2015\Projects\Hello>dotnet new
"dotnet" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
Please help me,
Thank you.
Looking for tutorial on creating a Web service using vs code and c#. Great info here, thanks!
Wow y are very lovable! very nice tutorial tks;
Visual Studio Code S2
@kendrahavens everytime when i have to create a new program should i follow same procedure and can i have more than one programs in same folder?
Thank you in advance.
Good as using Chrome instead of IE/Edge
Best getting started video ever! I really like Kendra's introduction <3
Just registered a channel9 account for this comment :)
hi miss Kendra. Nice tutorial.
may i ask.
when i using System.Windows.Forms, it is not found. And give me error "are you missing assembly?"
i search in internet that i must add dependency on project.json but i don't know the proper way to do that.
hope you reply this. thanks. Sorry for bad english
At 2:40 you mention "back tick" or "command prompt",
1) what is a tick do you mean '\'?
2) have clicked in the area that you mouse was at when the display changed and cant get it to happen, and cant see option on any of the menu bar items.
3) have looked through the Show All Commands, cant see the option there
Best
Ying-Hui
I really like this girl!
Great job!
I downloaded .net core binaries
I opened VSCode, made new project directory, opened the terminal. I typed "dotnet new mvc" in order to create an ASP.NET5 web app. I was greeted with this terminal error:
PS C:\dotnetcore\Projects\Drizzle> dotnet new mvc
dotnet : The term 'dotnet' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
Any help?
Where's the like button, DAMN!
hi after installing .net core i continued your steps towards terminal and executed command "dotnet new"
but shows error that "'dotnet' is not recognized as an internal or external command,
operable program or batch file."
I attempted to follow the directions in the video and quite frankly I am getting more and more upset. I have been attempting this for over an hour now and nothing is properly running according to your video instructions.
This is what I see after typing in dotnet new:
Template Instantiation Commands for .NET Core CLI.
Usage: dotnet new [arguments] [options]
Arguments:
template The template to instantiate.
Options:
-l|--list List templates containing the specified name.
-lang|--language Specifies the language of the template to create
-n|--name The name for the output being created. If no name is specified, the name of the current directory is used.
-o|--output Location to place the generated output.
-h|--help Displays help for this command.
-all|--show-all Shows all templates
Templates Short Name Language Tags
----------------------------------------------------------------------
Console Application console [C#], F# Common/Console
Class library classlib [C#], F# Common/Library
Unit Test Project mstest [C#], F# Test/MSTest
xUnit Test Project xunit [C#], F# Test/xUnit
ASP.NET Core Empty web [C#] Web/Empty
ASP.NET Core Web App mvc [C#], F# Web/MVC
ASP.NET Core Web API webapi [C#] Web/WebAPI
Solution File sln Solution
Examples:
dotnet new mvc --auth None --framework netcoreapp1.1
dotnet new mstest --framework netcoreapp1.1
dotnet new --help
Also I cannot get cmd.exe instead I get powershell.exe when I press ctrl+`
Update for today's versions:
- Download the SDK from the [Commnad Line / Other] tab.
- After installing .Net Core SDK please restart Visual Studio Code (if not you will get the dotnet command not found error).
- Use [dotnet new console] instead of just [dotnet new] as now the command line tool requires you to specify the template to use. In this video, we are using a console example.
- You can then use the prompts (top bar) to update the dependencies or execute them in the terminal just like in the video [dotnet restore].
- Run it with [dotnet run].
- Remember to click YES in the prompt related to "Required assets to build and debug..", that way you will not have any issues debugging the application.
Hope this helps! :)
it not creating package.json file in my case .
can you tell me reason for this ?
This seems all busted in the latest versions. Installed all of it today and just keep getting error messages trying to debug. The part up to hello world works, but I kinda like debugging when I code.
@KeplerIO: Sorry, I'm a bit late to the party. I had the same problem within VScode. Be sure that the dotnet folder (C:\Program Files\dotnet) is in your PATH environment variable and restart Windows. That fixed my problem.
I also tried just restarting VScode but that alone doesn't fix the problem. Don't know why.
I had an error MSB:1003 while restoring. Please guide.
AMAZING ! Just clear and perfect! I've been looking on internet for hours and just found your video! And it's all fixed now! THANKS
How to make a windows form project !?
and you are so cute , I will like to learning from here,hahaha.
Im also getting the annoying "Only 64-bit processes can be debugged." error in VSCode when debugging.
I am using:
OS: Win7 x64
IDE: VSCode x64 (latest)
Framework: net452
But when i compile the same solution with framework netcoreapp1.1 it all works fine.
Is it a issue with the "C# Extension" and OmniSharp or the installation of the net452 SDK or something else?
@fedotenko: You won't be able to debug an app that targets net452 with VSCode and the C# extension out of the box. That scenario is still best accomplished in Visual Studio.
Very nice video, thanks.
Hola. He seguido todos los pasos al pié de la letra, pero me sale el siguiente error al momento de ejecutar el comando dotnet run:
CSC : error CS2001: No se encontró el archivo de origen 'F:\Program.cs'. [F:\Documentos\Tarea\Desarrollo\Desarrollo.csproj]
CSC : error CS2001: No se encontró el archivo de origen 'F:\obj\Debug\netcoreapp2.0\Desarrollo.AssemblyInfo.cs'. [F:\Documentos\Tarea\Desarrollo\Desarrollo.csproj]
Tengo horas tratando de hallar la solución y no la encuentro. Espero que me puedas ayudar : ').
Hi!
I have followed your instructions but "dotnet new" does not create any projects at all.
what is wrong?
@reza:You'll need to choose a template command such as "dotnet new mvc" now. The .NET cli has been updated since posting this. Watch a new install video here.
That was neat !!Thanks
This is all very well but why there is no EXE file to run from the terminal? How can I create exe files in VS code or is the Code for gimmicky programs to play on the screen.
I want to create serious Apps.
This conversation has been locked by the site admins. No new comments can be made.