Using Aurelia CLI with Visual Studio (again)

I will try what you have recommended, but I see that you are running via dotnet run when I am using a Visual Studio workflow.

I what have tried is this:

  1. In the webpack.config I created the following entry in the plugins section:
new HtmlWebpackPlugin({
      template: '_Layout_App.cshtml.ejs',
      filename: '../../Views/Shared/_Layout_App.cshtml',
      metadata: {
        // available in index.ejs //
        title, server, baseUrl
      }
    }),
  1. Created the referenced _Layout_App.cshtml.ejs template based on the default layout file and adding a @RenderSection("css", required: false) to the head for the css to be placed correctly.
  2. Created a AppController and view (that uses the layout above) to have control over how the Aurelia app is displayed and to whom (via the [Authorize] attribute).

Now building and running via Visual Studio works without error.

Without going over old ground, would like to restate these thoughts.

Another approach, rather than having static versioned templates, could use ‘diffs’ on individual files rather than conditionally generating template files in the CLI internally. Having customised the CLI when looking into these issues last year, I could see the maintainability challenges clearly.

It would be great to be able to do this:

  1. Create a new Visual Studio MVC project with the latest templates.
  2. au new --here and choose the options
  3. Hit CTRL-F5 and watch it run, or manually create a controller and paste in some code to the view that points at the compiled aurelia app.

This experience all effects perception as stated here.

I still think Aurelia is great, it is just such a time waste when I literally have to research to get up and running every time.

1 Like