For. NET open source plan presumably the people who are concerned have already been tempted, but the real use of it for development is currently few. After all, the. NET Core was released to the 1.0RC2 version when this article was published. The official version is expected to be some time. And most people are on the sidelines, even though the. NET Framework is still in development. The other thing I have to say is. NET open Source's progress is astonishing but community construction still needs to ascend, a lot of matching things are not complete. Java may be lagging behind the language level. NET but the community power of Java is far from. Net.
First, install the SDK
. NET Core Release: Https://www.microsoft.com/net/core
The. NET core provides a central running component, and the modules to be used are obtained by means of nuget. Development can be completely independent of the. NET Framework and platform. However, the. NET core functionality is not as complete as the. NET Framework. The WebForm of the Web field has been abandoned. WinForm is also no longer in the open source plan. Want to use or prudent, after all, this is just a start.
1.windows Platform Installation SDK
Download and install it directly. https://go.microsoft.com/fwlink/?LinkID=798398
2.Linux Platform Installation SDK(test system: Ubuntu 14)
Official instruction manual: Https://www.microsoft.com/net/core#ubuntu
sudo sh-c ' echo "Deb [Arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet/trusty main" >/etc/apt/ Sources.list.d/dotnetdev.list '
sudo apt-key adv--keyserver apt-mo.trafficmanager.net
--recv-keys 417A0893 sudo apt-get update
sudo apt-get install dotnet-dev-1.0.0-preview1-002702
There are several main points of attention:
Ubuntu 16 was not successful with the Apt-get installation at test time. Currently only successful in UBUNTU14 test.
Direct use: Apt-get install dotnet Get the version is not clear, see the installation after the version number seems to be the latest, but the creation of the project is not the latest. So the version number is specified in the official way when the installation is made.
3. The installation completes the environment test
Use instructions:
Copy Code code as follows:
The test results are as follows:
C:\>dotnet--info
. NET Command Line Tools (1.0.0-preview1-002702)
Product information:
Version: 1.0.0-preview1-002702
Commit sha:6cde21225e
Runtime Environment:
OS Name: Windows
os Version: 10.0.10586
OS platform:windows
RID: win10-x64
yoli@ubuntu:~$ dotnet--info
. NET Command Line Tools (1.0.0-preview1-002702)
Product information:
Version: 1.0.0-preview1-002702
Commit sha:6cde21225e
Runtime Environment:
OS Name: Ubuntu
os version:14.04
os platform:linux
RID: ubuntu.14.04-x64
Second, create Helloword program
1. Create a console project:
mkdir hwapp
cd Hwapp
dotnet New
Use the dotnet new directive to quickly create a project.
dotnet new–t Console to create a console project. Currently, project types can only create console projects, there are no other optional types, and you want to create more project templates later.
Dotnet New–l C # Creates a project using the C # language. Only C # and F # are currently supported.
To compile and run the project:
Copy Code code as follows:
dotnet Restore
Dotnet Run
Use dotnet resotre to restore package references
Run programs using dotnet run
Compiling code with dotnet build
Publish items using dotnet Publish
Detailed instruction parameters Check the instructions for help.
2. Create a Web project
Because creating a directive does not support creating a Web project, you cannot create it directly by using the Create directive, but it is not advisable to create a project by manually creating a Project.json. You can use tools and templates to quickly create projects.
Available Template cases: Https://github.com/aspnet/cli-samples
You can use the Git tool directly to copy to local use.
In addition to note:
The Dnx startup method is currently not in use in the new version, and all is changed to the dotnet instruction. The Web project starts the same way as the console project starts.
The results of Linux operation are as follows:
Iii. using the editor
Quote the official slogan:
It is very easy to get started and. NET Core on your platform of choice. You are just need a shell, a text editor and minutes of your time.
The feeling is aptly described, but it is estimated that a large pile of people will be forced. vs None, how do we develop it? The official says that with just a text editor, is it possible for developers to take such a powerful vs instead of a text editor? As far as I'm concerned, only a few people are willing to change. After all, most of the development on the Windows platform, the final choice or the use of WINDOWS+VS development, publishing may choose other platforms to publish. This is very unfavorable to the formation of other platform tool chains.
1. Install Vscode
Download and install Vscode:https://www.visualstudio.com/en-us/products/code-vs.aspx
Installing the C # Development Support Plug-in
Open Vscode use Ctrl+p to pull up the command bar and enter the installation instructions:
Copy Code code as follows:
Plugin website: https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp
When the installation is complete, you will be prompted to reboot the Vscode, and after the reboot, it can be developed.
2. Use Vscode to compile and run the project
Use Vscode to open the created project folder. The default item does not have a. Vscode folder, which is then prompted on the top of the message bar, which is automatically created after you click OK. Vscode folder.
The folder contains:
launch.json
And tasks.json
two files that are used to configure the debugger and debug instructions.
Opening the code file will find that the code has a lot of exception information, generally refers to the package is not loaded, you can use the restore instructions to restore or wait for the Vscode load completed, you may be prompted to restore the package in the notification bar.
Debug runs using F5. The C # Debugging plug-in provides several ways to start debugging, and using Web startup automatically opens the browser by default. Breakpoint Debugging Single Step tracking basic difference is not very large, daily development enough to use.
Operation Effect as shown:
The issues to be noted:
(1) If you skip the step of adding a debugger, it is possible to compile the times incorrectly. You only need to Launch.json modify the corresponding parameters. Such as:
(2) Troubleshooting ' Error while installing. NET Core Debugger '
If you have the above prompts, use dotnet--info to see if you can output normal information, and if not, reinstall the supported version of the. NET Core SDK. If you are prompted for restore to fail, check your network connection.
(3) On the Windows platform, enable portable if you are prompted not to find symbols PDBs
Open Project.json Find buildoptions, change debugtype to portable, if you cannot find the buildoptions option, in the old version name: compilationoptions
Conclusion: this time. NET open source is a kind of helplessness rather than Microsoft's mercy. In addition, there is much room for vscode in text editing and multiple project management. There are still a lot of blank places in the community building to be able to add up as soon as possible. Every time I look at the document to see the words in the future, hasn ' t been written yet is always an inexplicable sense of loss.