1

I have a Angular 2 solution that I have been working with that uses webpack and I am able to get it up and running with npm install and npm start. I want to move the code that I have been developing into a .Net 4.5.2 solution that I am working with. I have looked around and haven't seen a solution that works with the .Net 4.5.2 style of projects. Since webpack bundles everything to a distribution type folder, one that is not in the project, how do I point the startup page of the app?

Isaac Levin
  • 2,809
  • 9
  • 49
  • 88

2 Answers2

0

try this guide

http://offering.solutions/blog/articles/2016/08/27/how-to-set-up-angular-2-and-webpack-in-visual-studio-with-asp-net-core/

i used this to setup angular2 with webpack in VS 2015. So far it's working if i run the compiled/transpiled code by webpack when deployed to IIS. But I still need to figure out the javascript error i get when running the app using IIS Express.

0

Are you trying to use NG2 with MVC? Or is your frontend app completely static (only html/js)? If completely static, I had a similar problem and had to try out a few different ways before making it work. It depends on if you need to use IISEXPRESS or if you are ok running outside of VS, like through Node.

If you want IISEXPRESS, then I suggest you follow this post and setup an OWIN layer that will serve up the static files. This basically mimic's how .NET Core does it.

Using a wwwroot folder (ASP.NET 5 style) in ASP.NET 4.5 project

I initially went down that road but ended up turning around as I couldnt get IIS to pickup changes. Like when you save a file, webpack will rebuild but IIS doesnt always pick it up. I dunno, it was flaky when I did it.

So I took a similar approach to the link posted by Leo. I used the webpack-dev-server and in the VS project properties, set the Web to be external so that IISEXPRESS doesnt run. That route worked a lot better for us.

Community
  • 1
  • 1
John Lee
  • 1,357
  • 1
  • 13
  • 26