10

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.

2
  • 3
    I have the same problem with .NET Core 2.1.1 and Angular 6. Sometimes it works sometimes it won't. Commented Jul 5, 2018 at 16:50
  • The youtube video link is broken. Can anyone point to active link? Commented Jul 19, 2019 at 5:34

6 Answers 6

12

I was facing same issue. Below steps worked for me:

  • Delete all files from dist folder
  • run "ng build"
  • When the application runs, if you still don't see the changes, Empty cache and hard reload the chrome browser (hold browser refresh button for long, and select "Empty cache and hard reload")

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

I removed everything from 'dist folder' and it worked at my end! It fixed both problems: page started refreshing and I could see the changes.
4

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.

1 Comment

This did not work for me, and I'm having the same issue after updating an Angular 4 project to Angular 5. I didn't have this problem until after the upgrade.
1

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.

Comments

1

In my case it failed to update because it was still running under IIS Express. I solved it by changing the profile from "IIS Express" to [project name] (both in the VS task bar and in the project properties under "Debug").

Comments

0

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.

Comments

0

I have passed trought the same problem.

You have two options:

  1. Delete the "dist" folder(this folder will be recreated everytime you use 'ng-build')
  2. Make the implementation equals the link below. This implementation makes the application ignore the dist folder. It will only be used at production environment.

Implementation

1 Comment

Please don't post code as images. It's hard to read, you cannot copy&paste it, and search engines don't index it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.