Microsoft Visual Studio 2017 for MAC preview Installation use case sharing _ practical tips

Source: Internet
Author: User

This article gives you a detailed overview of Microsoft Visual Studio 2017 for Mac Preview downloads, installations, case demos

0. Preface:

Work reason, to commute my thunder god, one months lost 10 pounds, can't carry, put my Mac on the company.

MAC also bought a PD virtual machine in order to run vs.

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

Download the address you can go to Visual Studio website download, but may be a bit slow, I uploaded Baidu Cloud. The article concludes with a download.

MAC installation has always been very simple, loading mirror, drag into the app can be, here for the care of novice, simple to say the process:

PS: Is enough, write this article, the browser collapsed n times. Rewrite it many times. =_= "

1. Online Installer

Download get visualstudioformacpreviewinstaller.dmg, size 23.9MB, this is the installation program, plainly is installed online.

(the article has a download at the end)

Double-click a mirrored load:

  

Double-click the download icon to pop up an interface you know:

After you accept and continue, you are prompted to check the network link:

Wait 10 seconds or so, the network link error will be prompted:

Anyway, I have been stuck in this error, as if the whole life has been fixed here.

But fortunately, before the installation of the VS2015 ANDROIDSDK, is also the error, so I subconsciously looked for the following. Found a bright spot:

Isn't this the visual Studio for Mac installer?!

Decisive right Key-copy link, paste into the thunderbolt ... Ah, haha.

Then you get the installer, which is 216.3MB altogether. (the article has a download at the end)

2. Install vs Program

After the Thunderbolt download, double-click the load mirror image:

This will know how to get it ~ haha. Drag directly into the applications to complete the installation. Oh.

3. HelloWorld

Click on the Visual Studio startup icon to start running VS, the VS Main program:

Personally feel more good-looking than Xcode, probably because the bottom left corner of the icon, hehe.

Click New Project ... Start a new project.

First of all, a general understanding of the project template inside, probably divided into multiplatform, literal translation should be a Cross-platform project bar:

 

Then there is the. NET Core Project:

And then there's the other one:

You can also click the following language dropdown box to modify the programming language:

  

Nonsense don't say, select Console Project (C #)-Next:

After you enter the project name, solution name, and path, click Create to create it:

Classic interface, with tools on the left, online documentation and unit testing, the right side is the solution, the following is a mistake.

If the above figure code, click to run, automatically open the terminal, display results:

It's kind of interesting to write a classic 99 multiplication table.

This code smart hint is still pretty bull x:

Come on, take one ~

4. Test Ado.net

Look at the project structure in the right solution, which is almost the same as Windows vs.

AssemblyInfo.cs assembly information for the following figure:

We see that there is only one system reference in the console console project.

Let's practice the ado.net, so we need to add a system.data reference.

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

The above is divided into all, Packages, Projects,. NET Assembly.

Where project refers to projects in the current solution,. NET assembly can select a third party component.

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

After you add a reference, you will find that there are two more references in the project reference:

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

Right key Item-ADD File:

Select Misc-application Configuration File and click OK:

Add the Classic link string code to the app.config, this comparison pit, no hint. Can only be knocked by the memory hand.

The code is as follows:

Write the Ado.net Code test ado.net component in the main () method.

Because I link is my server, the database I also can not remember what. So directly connected is the master database, 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 results of the operation are as follows:

Ha ha. I'm a little bit mean, my brother.

5. Test asp.net MVC

The iron is hot, continue to engage.

Right-click Solution to add Project:

Select Other-asp.net MVC Project and click Next Next:

Then configure the project, choose whether to create WEBAPI and unit tests, and then next:

Then configure the project name, path, and so on, and then click Create:

After the completion of the creation, I thought it was over, but a hint was popped up:

In other words, the project needs the following items, you need to click to accept the installation, to finish.

No, Dot Bai, otherwise mvc related things, such as controller and so will not be used.

Click Accept to show adding Packages ... (components are being added):

Wait 10 seconds or so, hint packages successfully added. (Add complete):

Look at the project structure on the right, and the same as our usual project structure.

Controllers is the controller, views is the view, models is the model, scripts is the script, ... Let's not say it.

So, the start is very fast, hehe.

Direct Click to run, look at the effect:

Oh, a little meaning.

To add the user model class in 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 the user array and deposit in the 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=" Katrina ", Email=" katelinna@qq.com "},
 new User () {id=1003, name=" Blind Monk ", email=" Mangseng@qq.com "},
 new User () {id=1004, name=" Moganna ", 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 array information that you just saved:

@if (viewbag.users==null)
 {
 <p> no information available. </p>
 }
 else
 {
 <table>
 <thead>
 <tr>
 <th> # </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 to run:

Oh, my xxxx. Open views/shared/layout.cshtml, sure enough, set the encoding format and add meta modifications as follows:

<! DOCTYPE html>
  
 

Run again:

OK, finish the job ~

5. Software download

Visual Studio for Mac Preview installer.dmg Link: https://pan.baidu.com/s/1miwKtW8 Password: ivtu

Visual Studio for Mac Preview1 7.0.0.347.dmg Link: https://pan.baidu.com/s/1boNkTor Password: nu5x

6. End

Haha, to this, the case is finished, feeling good.

Just a little bit, it seems that there is no form application ...

OK, you can play on your own, what are the questions below we communicate and exchange feelings. Ha ha.

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.