I have created a new project following this tutorial https://www.youtube.com/watch?v=ytDTkFJOJIE using aspnet core spa templates (angular to be specific).
So when I run "dotnet run" the first time it works fine, it runs the site as to be expected.
Now, when I commit a change, like delete the navbar and the references to it, the "main-server.js" and "main-client.js" don't update, nor does the site in the browser.
What am I doing wrong? If any more info is needed, let me know.
It appears to be I had to set the environment variable. Although it might be set on launchSettings.json, you have to run this command
$Env:ASPNETCORE_ENVIRONMENT = "Development"
for it to work properly. Took me since yesterday to find this, hope it helps someone else.
For me the problem was Visual studio had checked in the .js and .js.map files for a few of my .ts components.
Visual Studio also checks in the main-client.js, vendor.js, and vendor.css files by default. Makes sure to either remove these from source control (recommended) or check them out before running.
I too faced this problem while i executed my angular 7 with.net core app in IIS express in VS2017,
- solved this by building the angular app(clientapp) in cmd by "ng build".
- Then, close and reopen the application. so that VS loads the project again.
- Now run the app using IIS express.
- this worked for me. so give a try.
来源:https://stackoverflow.com/questions/45490085/asp-net-core-with-angular-not-updating-changes