-
Notifications
You must be signed in to change notification settings - Fork 12k
asp.net core with angular CLI #3578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
(notifying our developer relationship team) @robwormald @StephenFluin @juleskremer Would this be useful somewhere as a reference? @Brocco we could have a section on our WIKI for this too. Closing this as it's not an issue. |
I added this as a nice-to-have on the documentation tracking issue #2711 |
thanks for the quick response |
@wickdninja this is great, cheers. We're all traveling at the moment, but I'll forward this over to the people working on templates and such for Asp and VS with angular 👍 |
@wickdninja Would you mind writing up a brief tutorial about how to get Angular 2 running on an ASP.Net Core web server using the Angular CLI? I'd love to learn how to do this from scratch and I can't seem to get Angular to load (after generating a new project in |
FYI: we do have some work started on a tutorial which you can see here: angular/angular.io#2850 We are also working on VS templates for ASP.NET but will not look at CLI integration until later in the year. |
@Brocco reached out to me via twitter last week, but unfortunately I have not had the free time to start on the tutorial yet. It's on my schedule for this weekend though. Would it be more useful to document the workflow I followed to create an Angular2 (via CLI)/ .Net Core project, or should I attempt to contribute to angular/angular.io#2850 ? |
@wickdninja Exactly - Just the steps to get an Angular 2 app running and hosted on ASP.NET Core. @juleskremer That tutorial looks like it uses razor so it technically wouldn't be an SPA, right? I'd prefer just to have the NG2 app statically hosted on an ASP.NET Core server. |
I started my project this way and then separated the server and the client parts into two different projects. Much more manageable this way and VisualSutido 2015 sucks on editing .ts files. |
Here's my first crack at it. Copied below as well. ASP.NET Core / Angular 2 via CLI Quick StartDisclaimerThis guide was created using the following versions, and provides no guarentee for compatibility with any other versions.
Install Project Dependencies
Generate Project
Server Setup
Client Setup
Build Scripts
Run App
|
@wickdninja Great Work!. Is there a way to use Visual Studio 2015? |
@sebastiaoherodes I've used Visual Studio 2015 with a previous project using a similar setup. However, I still used VSCode for client side (angular) development, and only used Visual Studio for .Net code. If I can find some free time this weekend I'll extend the tutorial to include a similar setup. Off the top of my head I think the only differences would be to install the NPM Task Runner extension, disable Typescript compilation in Visual Studio 2015, and then inside the Such as "scripts": {
"prebuild": "ng build"
} Do you think this would be a useful addition? |
I wrote up a blog post on using Angular CLI inside of a Visual Studio MVC Web application with a different approach. All the relevant commands are included, plus a git repo with the final result and commits for each step along the way that you can review. http://candordeveloper.com/2017/04/12/how-to-use-angular-cli-with-visual-studio-2017/ Essentially, you have 2 separate projects, a CLI project and an MVC web app (or core app), and a pre-build for the MVC web app does an ng build on the CLI project and copies the few output files to a folder of the MVC app which is then set as a Controller view. See the article for the details. |
@michael-lang thanks, I'm on vacation but will review when I return. |
@michael-lang also wrote up an article for creating an ASP.NET Core app with the Angular-CLI in a single project. |
I tested following: http://www.sparkhound.com/learn/blog/setting-up-an-asp-net-core-project-with-angular-2-utilizing-angular-cli by Vance F., this is the best solution for me, |
Are there any examples where this has been done together with server side rendering? All of the examples I have found so far uses webpack but I was hoping I could just use the Angular CLI like I do currently. |
@challe I just put together a repo like what you were asking |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Hello,
Sorry this is not really an issue, but I didn't know where else I could reach out to get some insight on a project I have. I recently was tasked with creating a new asp.net core application, and I wanted to used Angular2 (via the angular cli), but I wasn't able to find any good documentation on how to get the two technologies working together. There is a yoeman generator to scaffold a .Net Core app with angular 2, but it doesn't make use of the CLI and uses a static index.cshtml as the root of the application so the links to the script files must also then be static.
I'm a really big fan of the angular-cli so I set out to create a solution that would allow me to take advantage of it. Here is what I've come up with Angular2AspNetCoreStarter but I didn't know where to go to get feedback, and I wanted to share this in case it can solve someone else's need for the cli in their .net core application.
Again I apologize for opening an issue for this, and if there is a more appropriate channel for these types of things I'd be happy to close the issue and move it there.
Thanks again for such a great tool!
The text was updated successfully, but these errors were encountered: