Microsoft Visual Studio 2017 for Mac Preview installation case sharing, 2017 preview

Source: Internet
Author: User

Microsoft Visual Studio 2017 for Mac Preview installation case sharing, 2017 preview

This article introduces Microsoft Visual Studio 2017 for Mac Preview download, installation, and Demo

0. Preface:

For work reasons, I went to work and carried my Raytheon. I lost 10 catties a month and put my Mac in my company.

Before Mac, we bought a PD Virtual Machine to run...

Now, I finally got chicken soup-with the release of Visual Studio 2017, the for Mac version was also born!

You can download it on the Visual Studio official website, but it may be a little slow. I uploaded Baidu cloud. Download the article at the end.

Mac installation is always very simple. You can load images and drag them to the App. Here we will take care of new users and briefly describe the process:

[PS: That's enough. I wrote this article and the browser crashed N times. The number of times it was rewritten. ===]

1. Online Installer

The downloaded VisualStudioforMacPreviewInstaller. dmg has a size of 23.9 MB. This is the installation program. In other words, it is installed online.

(Download at the end of the article)

Double-click image loading:

  

Double-click the download icon to bring up a page you know:

After accepting and continuing, you are prompted to check the network link:

After about 10 seconds, a network connection error will be prompted:

I am stuck in this mistake all the time. It seems that the whole life has been fixed here.

But fortunately, this error also occurs when VS2015's AndroidSDK has been installed before, so I subconsciously looked for it below. The following highlights are found:

Isn't this the installation program of Visual Studio for Mac ?!

Right-click the link and paste it to thunder... Ah, haha.

Then we get the installation program, a total of 216.3 MB. (Download at the end of the article)

2. Install the VS Program

After downloading thunder, double-click to load the image:

I know how to do this ~ Haha. The installation is completed by dragging to Applications. Haha.

3. HelloWorld

Click the Visual Studio startup icon to start running VS. The main program of VS is displayed:

I personally think it looks better than XCode, probably because of the icon in the lower left corner.

Click New Project... to create a New Project.

First of all, let's take a look at the project templates, which are roughly divided into Multiplatform. the literal translation should be a cross-platform project:

 

Then there is a. NET Core project:

Finally, it is Other:

You can also click the language drop-down box to modify the programming language:

  

Choose Console Project (C #)-Next:

Enter the project name, solution name, and path, and click Create to Create the project:

The classic interface provides tools, online documents, and unit tests on the left, solutions on the right, and errors on the following.

For example, after you click "run", the terminal is automatically opened and the result is displayed:

It's quite interesting to write a classic 9-9 multiplication table.

The Code prompts are awesome:

Come, take one ~

4. Test ADO. NET.

Let's take a look at the project structure in the right solution, which is almost the same as Windows.

For example, AssemblyInfo. cs assembly information:

We can see that there is only one System reference in the Console project.

Next we will practice ADO. NET, so we need to add a reference to System. Data.

Right-click References (reference)-Edit References... (Edit reference ):

It can be divided into All, Packages, Projects, and. NET Assembly.

Project refers to the Project in the current solution, and. NET Assembly can select a third-party component.

Here, we find System. Data and System. Configuration:

After adding a reference, two references are added to the project reference:

Next, we add an application configuration file (App. config ).

Right-click Project-Add File:

Select Misc-Application Configuration File and click OK:

Add the classic link string code in App. config. You can only use your memory to knock.

The Code is as follows:

Compile the ADO. NET code in the Main () method to test the ADO. NET component.

Because I am connecting to my server, I cannot remember what the database is. Therefore, the master database is directly connected. select the name of sysobjects:

using System;using System.Configuration;using System.Data.SqlClient;namespace HelloWorld{ class MainClass { public static void Main(string[] args) { string connStr = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; string sql = "select name from sysobjects"; SqlConnection conn = null; SqlDataReader reader = null; try { conn = new SqlConnection(connStr); conn.Open(); SqlCommand comm = new SqlCommand(sql, conn); reader = comm.ExecuteReader(System.Data.CommandBehavior.CloseConnection); while (reader.Read()) { Console.WriteLine(reader["name"]); } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (reader != null) reader.Close(); if (conn != null) conn.Close(); } } }}

ADO. NET test code

The running result is as follows:

Haha. It's a bit interesting, my brother ~

5. Test ASP. NET MVC

Continue.

Right-click the solution and add a project:

Select Other-ASP. net mvc Project and click Next:

Configure the project, select whether to create WebAPI and unit test, and Next:

Configure the project name and path, and click Create to Create the project:

After the creation is complete, a prompt is displayed:

That is to say, the project requires the following things. You need to click "accept installation" to complete the installation.

You can't do anything about MVC, such as Controller.

Click Accept. The Adding Packages... (Adding a component) is displayed ):

Wait for about 10 seconds and prompt Packages successfully added. (added ):

Let's take a look at the project structure on the right, which is the same as our normal project structure.

In Controllers, It is a controller, Views is a view, Models is a model, and Scripts is a script ,... Needless to say.

Therefore, it is quite quick to get started.

Click Run to view the effect:

Haha, it's a bit interesting ..

Add the User model class to Models:

using System; namespace HelloWorldMVC { public class User { public int Id { get; set; } public string Name { get; set; } public string Email { get; set; } } }

Modify the Controllers/HomeController. cs controller code, create a User array, and store it in ViewBag:

Using System; using System. collections. generic; using System. linq; using System. web; using System. web. mvc; using System. web. mvc. ajax; namespace HelloWorldMVC. controllers {public class HomeController: Controller {public ActionResult Index () {var users = new [] {new User () {Id = 1001, Name = "Zhang Dong ", email = "778078163@qq.com"}, new User () {Id = 1002, Name = "Catalina", Email = "katelinna@qq.com"}, new User () {Id = 1003, name = "blind monk", Email = "mangseng@qq.com"}, new User () {Id = 1004, Name = "mongana", Email = "moganna@qq.com "}, new User () {Id = 1005, Name = "Bounty", Email = "shangjin@qq.com" }}; ViewBag. users = users; return View ();}}}

Modify the Views/Home/Index. cshtml code to display the information of the saved array:

@ If (ViewBag. Users = null) {<p> no data. </P >}else {<table> <thead> <tr> <th> NO. </th> <th> name </th> <th> email </th> </tr> </thead> <tbody> @ foreach (var item in ViewBag. users) {<tr> <td> @ item. id </td> <td> @ item. name </td> <td> @ item. email </td> </tr >}</tbody> </table>}

Click Run:

Hi, I'm XXXX. Open Views/Shared/Layout. cshtml, set the encoding format, and add the meta modification as follows:

<!DOCTYPE html> 

Run again:

OK. You're done ~

5. Software Download

Visual Studio for Mac Preview Installer. dmgLink: https://pan.baidu.com/s/1miwKtW8 password: ivtu

Visual Studio For Mac Preview1 7.0.0.347.dmgLink: https://pan.baidu.com/s/1boNkTor password: nu5x

6. End

Haha, at this point, all the tests have been completed, and it feels good.

It seems that there is no form application...

Okay, you can play it on your own. If you have any questions, let's leave a message to share your feelings. Haha.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.