asp.net-core-react
asp.net core react
Introduction< /h2>
- Development dependent environment
.NET Core SDK (reflecting any global.json):
Version: 2.2.300
Runtime Environment:
OS Name: Mac OS X
Host (useful for support):
Version: 2.2.5
node -v
v10.16.0
-
Development language
asp.net core
react
-
Development tools< br> vscode
Development process
-
Create sln project solution “Sln is not necessary to create but Created to be friendly to smart prompts”
dotnet new sln
- Organize the project
In order to be more fashionable, I have a bed frame in the hierarchical directory alongside sln A src folder is used to manage the source code
mkdir src
- Enter the src directory and create a react web application named web
cd src< /code>
dotnet new react -o web
- Go back to the project root directory and add the newly added web project to the sln project solution file
dotnet sln add src/web/web.csproj
"This must be added"
Our current directory structure is like this
.
├── LICENSE
├── README.md
├── asp.net-core-react.sln
└── src
└── web
├── ClientApp
├── Controllers
├── Pages
├── Program.cs
├── Properties
├── Startup.cs
├── appsettings.Development.json
├── appsettings.json
├── obj
└── web.csproj
7 directories , 8 files
- Start the project -p Specify the project startup file src/web There is Program.cs in the startup project file for us
dotnet run -p src/web/< /code>
- Project start ok
Version: 2.2.300
Runtime Environment:
OS Name: Mac OS X
Host (useful for support):
Version: 2.2.5
node -v
v10.16.0
Development language
asp.net core
react
Development tools< br> vscode
Create sln project solution “Sln is not necessary to create but Created to be friendly to smart prompts”
dotnet new sln
In order to be more fashionable, I have a bed frame in the hierarchical directory alongside sln A src folder is used to manage the source code
mkdir src
cd src< /code>
dotnet new react -o web
dotnet sln add src/web/web.csproj
"This must be added"
Our current directory structure is like this
├── LICENSE
├── README.md
├── asp.net-core-react.sln
└── src
└── web
├── ClientApp
├── Controllers
├── Pages
├── Program.cs
├── Properties
├── Startup.cs
├── appsettings.Development.json
├── appsettings.json
├── obj
└── web.csproj
7 directories , 8 files
dotnet run -p src/web/< /code>
- Browse web/ClientApp/package.json
"scripts": {
"start": "rimraf ./build && react-scripts start",
"build": "react-scripts build",
"test": "cross-env CI=true react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"lint": "eslint ./src/"
}
Scripts integrates several commands to start React this project or build this project needs to add npm before starting this project
npm start
npm build
n pm test
...
The execution directory should be in the ClinetApp folder
- build react project
- Release project
Create a release folder at the same level as sln Used to store release files
dotnet publish -c release -o ../../release/
Publish the project
- Execute the release file
dotnet release/web .dll
- Tweets about environment variable settings
https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/environments?view=aspnetcore-2.2< /li>
Project has been pushed to GitHub
Address:
https://github.com/TopGuo/asp.net- core-react
Second Chapter
Semi-finished product...no time to do it ... Later improvements
This demo is quite predictable
- There are pits between c# md5 encryption and decryption and js
- Use another The method uses dapper
- ... a purpose to experience the effects of .net core and react
current project performance