Creating project with Aurelia with Asp.Net Core / Typescript


#1

hello guys,

I am having issues with configuring Aurelia with Asp.net core.

As per document / guide

  • I created a Asp.net core application
  • I created aurelia app using aurelia-cli in the same project.
    now when I run the application I get the asp.net mvc home page instead of aurelia app.
    What are the additional steps I need to take?

I tried the skeleton-typescript-aspnetcore – Does not work (it is based on .net 1.0 and gives lot of errors)
The JavascriptServices asp.net core which my app is based on – does not work as its based on .net 1.0 and there are lot of issues in that one.
I tried many other trial and error stuff and its goes and hit one road-block or other. What is more really sad is its just to setup a new project.

I am using Visual Studio Code / windows 10 / Asp.net core 2.0 /2.1 /Typescript

Please provide or point in direction where I can find the proper info.

Thanks


#2

I think you only need to point your html page to the right script files (the one that is built and should normally be in the dist folder)


#3

Check out the following template


#4

Sorry your answer is vague and possibly incorrect.


#6

Npm install should resolve this


#7

Yeah I deleted node folder and did again npm install and important thing is, if you run project from visual studio its give some errors and same project you run from the command prompt with dotnet build/dotnet run works.
But thanks your project helped.


#8

hi Max,
In my app (build using above your template) when I include an image in app.html like below-
<img class="headerimg" src="../image/WisdomLogo__.jpg" />
I get error — Module parse failed: Unexpected character ’ ’ (1:0). You may need an appropriate loader to handle this file type.
So what I am missing ??


#9

Looks like you’ve figured this out in the gitter channel :slight_smile:


#10

Not yet. Can you check


#11

I’ve got a very limited internet access right now - only on my mobile. You can have a look at the materialise bridge demo app source - webpack is configured there to ignore images.


#12

In our case since we end up serving different Aurelia apps based on main routes handled by our asp.net application we ended up creating a basic .net core app with several aurelia app at the same level. We are using lerna to manage our monorepo. We created a simple script that compiles all of our aurelia apps and copies their output in the asp.net wwwroot folders. This folder is used to serve static files in .net core by design. Then in our asp.net view we reference the javascript files as follow.

@section Scripts {
<script type=“text/javascript” asp-src-include="~/js/common..bundle.js" asp-append-version=“true”></script>
<script type=“text/javascript” asp-src-include="~/js/app.
.bundle.js" asp-append-version=“true”></script>
<script type=“text/javascript” asp-src-include="~/js/vendor.*.bundle.js" asp-append-version=“true”></script>
}

You should also have your aurelia-app=“main” somewhere in your asp.net view.

We don’t use visual studio at all in our case, only vscode. Our .net core app was created using dotnet new mvc and our Aurelia app we built using the cli (webpack / typescript)