Hefei Programmer Group: 49313181. Hefei Real-name programmer Group: 128131462 (do not want to disclose names and information to join, application notes fill in the name + technology + working life)
Q q:408365330 E-mail:[email protected]
One. Write in front
Distance from the last writing technology has been a long time, has been busy with the company's things, their own things. NET-related blogs are a thing of the years ago. After all, turn to do Andorid and iOS has more than 2 years, the National Day holiday also think about the next, think again busy or want to take time to make their own precipitation, money is not earned (although also make money, have the opportunity to make money brothers to think of me ah), tired to see the blog to understand the new technology, before also learned from the technical Open source, and then the official release of. NET core1.0, now the latest. NET Core 1.0.1 is released. So I intend to follow up, after all, I also follow. NET has been mixed up for so many years, and now. NET core-related technologies are beginning to mature. Note: I don't like webfrom from the development of the. NET Framework. Prefer the original eco-web development of ASP. NET core finally abandoned the Webfrom applause ...
two. What is. NET core
. NET core is an open-source, cross-platform. NET implementation.. NET core is open source with the MIT protocol, so it can be used for all types of commercial and closed source projects, and it is officially supported by Microsoft. The source is hosted on the famous GitHub.
Https://github.com/dotnet is interested in research, and it is curious to know what the difference is between the. NET Framework and Mono. In such a popular sense, the. NET Framework is a Windows-based platform that contains many of the Windows platform-specific things that cannot be cross-platform, and it is very large and mature after so many years of development. Mono is an open-source, cross-platform implementation of the. NET Framework that makes the. NET Framework a cross-platform implementation. This time again, Microsoft has led the development of. NET core is that mono not repeating? Let me say. NET core, the. NET core is a fully re-developed modular platform. The core embodies that it is the heart of a cross-platform, small in size. And it's all about core functionality, and other features that are based on modules that are developed and expanded, such as I want to do web development, then we can integrate the MVC module, and of course it will be used to build Web applications, microservices, create application libraries and consoles.. NET core is a brand new development. Net Many of the APIs in the framework are discarded. And it only developed for 2 of years, and many modern advanced grammars were added to it, and what I did initially was. NET development, and then Android and iOS development, Java Web is also involved, but the most let me feel good grammar or. NET, do not say much, otherwise someone will attack me, the elegance of grammar everyone try to know. The latest version is. NET Core 1.0.1 As to why it is starting from 1.0 Everyone Baidu, also embodies it is a new thing. Don't confuse the previous. NET Framework.
Three. Mac OS build. NET Core Development environment
1. Install the. NET Core SDK
Brew Update
Brew Install OpenSSL
Ln-s/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib/usr/local/lib/
Ln-s/usr/local/opt/openssl/lib/libssl.1.0.0.dylib/usr/local/lib/
If brew is not installed, install it yourself and execute the update command after the installation is successful
Brew Update (if unable to update, please FQ or set agent, self-Baidu)
Why this is done because. NET core requires OpenSSL to install under Mac. We install OpenSSL through brew;
After successful, download the. NET Core SDK,PKG package to install directly until successful.
See this interface is in accordance with the success, to restart the command Line window input dotnet verification.
The interface above appears to indicate that the installation was successful. This time, if the simple command line is ready to create and debug. NET core programs. But we're used to the template catalog that Visual Studio generates for ASP. (It's very painful to organize those directories and configurations yourself)
2. Install the. NET program template
Install node. js download https://nodejs.org/en/only node. JS is installed to use the NPM package management tool.
Installation Complete execute sudo npm install-g yo generator-aspnet Bower
After a successful installation, you can create a template project like WINODWS below Visual Studio
If you've ever used the NMP, you know what the above orders are for.
after successful execution, you can pass: Yo ASPNET command creates a template project (the directory where the command executes will generate the project directory and file)
You can see that there are 7 ready-made project templates to choose from. The top and bottom keys select the second-to-last Web application Basic [without membership and Authorization] which is the template. This basic C # language-based template does not have a rights management framework.
Step by step follow the action to select Bootstrap UI, enter the project name,Bower Install will automatically update the dependent JS Library, from here you can see that Microsoft now embrace open source integration of a lot of open-source front-end libraries, and some good front-end management tools, here the NPM and Bower are both .......
After success, you can run the project.
Follow the instructions in the Red box to first enter the project you just created, and then execute the dotnet Restore command to download the dependent libraries from the network like NuGet. Maven in Java Web Development is about the same, dotnet build after completion this is the compile project. After the compilation is complete dotnet run (you can skip dotnet build directly dotnet run). After success should enter:
You can see that the access address and port http://localhost:5000 in the browser can be seen as:
Congratulations, it's a success. But the problem comes again, edit code can not always vi edit it, we are accustomed to use a variety of ide,windows under the visual Studio,mac below using Visual Studio Code, This is a Microsoft Open source Editor can be implemented through a variety of plug-in code debugging and editing, and very small, performance is perfect,
3. Install Visual Studio Code and edit debug code with VSC
Install Visual Studio code successfully after installing the C # plugin This plugin is used for highlighting and smart hints. Support debugging at the same time, the function greatly drops
Install the C # plug-in, turn on VSC and then Mac key +p the VSC command then enter ext Install CSharp Last enter OK, appear as
Install the plugin and restart the VSC. Import a project template that you just created from the command
Then F5 can run the program or click on the following example:
F5 run always selects Net core (two times selection) to generate project runs and task profiles Lunch.json and Task.json they are generated into the. Vscode directory. Run or report a path error after generating 2 files
You can see the Red Box 3 prompts the wrong path, we want to make a launch.json configuration, so the default generated Launch.json need to make some changes to debug. Modified as: (Can be compared with this section), because we debug the Web, so the configuration of the console will not be modified
And then run, wait a moment, the console appears debugging information, Perfect VSC started debugging, and the same as Visual Studio automatically open the browser display homepage, perfect!!!!!
Then the homepage hit a breakpoint browser to refresh the homepage:
What a beautiful breakpoint appeared, as well as some advanced Ides, have the execution stack, very happy there is no.
If you prefer the command line, VSC supports command line run shortcut CTRL + ' Open VSC Command window and previous command line input commands dotnet run
The same runs. The most basic environment, then you can under the Mac with VSC (Visual Studio Code) to develop. NET programs, do not need to open the system command line to switch between different interfaces is a painful thing, the pain is not, command-line execution or F5 debugging is done in one interface.
See here is not very excited, is not very want to inside try cross-platform development. Net?? Then move on, let's go together. NET this great development technology again fire up
Copyright: Belong to the blog park and Egojit All, reproduced please indicate the source.
Mac OS. NE development Environment Construction