Javascriptservices: Newly generated app through yo aspnetcore-spa does not update angular changes

Created on 17 Mar 2017  路  2Comments  路  Source: aspnet/JavaScriptServices

Hi team,

First of all, thanks for all the hard work, this seems to be a great starter project to build on. I am an intermediate developer of .net core and learning angular 2. But unfortunately I ran into trouble right away. I ran the project using:

dotnet watch run

But that gives me the error:

No executable found matching command "dotnet-watch"

Hence I ran using:

dotnet run

Which successfully ran the application on port localhost:5000. At this point I tried changing things in app/ folder navmenu.component.html by changing:

WebApplicationBasic

to:

Web Application Basic

This did tiger the rebuild as dotnet detected a change but the browser did not show the changes. I tried testing in another browser in case cache was in play but same results. I restarted the server, did

dotnet build

but of no help. How does live reload work for angular in this project? The versions of my tools are as under.

npm : 3.10.8
node : v6.9.1
dotnet: 1.0.1
yo: 1.8.5

Most helpful comment

It sounds like you're running in production mode. When you ran dotnet run, did it say Hosting environment: Development or Hosting environment: Production?

If you want updates without running webpack manually, you need to be in development mode. Since you're running from a command line, please see the instructions under Running via the Command Line on this page: https://blogs.msdn.microsoft.com/webdev/2017/02/14/building-single-page-applications-on-asp-net-core-with-javascriptservices/

All 2 comments

It sounds like you're running in production mode. When you ran dotnet run, did it say Hosting environment: Development or Hosting environment: Production?

If you want updates without running webpack manually, you need to be in development mode. Since you're running from a command line, please see the instructions under Running via the Command Line on this page: https://blogs.msdn.microsoft.com/webdev/2017/02/14/building-single-page-applications-on-asp-net-core-with-javascriptservices/

Thanks Steve, your answer pointed me in the right direction. I was following the tutorial at
https://www.youtube.com/watch?v=L9x7TOR2i7g
It asks to set the enviourment to Development at 7:11 in the video using command:

set ASPNETCORE_ENVIRONMENT=Development

But that was not working and when server ran it was still in production mode. Then I looked at the link you provided and ran:

setx ASPNETCORE_ENVIRONMENT "Development"

Which showed a success message about value being save but then when i ran the project it was still in Production mode. So finally I added an environment variable in This PC properties. I added a property

ASPNETCORE_ENVIRONMENT

and its value to

Development

Now when I ran the server it started picking up the front end changes too.

Thanks for guiding me, much appreciated.

Regards,
Hassan

Was this page helpful?
0 / 5 - 0 ratings

Related issues

justinyoo picture justinyoo  路  3Comments

tmedanovic picture tmedanovic  路  4Comments

docrinehart picture docrinehart  路  4Comments

ZeekoZhu picture ZeekoZhu  路  3Comments

Sampath-Lokuge picture Sampath-Lokuge  路  4Comments