Asp.net核心2/4角模板在不工作
我一直在使用Asp.net核心2/4角模板创建项目,船舶蒙山 的.Net核心2 SDK。Asp.net核心2/4角模板在不工作
使用dotnet build
或dotnet run
它不会为客户端角度项目生成新的dist文件夹。
我使用Visual Studio代码为编辑器。
我可以错过新构建的任何命令怎么一回事,因为没有产生?
以下的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"
}
}
您已经创建使用dotnet new angular
你需要运行npm install
项目后。之后,其他一切都应该起作用。
我知道,但是在更改客户端应用程序之后,不会使用dotnet build或dotnet运行生成新的分发包 – Nirav
您是否在寻找在wwwroot下?它应该在您执行dotnet运行时创建。 – GlennSills
不,它没有发生,但webpack为此工作 – Nirav
这可能是因为你需要ASPNETCORE_ENVIRONMENT变量设置为开发。当你这样做的dotnet来看,这将拿起您的更改
set ASPNETCORE_ENVIRONMENT=Development
则:
所以在命令行中运行此。
说明,这里使用多种环境: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments
遵循以下两个步骤。
1)环境设置为发展
命令行
集ASPNETCORE_ENVIRONMENT =发展
PowerShell的
$ ENV:ASPNETCORE_ENVIRONMENT = “发展”
2)
DOTNET运行
上述命令将启动核心项目,并且还启动热模块更换它是可以更新客户端改变角模块,而不重新加载整个页面。要启动热模块的更换在发展中解决您的Startup.cs代码块为波纹管
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
{
HotModuleReplacement = true,
HotModuleReplacementEndpoint = "/dist/__webpack_hmr"
});
} else {
app.UseExceptionHandler("/Home/Error");
}
命令'NPM运行编译:dev'或'NPM运行DEV-build' – Faisal
错误 - misssing脚本:NPM运行构建:dev – Nirav
错误 - misssing脚本:npm运行dev-build – Nirav