0

I have created project using Asp.net core 2/Angular 4 template that ships whith .Net core 2 Sdk.

Using dotnet build or dotnet run it's not generating new dist folder for client side angular project.

I am using visual studio code as editor.

Can i miss any command beacuse of that new build is not generating?

Following is package.json

{
  "name": "mcxpricecore",
  "private": true,
  "version": "0.0.0",
  "scripts": {
    "test": "karma start ClientApp/test/karma.conf.js"
  },
  "dependencies": {
    "@angular/animations": "4.2.5",
    "@angular/common": "4.2.5",
    "@angular/compiler": "4.2.5",
    "@angular/compiler-cli": "4.2.5",
    "@angular/core": "4.2.5",
    "@angular/forms": "4.2.5",
    "@angular/http": "4.2.5",
    "@angular/platform-browser": "4.2.5",
    "@angular/platform-browser-dynamic": "4.2.5",
    "@angular/platform-server": "4.2.5",
    "@angular/router": "4.2.5",
    "@ngtools/webpack": "1.5.0",
    "@types/webpack-env": "1.13.0",
    "angular2-template-loader": "0.6.2",
    "aspnet-prerendering": "^3.0.1",
    "aspnet-webpack": "^2.0.1",
    "awesome-typescript-loader": "3.2.1",
    "bootstrap": "3.3.7",
    "css": "2.2.1",
    "css-loader": "0.28.4",
    "es6-shim": "0.35.3",
    "event-source-polyfill": "0.0.9",
    "expose-loader": "0.7.3",
    "extract-text-webpack-plugin": "2.1.2",
    "file-loader": "0.11.2",
    "html-loader": "0.4.5",
    "isomorphic-fetch": "2.2.1",
    "jquery": "3.2.1",
    "json-loader": "0.5.4",
    "preboot": "4.5.2",
    "raw-loader": "0.5.1",
    "reflect-metadata": "0.1.10",
    "rxjs": "5.4.2",
    "style-loader": "0.18.2",
    "to-string-loader": "1.1.5",
    "typescript": "2.4.1",
    "url-loader": "0.5.9",
    "webpack": "2.5.1",
    "webpack-hot-middleware": "2.18.2",
    "webpack-merge": "4.1.0",
    "zone.js": "0.8.12"
  },
  "devDependencies": {
    "@types/chai": "4.0.1",
    "@types/jasmine": "2.5.53",
    "chai": "4.0.2",
    "jasmine-core": "2.6.4",
    "karma": "1.7.0",
    "karma-chai": "0.1.0",
    "karma-chrome-launcher": "2.2.0",
    "karma-cli": "1.0.1",
    "karma-jasmine": "1.1.0",
    "karma-webpack": "2.0.3"
  }
}
9
  • Use the command npm run build:dev or npm run dev-build Commented Sep 2, 2017 at 16:20
  • error - misssing script : npm run build:dev Commented Sep 2, 2017 at 16:23
  • error - misssing script : npm run dev-build Commented Sep 2, 2017 at 16:23
  • Show your package.json Commented Sep 2, 2017 at 16:25
  • please find package.json in question edit Commented Sep 2, 2017 at 16:27

3 Answers 3

1

After you have created the project using dotnet new angular you need to run npm install . After that, everything else should work.

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

3 Comments

I know that but after changing clientside application new bundle is not generated with dotnet build or dotnet run
Are you looking under wwwroot? It should be created when you do a dotnet run.
So what did you change in the client app? Perhaps if you look in the output when you run the app you'll see a typescript compilation error.
0

It could be that you need to set ASPNETCORE_ENVIRONMENT variable to development.

So in the command line run this:

set ASPNETCORE_ENVIRONMENT=Development

then when you do dotnet run it will pick up your changes.

Instructions on using multiple environments here: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments

Comments

0

follow these two steps.

1) Setting the environment to development

Command line

set ASPNETCORE_ENVIRONMENT=Development

PowerShell

$Env:ASPNETCORE_ENVIRONMENT = "Development"

2)

dotnet run

above command will start core project and also start Hot Module Replacement which is can update changed client angular modules without a full page reload. To start Hot Module Replacement in development fix your code block in Startup.cs as bellow

if (env.IsDevelopment())
{
    app.UseDeveloperExceptionPage();
    app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
        {
            HotModuleReplacement = true,
            HotModuleReplacementEndpoint = "/dist/__webpack_hmr"
        });
} else {
    app.UseExceptionHandler("/Home/Error");
}

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.