Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions App_Start/BundleConfig.cs

This file was deleted.

23 changes: 0 additions & 23 deletions App_Start/RouteConfig.cs

This file was deleted.

8 changes: 2 additions & 6 deletions Controllers/LandingController.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Microsoft.AspNetCore.Mvc;

namespace asp_net_angularjs.Controllers
{
public class LandingController : Controller
{
public ActionResult Index()
public IActionResult Index()
{
return View();
}
Expand Down
1 change: 0 additions & 1 deletion Global.asax

This file was deleted.

16 changes: 0 additions & 16 deletions Global.asax.cs

This file was deleted.

47 changes: 47 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using Microsoft.Extensions.FileProviders;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllersWithViews();

var app = builder.Build();

if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}

app.UseHttpsRedirection();

app.UseStaticFiles();

app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(builder.Environment.ContentRootPath, "node_modules")),
RequestPath = "/node_modules"
});

app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(builder.Environment.ContentRootPath, "Content")),
RequestPath = "/Content"
});

app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(builder.Environment.ContentRootPath, "WebApp")),
RequestPath = "/WebApp"
});

app.UseRouting();

app.MapControllerRoute(
name: "Landing",
pattern: "",
defaults: new { controller = "Landing", action = "Index" });

app.Run();
32 changes: 0 additions & 32 deletions Properties/AssemblyInfo.cs

This file was deleted.

13 changes: 13 additions & 0 deletions Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:51267",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
33 changes: 20 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# AngularJS with .NET Framework
A demo project using AngularJS, .NET Framework 4.8, and ASP.NET MVC 5.
# AngularJS with .NET 7

A demo project using AngularJS with .NET 7 and ASP.NET Core MVC.

## Features

- XLTS for AngularJS - installed using npm
- jQuery 3.6.3 - installed using npm
- .NET Framework 4.8
- ASP.NET MVC 5
- Bundling using [Microsoft.AspNet.Web.Optimization](https://docs.microsoft.com/en-us/aspnet/mvc/overview/performance/bundling-and-minification)
- .NET 7
- ASP.NET Core MVC
- Cross-platform (runs on Windows, macOS, and Linux)

## Prerequisites

- Windows 10/11 - Older versions of Windows may work but have not been tested.
- [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) - The free *Community Edition* is sufficient.
Older versions of Visual Studio may work but have not been tested.
- [.Net Framework 4.8](https://dotnet.microsoft.com/en-us/download/dotnet-framework) - This can optionally be installed
as part of the Visual Studio 2022 installation as well.
- [.NET 7 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/7.0)
- Node.js >= 18
- npm >= 9

## Getting Started

- Make sure you have configured your authentication with the XLTS.dev registry by supplying your token in the `.npmrc` file in your user home directory.

> **Note**
Expand All @@ -26,9 +26,16 @@ as part of the Visual Studio 2022 installation as well.
- Clone repository: `git clone https://github.com/xlts-dev/angularjs-asp-net48-mvc5.git`.
- Switch to the project's directory: `cd angularjs-asp-net48-mvc5`.
- Install npm packages: `npm install`.
- Open the project in Visual Studio.
- Run the project by pressing the `F5` key or using the green start button in the toolbar. This will launch your web
browser and display the web application.
- Run the project: `dotnet run`.
- Open your browser and navigate to `http://localhost:51267`.

## AngularJS LTS packages

If you want to use the LTS packages, you have to run `npm run switch-to-lts-packages` script instead of `npm install`.

## Running Tests

Run the Playwright end-to-end tests:
```bash
npm run e2e
```
17 changes: 12 additions & 5 deletions Views/Landing/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

@using System.Web.Optimization
@{
Layout = null;
}
Expand All @@ -11,15 +10,23 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width" />
<title>XLTS for AngularJS with .NET Framework</title>
<title>XLTS for AngularJS with .NET 7</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
@Styles.Render("~/bundles/styles")
@Scripts.Render("~/bundles/scripts")

<link rel="stylesheet" href="~/Content/site.css" />
<link rel="stylesheet" href="~/WebApp/Directives/test.directive.css" />
<link rel="stylesheet" href="~/WebApp/Components/test.component.css" />

<script src="~/node_modules/jquery/dist/jquery.min.js"></script>
<script src="~/node_modules/angular/angular.min.js"></script>
<script src="~/WebApp/app.js"></script>
<script src="~/WebApp/Components/test.component.js"></script>
<script src="~/WebApp/Directives/test.directive.js"></script>
</head>
<body ng-app="app">
<h1 data-testid="title">XLTS for AngularJS with .NET Framework</h1>
<h1 data-testid="title">XLTS for AngularJS with .NET 7</h1>
<test-directive></test-directive>
<test-component></test-component>
</body>
Expand Down
2 changes: 2 additions & 0 deletions Views/_ViewImports.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@using asp_net_angularjs
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
42 changes: 0 additions & 42 deletions Views/web.config

This file was deleted.

8 changes: 0 additions & 8 deletions Web.Debug.config

This file was deleted.

9 changes: 0 additions & 9 deletions Web.Release.config

This file was deleted.

47 changes: 0 additions & 47 deletions Web.config

This file was deleted.

Loading