This component demonstrates fetching data from the server.
4 |
5 | (baseUrl + 'api/SampleData/WeatherForecasts').subscribe(result => {
13 | this.forecasts = result;
14 | }, error => console.error(error));
15 | }
16 | }
17 |
18 | interface WeatherForecast {
19 | dateFormatted: string;
20 | temperatureC: number;
21 | temperatureF: number;
22 | summary: string;
23 | }
24 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/app/home/home.component.html:
--------------------------------------------------------------------------------
1 | Hello, world!
2 | Welcome to your new single-page application, built with:
3 |
8 | To help you get started, we've also set up:
9 |
10 | Client-side navigation . For example, click Counter then Back to return here.
11 | Angular CLI integration . In development mode, there's no need to run ng serve
. It runs in the background automatically, so your client-side resources are dynamically built on demand and the page refreshes when you modify any file.
12 | Efficient production builds . In production mode, development-time features are disabled, and your dotnet publish
configuration automatically invokes ng build
to produce minified, ahead-of-time compiled JavaScript files.
13 |
14 | The ClientApp
subdirectory is a standard Angular CLI application. If you open a command prompt in that directory, you can run any ng
command (e.g., ng test
), or use npm
to install extra packages into it.
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/app/home/home.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-home',
5 | templateUrl: './home.component.html',
6 | })
7 | export class HomeComponent {
8 | }
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/app/nav-menu/nav-menu.component.css:
--------------------------------------------------------------------------------
1 | a.navbar-brand {
2 | white-space: normal;
3 | text-align: center;
4 | word-break: break-all;
5 | }
6 |
7 | html {
8 | font-size: 14px;
9 | }
10 | @media (min-width: 768px) {
11 | html {
12 | font-size: 16px;
13 | }
14 | }
15 |
16 | .box-shadow {
17 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/app/nav-menu/nav-menu.component.html:
--------------------------------------------------------------------------------
1 |
25 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/app/nav-menu/nav-menu.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-nav-menu',
5 | templateUrl: './nav-menu.component.html',
6 | styleUrls: ['./nav-menu.component.css']
7 | })
8 | export class NavMenuComponent {
9 | isExpanded = false;
10 |
11 | collapse() {
12 | this.isExpanded = false;
13 | }
14 |
15 | toggle() {
16 | this.isExpanded = !this.isExpanded;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aspnet/Templating/345e22e2d042f3fa3566d857ce1446868a41e1dd/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/assets/.gitkeep
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/browserslist:
--------------------------------------------------------------------------------
1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 | # For IE 9-11 support, please uncomment the last line of the file and adjust as needed
5 | > 0.5%
6 | last 2 versions
7 | Firefox ESR
8 | not dead
9 | # IE 9-11
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * In development mode, to ignore zone related error stack frames such as
11 | * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
12 | * import the following file, but please comment it out in production mode
13 | * because it will have performance impact when throw error
14 | */
15 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
16 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Company.WebApplication1
6 |
7 |
8 |
9 |
10 |
11 |
12 | Loading...
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../coverage'),
20 | reports: ['html', 'lcovonly'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false
30 | });
31 | };
32 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | export function getBaseUrl() {
8 | return document.getElementsByTagName('base')[0].href;
9 | }
10 |
11 | const providers = [
12 | { provide: 'BASE_URL', useFactory: getBaseUrl, deps: [] }
13 | ];
14 |
15 | if (environment.production) {
16 | enableProdMode();
17 | }
18 |
19 | platformBrowserDynamic(providers).bootstrapModule(AppModule)
20 | .catch(err => console.log(err));
21 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: any;
11 |
12 | // First, initialize the Angular testing environment.
13 | getTestBed().initTestEnvironment(
14 | BrowserDynamicTestingModule,
15 | platformBrowserDynamicTesting()
16 | );
17 | // Then we find all the tests.
18 | const context = require.context('./', true, /\.spec\.ts$/);
19 | // And load the modules.
20 | context.keys().map(context);
21 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "module": "es2015",
6 | "types": []
7 | },
8 | "exclude": [
9 | "src/test.ts",
10 | "**/*.spec.ts"
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/tsconfig.server.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "module": "commonjs"
5 | },
6 | "angularCompilerOptions": {
7 | "entryModule": "app/app.server.module#AppServerModule"
8 | }
9 | }
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "module": "commonjs",
6 | "types": [
7 | "jasmine",
8 | "node"
9 | ]
10 | },
11 | "files": [
12 | "test.ts",
13 | "polyfills.ts"
14 | ],
15 | "include": [
16 | "**/*.spec.ts",
17 | "**/*.d.ts"
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/src/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/ClientApp/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "moduleResolution": "node",
9 | "emitDecoratorMetadata": true,
10 | "experimentalDecorators": true,
11 | "target": "es5",
12 | "typeRoots": [
13 | "node_modules/@types"
14 | ],
15 | "lib": [
16 | "es2017",
17 | "dom"
18 | ]
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Controllers/SampleDataController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 |
7 | namespace Company.WebApplication1.Controllers
8 | {
9 | [Route("api/[controller]")]
10 | public class SampleDataController : Controller
11 | {
12 | private static string[] Summaries = new[]
13 | {
14 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
15 | };
16 |
17 | [HttpGet("[action]")]
18 | public IEnumerable WeatherForecasts()
19 | {
20 | var rng = new Random();
21 | return Enumerable.Range(1, 5).Select(index => new WeatherForecast
22 | {
23 | DateFormatted = DateTime.Now.AddDays(index).ToString("d"),
24 | TemperatureC = rng.Next(-20, 55),
25 | Summary = Summaries[rng.Next(Summaries.Length)]
26 | });
27 | }
28 |
29 | public class WeatherForecast
30 | {
31 | public string DateFormatted { get; set; }
32 | public int TemperatureC { get; set; }
33 | public string Summary { get; set; }
34 |
35 | public int TemperatureF
36 | {
37 | get
38 | {
39 | return 32 + (int)(TemperatureC / 0.5556);
40 | }
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ErrorModel
3 | @{
4 | ViewData["Title"] = "Error";
5 | }
6 |
7 | Error.
8 | An error occurred while processing your request.
9 |
10 | @if (Model.ShowRequestId)
11 | {
12 |
13 | Request ID: @Model.RequestId
14 |
15 | }
16 |
17 | Development Mode
18 |
19 | Swapping to the Development environment displays detailed information about the error that occurred.
20 |
21 |
22 | The Development environment shouldn't be enabled for deployed applications.
23 | It can result in displaying sensitive information from exceptions to end users.
24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
25 | and restarting the app.
26 |
27 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Pages/Error.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Microsoft.AspNetCore.Mvc.RazorPages;
8 |
9 | namespace Company.WebApplication1.Pages
10 | {
11 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
12 | public class ErrorModel : PageModel
13 | {
14 | public string RequestId { get; set; }
15 |
16 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
17 |
18 | public void OnGet()
19 | {
20 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Pages/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using Company.WebApplication1
2 | @namespace Company.WebApplication1.Pages
3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.Logging;
10 |
11 | namespace Company.WebApplication1
12 | {
13 | public class Program
14 | {
15 | public static void Main(string[] args)
16 | {
17 | CreateWebHostBuilder(args).Build().Run();
18 | }
19 |
20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21 | WebHost.CreateDefaultBuilder(args)
22 | .UseStartup();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:8080",
7 | //#if(NoHttps)
8 | "sslPort": 0
9 | //#else
10 | "sslPort": 44300
11 | //#endif
12 | }
13 | },
14 | "profiles": {
15 | "IIS Express": {
16 | "commandName": "IISExpress",
17 | "launchBrowser": true,
18 | "environmentVariables": {
19 | "ASPNETCORE_ENVIRONMENT": "Development"
20 | }
21 | },
22 | "Company.WebApplication1": {
23 | "commandName": "Project",
24 | "launchBrowser": true,
25 | //#if(NoHttps)
26 | "applicationUrl": "http://localhost:5000",
27 | //#else
28 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
29 | //#endif
30 | "environmentVariables": {
31 | "ASPNETCORE_ENVIRONMENT": "Development"
32 | }
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Microsoft": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Warning"
5 | }
6 | },
7 | "AllowedHosts": "*"
8 | }
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aspnet/Templating/345e22e2d042f3fa3566d857ce1446868a41e1dd/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Angular-CSharp/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/.template.config/dotnetcli.host.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/dotnetcli.host",
3 | "symbolInfo": {
4 | "Framework": {
5 | "longName": "framework"
6 | },
7 | "skipRestore": {
8 | "longName": "no-restore",
9 | "shortName": ""
10 | },
11 | "HttpPort": {
12 | "isHidden": true
13 | },
14 | "HttpsPort": {
15 | "isHidden": true
16 | },
17 | "ExcludeLaunchSettings": {
18 | "longName": "exclude-launch-settings",
19 | "shortName": ""
20 | },
21 | "NoHttps": {
22 | "longName": "no-https",
23 | "shortName": ""
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/.template.config/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aspnet/Templating/345e22e2d042f3fa3566d857ce1446868a41e1dd/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/.template.config/icon.png
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/.template.config/vs-2017.3.host.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/vs-2017.3.host",
3 | "name": {
4 | "text": "React.js",
5 | "package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
6 | "id": "1500"
7 | },
8 | "description": {
9 | "text": "A project template for creating an ASP.NET Core application with React.js",
10 | "package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
11 | "id": "1501"
12 | },
13 | "order": 315,
14 | "icon": "icon.png",
15 | "learnMoreLink": "https://github.com/aspnet/JavaScriptServices",
16 | "uiFilters": [
17 | "oneaspnet"
18 | ],
19 | "supportedAuthentications": [
20 | {
21 | "auth": "None",
22 | "authenticationType": "NoAuth",
23 | "allowUnsecured": true
24 | }
25 | ],
26 | "ports": [
27 | {
28 | "name": "HttpPort",
29 | "useHttps": false
30 | },
31 | {
32 | "name": "HttpsPort",
33 | "useHttps": true
34 | }
35 | ],
36 | "excludeLaunchSettings": false,
37 | "minFullFrameworkVersion": "4.6.1",
38 | "disableHttpsSymbol": "NoHttps"
39 | }
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 |
6 | # testing
7 | /coverage
8 |
9 | # production
10 | /build
11 |
12 | # misc
13 | .DS_Store
14 | .env.local
15 | .env.development.local
16 | .env.test.local
17 | .env.production.local
18 |
19 | npm-debug.log*
20 | yarn-debug.log*
21 | yarn-error.log*
22 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Company.WebApplication1",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "bootstrap": "^4.1.3",
7 | "jquery": "3.3.1",
8 | "react": "^16.0.0",
9 | "react-dom": "^16.0.0",
10 | "react-router-bootstrap": "^0.24.4",
11 | "react-router-dom": "^4.2.2",
12 | "react-scripts": "^1.1.5",
13 | "reactstrap": "^6.3.0",
14 | "rimraf": "^2.6.2"
15 | },
16 | "devDependencies": {
17 | "ajv": "^6.0.0",
18 | "babel-eslint": "^7.2.3",
19 | "cross-env": "^5.2.0",
20 | "eslint": "^4.1.1",
21 | "eslint-config-react-app": "^2.1.0",
22 | "eslint-plugin-flowtype": "^2.50.3",
23 | "eslint-plugin-import": "^2.14.0",
24 | "eslint-plugin-jsx-a11y": "^5.1.1",
25 | "eslint-plugin-react": "^7.11.1"
26 | },
27 | "eslintConfig": {
28 | "extends": "react-app"
29 | },
30 | "scripts": {
31 | "start": "rimraf ./build && react-scripts start",
32 | "build": "react-scripts build",
33 | "test": "cross-env CI=true react-scripts test --env=jsdom",
34 | "eject": "react-scripts eject",
35 | "lint": "eslint ./src/"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aspnet/Templating/345e22e2d042f3fa3566d857ce1446868a41e1dd/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/public/favicon.ico
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "Company.WebApplication1",
3 | "name": "Company.WebApplication1",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": "./index.html",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/scss/custom.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aspnet/Templating/345e22e2d042f3fa3566d857ce1446868a41e1dd/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/scss/custom.scss
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { Route } from 'react-router';
3 | import { Layout } from './components/Layout';
4 | import { Home } from './components/Home';
5 | import { FetchData } from './components/FetchData';
6 | import { Counter } from './components/Counter';
7 |
8 | export default class App extends Component {
9 | static displayName = App.name;
10 |
11 | render () {
12 | return (
13 |
14 |
15 |
16 |
17 |
18 | );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { MemoryRouter } from 'react-router-dom';
4 | import App from './App';
5 |
6 | it('renders without crashing', () => {
7 | const div = document.createElement('div');
8 | ReactDOM.render(
9 |
10 |
11 | , div);
12 | });
13 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/Counter.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | export class Counter extends Component {
4 | static displayName = Counter.name;
5 |
6 | constructor (props) {
7 | super(props);
8 | this.state = { currentCount: 0 };
9 | this.incrementCounter = this.incrementCounter.bind(this);
10 | }
11 |
12 | incrementCounter () {
13 | this.setState({
14 | currentCount: this.state.currentCount + 1
15 | });
16 | }
17 |
18 | render () {
19 | return (
20 |
21 |
Counter
22 |
23 |
This is a simple example of a React component.
24 |
25 |
Current count: {this.state.currentCount}
26 |
27 |
Increment
28 |
29 | );
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/FetchData.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | export class FetchData extends Component {
4 | static displayName = FetchData.name;
5 |
6 | constructor (props) {
7 | super(props);
8 | this.state = { forecasts: [], loading: true };
9 |
10 | fetch('api/SampleData/WeatherForecasts')
11 | .then(response => response.json())
12 | .then(data => {
13 | this.setState({ forecasts: data, loading: false });
14 | });
15 | }
16 |
17 | static renderForecastsTable (forecasts) {
18 | return (
19 |
20 |
21 |
22 | Date
23 | Temp. (C)
24 | Temp. (F)
25 | Summary
26 |
27 |
28 |
29 | {forecasts.map(forecast =>
30 |
31 | {forecast.dateFormatted}
32 | {forecast.temperatureC}
33 | {forecast.temperatureF}
34 | {forecast.summary}
35 |
36 | )}
37 |
38 |
39 | );
40 | }
41 |
42 | render () {
43 | let contents = this.state.loading
44 | ? Loading...
45 | : FetchData.renderForecastsTable(this.state.forecasts);
46 |
47 | return (
48 |
49 |
Weather forecast
50 |
This component demonstrates fetching data from the server.
51 | {contents}
52 |
53 | );
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/Layout.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { Container } from 'reactstrap';
3 | import { NavMenu } from './NavMenu';
4 |
5 | export class Layout extends Component {
6 | static displayName = Layout.name;
7 |
8 | render () {
9 | return (
10 |
11 |
12 |
13 | {this.props.children}
14 |
15 |
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/components/NavMenu.css:
--------------------------------------------------------------------------------
1 | a.navbar-brand {
2 | white-space: normal;
3 | text-align: center;
4 | word-break: break-all;
5 | }
6 |
7 | html {
8 | font-size: 14px;
9 | }
10 | @media (min-width: 768px) {
11 | html {
12 | font-size: 16px;
13 | }
14 | }
15 |
16 | .box-shadow {
17 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/ClientApp/src/index.js:
--------------------------------------------------------------------------------
1 | import 'bootstrap/dist/css/bootstrap.css';
2 | import React from 'react';
3 | import ReactDOM from 'react-dom';
4 | import { BrowserRouter } from 'react-router-dom';
5 | import App from './App';
6 | import registerServiceWorker from './registerServiceWorker';
7 |
8 | const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href');
9 | const rootElement = document.getElementById('root');
10 |
11 | ReactDOM.render(
12 |
13 |
14 | ,
15 | rootElement);
16 |
17 | registerServiceWorker();
18 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/Controllers/SampleDataController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 |
7 | namespace Company.WebApplication1.Controllers
8 | {
9 | [Route("api/[controller]")]
10 | public class SampleDataController : Controller
11 | {
12 | private static string[] Summaries = new[]
13 | {
14 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
15 | };
16 |
17 | [HttpGet("[action]")]
18 | public IEnumerable WeatherForecasts()
19 | {
20 | var rng = new Random();
21 | return Enumerable.Range(1, 5).Select(index => new WeatherForecast
22 | {
23 | DateFormatted = DateTime.Now.AddDays(index).ToString("d"),
24 | TemperatureC = rng.Next(-20, 55),
25 | Summary = Summaries[rng.Next(Summaries.Length)]
26 | });
27 | }
28 |
29 | public class WeatherForecast
30 | {
31 | public string DateFormatted { get; set; }
32 | public int TemperatureC { get; set; }
33 | public string Summary { get; set; }
34 |
35 | public int TemperatureF
36 | {
37 | get
38 | {
39 | return 32 + (int)(TemperatureC / 0.5556);
40 | }
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ErrorModel
3 | @{
4 | ViewData["Title"] = "Error";
5 | }
6 |
7 | Error.
8 | An error occurred while processing your request.
9 |
10 | @if (Model.ShowRequestId)
11 | {
12 |
13 | Request ID: @Model.RequestId
14 |
15 | }
16 |
17 | Development Mode
18 |
19 | Swapping to the Development environment displays detailed information about the error that occurred.
20 |
21 |
22 | The Development environment shouldn't be enabled for deployed applications.
23 | It can result in displaying sensitive information from exceptions to end users.
24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
25 | and restarting the app.
26 |
27 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/Pages/Error.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Microsoft.AspNetCore.Mvc.RazorPages;
8 |
9 | namespace Company.WebApplication1.Pages
10 | {
11 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
12 | public class ErrorModel : PageModel
13 | {
14 | public string RequestId { get; set; }
15 |
16 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
17 |
18 | public void OnGet()
19 | {
20 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/Pages/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using Company.WebApplication1
2 | @namespace Company.WebApplication1.Pages
3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.Logging;
10 |
11 | namespace Company.WebApplication1
12 | {
13 | public class Program
14 | {
15 | public static void Main(string[] args)
16 | {
17 | CreateWebHostBuilder(args).Build().Run();
18 | }
19 |
20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21 | WebHost.CreateDefaultBuilder(args)
22 | .UseStartup();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:8080",
7 | //#if(NoHttps)
8 | "sslPort": 0
9 | //#else
10 | "sslPort": 44300
11 | //#endif
12 | }
13 | },
14 | "profiles": {
15 | "IIS Express": {
16 | "commandName": "IISExpress",
17 | "launchBrowser": true,
18 | "environmentVariables": {
19 | "ASPNETCORE_ENVIRONMENT": "Development"
20 | }
21 | },
22 | "Company.WebApplication1": {
23 | "commandName": "Project",
24 | "launchBrowser": true,
25 | //#if(NoHttps)
26 | "applicationUrl": "http://localhost:5000",
27 | //#else
28 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
29 | //#endif
30 | "environmentVariables": {
31 | "ASPNETCORE_ENVIRONMENT": "Development"
32 | }
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Microsoft": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/React-CSharp/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Warning"
5 | }
6 | },
7 | "AllowedHosts": "*"
8 | }
9 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/.template.config/dotnetcli.host.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/dotnetcli.host",
3 | "symbolInfo": {
4 | "Framework": {
5 | "longName": "framework"
6 | },
7 | "HttpPort": {
8 | "isHidden": true
9 | },
10 | "HttpsPort": {
11 | "isHidden": true
12 | },
13 | "ExcludeLaunchSettings": {
14 | "longName": "exclude-launch-settings",
15 | "shortName": ""
16 | },
17 | "skipRestore": {
18 | "longName": "no-restore",
19 | "shortName": ""
20 | },
21 | "NoHttps": {
22 | "longName": "no-https",
23 | "shortName": ""
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/.template.config/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aspnet/Templating/345e22e2d042f3fa3566d857ce1446868a41e1dd/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/.template.config/icon.png
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/.template.config/vs-2017.3.host.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/vs-2017.3.host",
3 | "name": {
4 | "text": "React.js and Redux",
5 | "package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
6 | "id": "1400"
7 | },
8 | "description": {
9 | "text": "A project template for creating an ASP.NET Core application with React.js and Redux",
10 | "package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
11 | "id": "1401"
12 | },
13 | "order": 320,
14 | "icon": "icon.png",
15 | "learnMoreLink": "https://github.com/aspnet/JavaScriptServices",
16 | "uiFilters": [
17 | "oneaspnet"
18 | ],
19 | "supportedAuthentications": [
20 | {
21 | "auth": "None",
22 | "authenticationType": "NoAuth",
23 | "allowUnsecured": true
24 | }
25 | ],
26 | "ports": [
27 | {
28 | "name": "HttpPort",
29 | "useHttps": false
30 | },
31 | {
32 | "name": "HttpsPort",
33 | "useHttps": true
34 | }
35 | ],
36 | "excludeLaunchSettings": false,
37 | "minFullFrameworkVersion": "4.6.1",
38 | "disableHttpsSymbol": "NoHttps"
39 | }
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 |
6 | # testing
7 | /coverage
8 |
9 | # production
10 | /build
11 |
12 | # misc
13 | .DS_Store
14 | .env.local
15 | .env.development.local
16 | .env.test.local
17 | .env.production.local
18 |
19 | npm-debug.log*
20 | yarn-debug.log*
21 | yarn-error.log*
22 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Company.WebApplication1",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "bootstrap": "^4.1.3",
7 | "jquery": "3.3.1",
8 | "react": "^16.0.0",
9 | "react-dom": "^16.0.0",
10 | "react-redux": "^5.0.6",
11 | "react-router-bootstrap": "^0.24.4",
12 | "react-router-dom": "^4.2.2",
13 | "react-router-redux": "^5.0.0-alpha.8",
14 | "react-scripts": "^1.1.5",
15 | "reactstrap": "^6.3.0",
16 | "redux": "^3.7.2",
17 | "redux-thunk": "^2.2.0",
18 | "rimraf": "^2.6.2"
19 | },
20 | "devDependencies": {
21 | "ajv": "^6.0.0",
22 | "babel-eslint": "^7.2.3",
23 | "cross-env": "^5.2.0",
24 | "eslint": "^4.1.1",
25 | "eslint-config-react-app": "^2.1.0",
26 | "eslint-plugin-flowtype": "^2.50.3",
27 | "eslint-plugin-import": "^2.14.0",
28 | "eslint-plugin-jsx-a11y": "^5.1.1",
29 | "eslint-plugin-react": "^7.11.1"
30 | },
31 | "eslintConfig": {
32 | "extends": "react-app"
33 | },
34 | "scripts": {
35 | "start": "rimraf ./build && react-scripts start",
36 | "build": "react-scripts build",
37 | "test": "cross-env CI=true react-scripts test --env=jsdom",
38 | "eject": "react-scripts eject",
39 | "lint": "eslint ./src/"
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aspnet/Templating/345e22e2d042f3fa3566d857ce1446868a41e1dd/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/public/favicon.ico
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "Company.WebApplication1",
3 | "name": "Company.WebApplication1",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": "./index.html",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Route } from 'react-router';
3 | import Layout from './components/Layout';
4 | import Home from './components/Home';
5 | import Counter from './components/Counter';
6 | import FetchData from './components/FetchData';
7 |
8 | export default () => (
9 |
10 |
11 |
12 |
13 |
14 | );
15 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Provider } from 'react-redux';
4 | import { MemoryRouter } from 'react-router-dom';
5 | import App from './App';
6 |
7 | it('renders without crashing', () => {
8 | const storeFake = (state) => ({
9 | default: () => { },
10 | subscribe: () => { },
11 | dispatch: () => { },
12 | getState: () => ({ ...state })
13 | });
14 | const store = storeFake({});
15 |
16 | const div = document.createElement('div');
17 | ReactDOM.render(
18 |
19 |
20 |
21 |
22 | , div);
23 | });
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/components/Counter.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { bindActionCreators } from 'redux';
3 | import { connect } from 'react-redux';
4 | import { actionCreators } from '../store/Counter';
5 |
6 | const Counter = props => (
7 |
8 |
Counter
9 |
10 |
This is a simple example of a React component.
11 |
12 |
Current count: {props.count}
13 |
14 |
Increment
15 |
16 | );
17 |
18 | export default connect(
19 | state => state.counter,
20 | dispatch => bindActionCreators(actionCreators, dispatch)
21 | )(Counter);
22 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/components/Layout.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Container } from 'reactstrap';
3 | import NavMenu from './NavMenu';
4 |
5 | export default props => (
6 |
7 |
8 |
9 | {props.children}
10 |
11 |
12 | );
13 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/components/NavMenu.css:
--------------------------------------------------------------------------------
1 | a.navbar-brand {
2 | white-space: normal;
3 | text-align: center;
4 | word-break: break-all;
5 | }
6 |
7 | html {
8 | font-size: 14px;
9 | }
10 | @media (min-width: 768px) {
11 | html {
12 | font-size: 16px;
13 | }
14 | }
15 |
16 | .box-shadow {
17 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
18 | }
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/components/NavMenu.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Collapse, Container, Navbar, NavbarBrand, NavbarToggler, NavItem, NavLink } from 'reactstrap';
3 | import { Link } from 'react-router-dom';
4 | import './NavMenu.css';
5 |
6 | export default class NavMenu extends React.Component {
7 | constructor (props) {
8 | super(props);
9 |
10 | this.toggle = this.toggle.bind(this);
11 | this.state = {
12 | isOpen: false
13 | };
14 | }
15 | toggle () {
16 | this.setState({
17 | isOpen: !this.state.isOpen
18 | });
19 | }
20 | render () {
21 | return (
22 |
23 |
24 |
25 | Company.WebApplication1
26 |
27 |
28 |
29 |
30 | Home
31 |
32 |
33 | Counter
34 |
35 |
36 | Fetch data
37 |
38 |
39 |
40 |
41 |
42 |
43 | );
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/index.js:
--------------------------------------------------------------------------------
1 | import 'bootstrap/dist/css/bootstrap.css';
2 | import React from 'react';
3 | import ReactDOM from 'react-dom';
4 | import { Provider } from 'react-redux';
5 | import { ConnectedRouter } from 'react-router-redux';
6 | import { createBrowserHistory } from 'history';
7 | import configureStore from './store/configureStore';
8 | import App from './App';
9 | import registerServiceWorker from './registerServiceWorker';
10 |
11 | // Create browser history to use in the Redux store
12 | const baseUrl = document.getElementsByTagName('base')[0].getAttribute('href');
13 | const history = createBrowserHistory({ basename: baseUrl });
14 |
15 | // Get the application-wide store instance, prepopulating with state from the server where available.
16 | const initialState = window.initialReduxState;
17 | const store = configureStore(history, initialState);
18 |
19 | const rootElement = document.getElementById('root');
20 |
21 | ReactDOM.render(
22 |
23 |
24 |
25 |
26 | ,
27 | rootElement);
28 |
29 | registerServiceWorker();
30 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/store/Counter.js:
--------------------------------------------------------------------------------
1 | const incrementCountType = 'INCREMENT_COUNT';
2 | const decrementCountType = 'DECREMENT_COUNT';
3 | const initialState = { count: 0 };
4 |
5 | export const actionCreators = {
6 | increment: () => ({ type: incrementCountType }),
7 | decrement: () => ({ type: decrementCountType })
8 | };
9 |
10 | export const reducer = (state, action) => {
11 | state = state || initialState;
12 |
13 | if (action.type === incrementCountType) {
14 | return { ...state, count: state.count + 1 };
15 | }
16 |
17 | if (action.type === decrementCountType) {
18 | return { ...state, count: state.count - 1 };
19 | }
20 |
21 | return state;
22 | };
23 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/store/WeatherForecasts.js:
--------------------------------------------------------------------------------
1 | const requestWeatherForecastsType = 'REQUEST_WEATHER_FORECASTS';
2 | const receiveWeatherForecastsType = 'RECEIVE_WEATHER_FORECASTS';
3 | const initialState = { forecasts: [], isLoading: false };
4 |
5 | export const actionCreators = {
6 | requestWeatherForecasts: startDateIndex => async (dispatch, getState) => {
7 | if (startDateIndex === getState().weatherForecasts.startDateIndex) {
8 | // Don't issue a duplicate request (we already have or are loading the requested data)
9 | return;
10 | }
11 |
12 | dispatch({ type: requestWeatherForecastsType, startDateIndex });
13 |
14 | const url = `api/SampleData/WeatherForecasts?startDateIndex=${startDateIndex}`;
15 | const response = await fetch(url);
16 | const forecasts = await response.json();
17 |
18 | dispatch({ type: receiveWeatherForecastsType, startDateIndex, forecasts });
19 | }
20 | };
21 |
22 | export const reducer = (state, action) => {
23 | state = state || initialState;
24 |
25 | if (action.type === requestWeatherForecastsType) {
26 | return {
27 | ...state,
28 | startDateIndex: action.startDateIndex,
29 | isLoading: true
30 | };
31 | }
32 |
33 | if (action.type === receiveWeatherForecastsType) {
34 | return {
35 | ...state,
36 | startDateIndex: action.startDateIndex,
37 | forecasts: action.forecasts,
38 | isLoading: false
39 | };
40 | }
41 |
42 | return state;
43 | };
44 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/ClientApp/src/store/configureStore.js:
--------------------------------------------------------------------------------
1 | import { applyMiddleware, combineReducers, compose, createStore } from 'redux';
2 | import thunk from 'redux-thunk';
3 | import { routerReducer, routerMiddleware } from 'react-router-redux';
4 | import * as Counter from './Counter';
5 | import * as WeatherForecasts from './WeatherForecasts';
6 |
7 | export default function configureStore (history, initialState) {
8 | const reducers = {
9 | counter: Counter.reducer,
10 | weatherForecasts: WeatherForecasts.reducer
11 | };
12 |
13 | const middleware = [
14 | thunk,
15 | routerMiddleware(history)
16 | ];
17 |
18 | // In development, use the browser's Redux dev tools extension if installed
19 | const enhancers = [];
20 | const isDevelopment = process.env.NODE_ENV === 'development';
21 | if (isDevelopment && typeof window !== 'undefined' && window.devToolsExtension) {
22 | enhancers.push(window.devToolsExtension());
23 | }
24 |
25 | const rootReducer = combineReducers({
26 | ...reducers,
27 | routing: routerReducer
28 | });
29 |
30 | return createStore(
31 | rootReducer,
32 | initialState,
33 | compose(applyMiddleware(...middleware), ...enhancers)
34 | );
35 | }
36 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Controllers/SampleDataController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using Microsoft.AspNetCore.Mvc;
6 |
7 | namespace Company.WebApplication1.Controllers
8 | {
9 | [Route("api/[controller]")]
10 | public class SampleDataController : Controller
11 | {
12 | private static string[] Summaries = new[]
13 | {
14 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
15 | };
16 |
17 | [HttpGet("[action]")]
18 | public IEnumerable WeatherForecasts(int startDateIndex)
19 | {
20 | var rng = new Random();
21 | return Enumerable.Range(1, 5).Select(index => new WeatherForecast
22 | {
23 | DateFormatted = DateTime.Now.AddDays(index + startDateIndex).ToString("d"),
24 | TemperatureC = rng.Next(-20, 55),
25 | Summary = Summaries[rng.Next(Summaries.Length)]
26 | });
27 | }
28 |
29 | public class WeatherForecast
30 | {
31 | public string DateFormatted { get; set; }
32 | public int TemperatureC { get; set; }
33 | public string Summary { get; set; }
34 |
35 | public int TemperatureF
36 | {
37 | get
38 | {
39 | return 32 + (int)(TemperatureC / 0.5556);
40 | }
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ErrorModel
3 | @{
4 | ViewData["Title"] = "Error";
5 | }
6 |
7 | Error.
8 | An error occurred while processing your request.
9 |
10 | @if (Model.ShowRequestId)
11 | {
12 |
13 | Request ID: @Model.RequestId
14 |
15 | }
16 |
17 | Development Mode
18 |
19 | Swapping to the Development environment displays detailed information about the error that occurred.
20 |
21 |
22 | The Development environment shouldn't be enabled for deployed applications.
23 | It can result in displaying sensitive information from exceptions to end users.
24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
25 | and restarting the app.
26 |
27 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Pages/Error.cshtml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Microsoft.AspNetCore.Mvc.RazorPages;
8 |
9 | namespace Company.WebApplication1.Pages
10 | {
11 | [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
12 | public class ErrorModel : PageModel
13 | {
14 | public string RequestId { get; set; }
15 |
16 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
17 |
18 | public void OnGet()
19 | {
20 | RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Pages/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using Company.WebApplication1
2 | @namespace Company.WebApplication1.Pages
3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore;
7 | using Microsoft.AspNetCore.Hosting;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.Logging;
10 |
11 | namespace Company.WebApplication1
12 | {
13 | public class Program
14 | {
15 | public static void Main(string[] args)
16 | {
17 | CreateWebHostBuilder(args).Build().Run();
18 | }
19 |
20 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21 | WebHost.CreateDefaultBuilder(args)
22 | .UseStartup();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:8080",
7 | //#if(NoHttps)
8 | "sslPort": 0
9 | //#else
10 | "sslPort": 44300
11 | //#endif
12 | }
13 | },
14 | "profiles": {
15 | "IIS Express": {
16 | "commandName": "IISExpress",
17 | "launchBrowser": true,
18 | "environmentVariables": {
19 | "ASPNETCORE_ENVIRONMENT": "Development"
20 | }
21 | },
22 | "Company.WebApplication1": {
23 | "commandName": "Project",
24 | "launchBrowser": true,
25 | //#if(NoHttps)
26 | "applicationUrl": "http://localhost:5000",
27 | //#else
28 | "applicationUrl": "https://localhost:5001;http://localhost:5000",
29 | //#endif
30 | "environmentVariables": {
31 | "ASPNETCORE_ENVIRONMENT": "Development"
32 | }
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Microsoft": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Microsoft.DotNet.Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Warning"
5 | }
6 | },
7 | "AllowedHosts": "*"
8 | }
9 |
--------------------------------------------------------------------------------
/src/SetPackageProperties.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | $(NuspecProperties);
6 | id=$(PackageId);
7 | version=$(PackageVersion);
8 | licenseUrl=$(PackageLicenseUrl);
9 | iconUrl=$(PackageIconUrl);
10 | description=$(Description);
11 | author=$(Authors);
12 | copyright=$(Copyright);
13 | tags=$(PackageTags.Replace(';', ' '));
14 | projectUrl=$(PackageProjectUrl);
15 | repositoryUrl=$(RepositoryUrl);
16 | repositoryType=$(RepositoryType);
17 | repositoryCommit=$(RepositoryCommit);
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/templates.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $author$
7 | $description$
8 | $iconUrl$
9 | en-US
10 | true
11 | $projectUrl$
12 | $licenseUrl$
13 | $copyright$
14 | $tags$
15 |
16 |
17 |
18 |
19 |
20 |
21 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/test/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/test/DotNetToolsInstaller/DotNetToolsInstaller.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netcoreapp3.0
4 | DotnetToolReference
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/test/GenerateTestProps.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | RestoreSources=$([MSBuild]::Escape($(RestoreSources)));
6 | RuntimeFrameworkVersion=$(RuntimeFrameworkVersion);
7 | MicrosoftNETSdkRazorPackageVersion=$(MicrosoftNETSdkRazorPackageVersion);
8 | BundledAspNetCoreAppTargetFrameworkVersion=$(MicrosoftAspNetCoreAppPackageVersion.Split('.')[0]).$(MicrosoftAspNetCoreAppPackageVersion.Split('.')[1]);
9 | BundledAspNetCoreAppPackageVersion=$(MicrosoftAspNetCoreAppPackageVersion)
10 |
11 |
12 |
13 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/test/TemplateTests.props.in:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | ${RestoreSources}
5 | ${RuntimeFrameworkVersion}
6 | ${MicrosoftNETSdkRazorPackageVersion}
7 | ${BundledAspNetCoreAppTargetFrameworkVersion}
8 | ${BundledAspNetCoreAppPackageVersion}
9 |
10 | 99.9
11 |
12 |
13 |
--------------------------------------------------------------------------------
/test/Templates.Test/.gitattributes:
--------------------------------------------------------------------------------
1 | .json diff
--------------------------------------------------------------------------------
/test/Templates.Test/EmptyWebTemplateTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using Microsoft.AspNetCore.Testing.xunit;
5 | using Xunit;
6 | using Xunit.Abstractions;
7 |
8 | namespace Templates.Test
9 | {
10 | public class EmptyWebTemplateTest : TemplateTestBase
11 | {
12 | public EmptyWebTemplateTest(ITestOutputHelper output) : base(output)
13 | {
14 | }
15 |
16 | [Fact]
17 | public void EmptyWebTemplate()
18 | {
19 | RunDotNetNew("web");
20 |
21 | foreach (var publish in new[] { false, true })
22 | {
23 | using (var aspNetProcess = StartAspNetProcess(publish))
24 | {
25 | aspNetProcess.AssertOk("/");
26 | }
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/test/Templates.Test/Infrastructure/AssemblyFixtureAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using System;
5 |
6 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
7 | public class AssemblyFixtureAttribute : Attribute
8 | {
9 | public AssemblyFixtureAttribute(Type fixtureType)
10 | {
11 | FixtureType = fixtureType;
12 | }
13 | public Type FixtureType { get; private set; }
14 | }
15 |
--------------------------------------------------------------------------------
/test/Templates.Test/Infrastructure/BrowserTestBase.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using System.Threading;
5 | using OpenQA.Selenium;
6 | using Xunit;
7 | using Xunit.Abstractions;
8 |
9 | namespace Templates.Test.Infrastructure
10 | {
11 | [CaptureSeleniumLogs]
12 | public class BrowserTestBase : TemplateTestBase, IClassFixture
13 | {
14 | private static readonly AsyncLocal _browser = new AsyncLocal();
15 | private static readonly AsyncLocal _logs = new AsyncLocal();
16 |
17 | public static IWebDriver Browser => _browser.Value;
18 |
19 | public static ILogs Logs => _logs.Value;
20 |
21 | public BrowserTestBase(BrowserFixture browserFixture, ITestOutputHelper output) : base(output)
22 | {
23 | _browser.Value = browserFixture.Browser;
24 | _logs.Value = browserFixture.Logs;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/test/Templates.Test/Infrastructure/XUnitExtensions/XunitTestFrameworkExecutorWithAssemblyFixture.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using System.Collections.Generic;
5 | using System.Reflection;
6 | using Xunit.Abstractions;
7 | using Xunit.Sdk;
8 |
9 | namespace Templates.Test.Helpers.XunitExtensions
10 | {
11 | public class XunitTestFrameworkExecutorWithAssemblyFixture : XunitTestFrameworkExecutor
12 | {
13 | public XunitTestFrameworkExecutorWithAssemblyFixture(AssemblyName assemblyName, ISourceInformationProvider sourceInformationProvider, IMessageSink diagnosticMessageSink)
14 | : base(assemblyName, sourceInformationProvider, diagnosticMessageSink)
15 | {
16 | }
17 |
18 | protected override async void RunTestCases(IEnumerable testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions)
19 | {
20 | using (var assemblyRunner = new XunitTestAssemblyRunnerWithAssemblyFixture(TestAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions))
21 | {
22 | await assemblyRunner.RunAsync();
23 | }
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/test/Templates.Test/Infrastructure/XUnitExtensions/XunitTestFrameworkWithAssemblyFixture.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using System.Reflection;
5 | using Xunit.Abstractions;
6 | using Xunit.Sdk;
7 |
8 | namespace Templates.Test.Helpers.XunitExtensions
9 | {
10 | public class XunitTestFrameworkWithAssemblyFixture : XunitTestFramework
11 | {
12 | public XunitTestFrameworkWithAssemblyFixture(IMessageSink messageSink)
13 | : base(messageSink)
14 | {
15 | }
16 |
17 | protected override ITestFrameworkExecutor CreateExecutor(AssemblyName assemblyName)
18 | => new XunitTestFrameworkExecutorWithAssemblyFixture(assemblyName, SourceInformationProvider, DiagnosticMessageSink);
19 | }
20 | }
--------------------------------------------------------------------------------
/test/Templates.Test/SpaTemplateTest/AngularTemplateTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using Microsoft.AspNetCore.Testing.xunit;
5 | using Templates.Test.Infrastructure;
6 | using Xunit;
7 | using Xunit.Abstractions;
8 |
9 | [assembly: AssemblyFixture(typeof(SeleniumServerFixture))]
10 | namespace Templates.Test.SpaTemplateTest
11 | {
12 | public class AngularTemplateTest : SpaTemplateTestBase
13 | {
14 | public AngularTemplateTest(BrowserFixture browserFixture, ITestOutputHelper output) : base(browserFixture, output)
15 | {
16 | }
17 |
18 | [Fact]
19 | public void AngularTemplate_Works()
20 | => SpaTemplateImpl("angular");
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/test/Templates.Test/SpaTemplateTest/ReactReduxTemplateTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using Templates.Test.Infrastructure;
5 | using Xunit;
6 | using Xunit.Abstractions;
7 |
8 | [assembly: AssemblyFixture(typeof(SeleniumServerFixture))]
9 | namespace Templates.Test.SpaTemplateTest
10 | {
11 | public class ReactReduxTemplateTest : SpaTemplateTestBase
12 | {
13 | public ReactReduxTemplateTest(BrowserFixture browserFixture, ITestOutputHelper output) : base(browserFixture, output)
14 | {
15 | }
16 |
17 | [Fact]
18 | public void ReactReduxTemplate_Works_NetCore()
19 | => SpaTemplateImpl("reactredux");
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/test/Templates.Test/SpaTemplateTest/ReactTemplateTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using Templates.Test.Infrastructure;
5 | using Xunit;
6 | using Xunit.Abstractions;
7 |
8 | [assembly: AssemblyFixture(typeof(SeleniumServerFixture))]
9 | namespace Templates.Test.SpaTemplateTest
10 | {
11 | public class ReactTemplateTest : SpaTemplateTestBase
12 | {
13 | public ReactTemplateTest(BrowserFixture browserFixture, ITestOutputHelper output) : base(browserFixture, output)
14 | {
15 | }
16 |
17 | [Fact]
18 | public void ReactTemplate_Works_NetCore()
19 | => SpaTemplateImpl("react");
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/test/Templates.Test/SpaTemplateTest/ReactTemplateTest.cs~RF9c2cf40.TMP:
--------------------------------------------------------------------------------
1 | using Xunit;
2 | using Xunit.Abstractions;
3 |
4 | namespace Templates.Test.SpaTemplateTest
5 | {
6 | public class ReactTemplateTest : SpaTemplateTestBase
7 | {
8 | public ReactTemplateTest(BrowserFixture browserFixture, ITestOutputHelper output) : base(browserFixture, output)
9 | {
10 | }
11 |
12 | [Fact]
13 | public void ReactTemplate_Works_NetCore()
14 | => SpaTemplateImpl(null, "react");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/test/Templates.Test/WebApiTemplateTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using Xunit;
5 | using Xunit.Abstractions;
6 |
7 | namespace Templates.Test
8 | {
9 | public class WebApiTemplateTest : TemplateTestBase
10 | {
11 | public WebApiTemplateTest(ITestOutputHelper output) : base(output)
12 | {
13 | }
14 |
15 | [Fact]
16 | public void WebApiTemplate()
17 | {
18 | RunDotNetNew("webapi");
19 |
20 | foreach (var publish in new[] { false, true })
21 | {
22 | using (var aspNetProcess = StartAspNetProcess(publish))
23 | {
24 | aspNetProcess.AssertOk("/api/values");
25 | aspNetProcess.AssertNotFound("/");
26 | }
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/version.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | 3.0.0
4 | alpha1
5 | $(VersionPrefix)
6 | $(VersionPrefix)-$(VersionSuffix)-final
7 | t000
8 | a-
9 | $(FeatureBranchVersionPrefix)$(VersionSuffix)-$([System.Text.RegularExpressions.Regex]::Replace('$(FeatureBranchVersionSuffix)', '[^\w-]', '-'))
10 | $(VersionSuffix)-$(BuildNumber)
11 |
12 |
13 |
--------------------------------------------------------------------------------