📜 ⬆️ ⬇️

Migrating from ASP.NET to ASP.NET Core 1.1

Migrating from ASP.NET to ASP.NET Core 1.1


Content:


  1. Introduction
  2. Comparing Technology Stacks
  3. Useful commands
  4. Build and run the project
  5. Entity Framework Core
  6. Introduction

One of the activities of our company is web development. For site development we use ASP.NET MVC, and, as usual, the hosting for our good is the Windows Server. But as time goes on, new technologies appear, and old technologies evolve, as do the wishes of our customers.


Over time, there was a need to launch a new project on linux hosting. Everything would be fine, the task would seem relatively trivial. But in the requirements was the use of our CMS, written on the stack ASP.NET MVC 5, which greatly complicates the task.


Having thought it over, we decided that the most suitable option would be to transfer our developments to the ASP.NET Core stack. In the process of migration to the rails of new technologies, a lot of interesting moments and difficulties arose.


Comparing Technology Stacks


Below, I compared the stacks of technologies used to develop our projects initially and those that we chose as a replacement in the migration process.



Useful commands


Build and run the project


You can use dotnet run to run and build a project. You can make the task a little easier and use the dotnet run -watch . This command starts dotnet at monitoring code changes, and when changes occur, the project automatically builds and runs.


To use it, add the following code to the .csproj project file.


After saving, you need to type dotnet restore in order for the necessary package to be loaded from NuGet into our project.


Entity Framework Core


You can use the dotnet ef migrations add { } command to create a migration to the Entity Framework Core.


To apply the migration, use the dotnet ef database update command.


To use this command you need to add the following code to .csproj:


And, of course, use the dotnet restore command after that.


')

Source: https://habr.com/ru/post/338644/


All Articles