Aspnetcore-angular-universal: Update To Asp.Net Core 2.0

Created on 15 Aug 2017  路  7Comments  路  Source: TrilonIO/aspnetcore-angular-universal

Asp.Net Core 2.0 had been Announced!

Most helpful comment

I have a fork of this running on 2.0, I will try to do a PR of that and Angular 4.3.4 in a few days.

All 7 comments

I have a fork of this running on 2.0, I will try to do a PR of that and Angular 4.3.4 in a few days.

For those that upgraded to the new VS 2017 (15.3) and .NET Core 2.0 a few tips...
If your project is failing to load with an error: 'Microsoft.NET.Sdk.Web' specified could not be found. This is probably related to the Global.json file within the project. Within it you'll find a reference to sdk version: 1.0.0 - this is the cause. I modified mine to 2.0.0 and the load problem was resolved. Note I also updated my csproj file based on the information posted here: https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/

One more note, on attempting to run you may get a compile error within HomeController.cs. It appears the signature for the Prerenderer.RenderToString method has changed. It has a new 3rd parameter which is a cancel token. To create a cancel token I added the following two lines prior to this call following the creation of the transferData structure.

  System.Threading.CancellationTokenSource cancelSource = new System.Threading.CancellationTokenSource();
  System.Threading.CancellationToken cancelToken = cancelSource.Token;

Then I'm modified the parameter list to include the new cancel token in the Render to string call:
var prerenderResult = await Prerenderer.RenderToString(
"/",
nodeServices,
cancelToken,
new JavaScriptModuleExport(applicationBasePath + "/Client/dist/main-server"),
...

This seems to make the project operational.

@OceansideBill Year,it work!

And I think this project can upgrade to Angular 5.x and there are some warnings while building the client app:

Warning: Can't resolve all parameters for SignalR in C:/Users/Administrator/Source/Repos/aspnetcore-angular2-universal/node_modules/ng2-signalr/src/services/signalr.d.ts: ([object Object], [object Object], ?). This will become an error in Angular v5.x
Warning: Can't resolve all parameters for SignalR in C:/Users/Administrator/Source/Repos/aspnetcore-angular2-universal/node_modules/ng2-signalr/src/services/signalr.d.ts: ([object Object], [object Object], ?). This will become an error in Angular v5.x
Template parse warnings:
The <template> element is deprecated. Use <ng-template> instead ("
[WARNING ->]<template [ngIf]="!isClosed">
  <div [class]="'alert alert-' + type" role="alert" [ngClass]="classes""): ng:///C:/Users/Administrator/Source/Repos/aspnetcore-angular2-universal/node_modules/ngx-bootstrap/alert/alert.component.d.ts.AlertComponent.html@1:0

there is a pr #371 for this

Done! 馃憤 馃嵑 Thanks again @isaac2004

@MarkPieszak no worries, did you want a PR for JWT like we talked about?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MarkPieszak picture MarkPieszak  路  30Comments

MarkPieszak picture MarkPieszak  路  41Comments

consigliory picture consigliory  路  29Comments

ketrex2 picture ketrex2  路  18Comments

consigliory picture consigliory  路  18Comments