Visual Studio for Mac: studiomac

Source: Internet
Author: User
Tags vmware fusion

Visual Studio for Mac: studiomac

Your favorite IDE is now available for Mac. Because Visual Studio Code for Mac was available before Visual Studio for Mac, we thought Visual Studio Code was a cross-platform version of Visual Studio, but Microsoft didn't think so, compared with Visual Studio, Visual Studio Code is too simplified. Visual Studio Code for enterprise-level application development is still insufficient. Therefore, Visual Studio for Mac is born, and Visual Studio for Linux will not be available in the future.

In Mac. NET development, I now Installed VMware Fusion, and then installed Windows 10 in the virtual machine, Visual Studio 2017 in Windows 10, of course, Windows 10 only installed. NET software development programs, if you want to install or QQ in Windows 10, you are recommended to change the Mac system to Windows 10, my principle is that Windows 10 only write code, other things are done on Mac, but even so, as long as the virtual machine is turned on and then two Visual Studio 2017 s are opened, the Mac heat sink fan is always "buzzing, even if the VM memory is 8 GB and the CPU has four cores, it will not help.

Of course, if the. NET development program is relatively simple, or a Code-only project, there is no need to install a virtual machine, you can use Visual Studio Code for Mac or other editors.

Of course, if Mac can complete. NET development, it will be perfect. So, install Visual Studio for Mac ~

The installation procedure is as follows:

Note: If the above "cannot connect to the network" error occurs, the network needs to go beyond the Wall.

Note: You need to select the content to be installed. If you do not select mobile development, you only need to select. NET Core and 4.31 MB (I chose this)

Note: After I select the installation content, click "Install" to suddenly kill, and then exit the program and re-install it. The above error occurs. I thought the installation failed, at the end of the installation, you can install it again. It's strange that if you encounter some errors, you just need to install it several more times.

Note: If the above error occurs during installation, click "retry". If the problem persists, click it again.

After installation, we use the actual project IdentityServer4.Demo to test whether Visual Studio for Mac is available? What is the user experience? Can enterprise-level development be performed?

Start with Visual Studio for MacIdentityServer4.Demo.slnIf the problem persists, the following error is reported:

Error message: not found.xprojType of project files.

Then go to the project folder to find.xprojType project file, not found, only.csprojType project file:

Open it in NotepadIdentityServer4.Demo.slnSolution:

Copy codeThe Code is as follows:...Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{22BD0651-0313-496F-865B-9D6D94CB9407}"EndProjectProject("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3FDA3CFF-E411-4166-A98C-42E1E5B252E3}"EndProjectProject("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ClientCredentialsAndPassword.Web", "ClientCredentialsAndPassword.Web\ClientCredentialsAndPassword.Web.xproj", "{6BB34F8C-B0D7-4128-8DB9-9494591C0F94}"EndProjectProject("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "APISource.Web", "APISource.Web\APISource.Web.xproj", "{F4980DEB-57D3-4C7F-ADBF-7A9F01ED94B8}"EndProjectProject("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ClientCredentialsAndPassword.Web.Tests", "ClientCredentialsAndPassword.Web.Tests\ClientCredentialsAndPassword.Web.Tests.xproj", "{6BB31592-9DC2-4BE7-8E77-8ECED21040F4}"EndProjectProject("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ImplicitServer.Web", "ImplicitServer.Web\ImplicitServer.Web.xproj", "{118DE163-7D76-488F-BB99-F494101898D1}"EndProject...

IdentityServer4.Demo.slnIn the solution file.xprojType file.

IdentityServer4.Demo.slnThe solution can be opened with Visual Studio 2017, but why cannot Visual Studio for Mac be opened? Why? And why?IdentityServer4.Demo.slnIs the file type in the solution different from the actual file type?

The reason is that starting from the creation of the IdentityServer4.Demo project, IdentityServer4.Demo used Visual Studio 2015 to create the. NET Core project. At that time, the project package management usedproject.jsonFile. The project file is.xprojLater, I installed Visual Studio 2017 and the project was automatically upgraded,project.json/.xprojChanged.csprojMicrosoft changed all project file extensions.csproj(For details, see project. json in. NET Core .).xprojChange.csprojBut only enables Visual Studio 2017 to be compatible (why not replace all of them? A bit pitfall ~).

Visual Studio for Mac cannot be compatible with Visual Studio 2017. What should I do? We can only manuallyIdentityServer4.Demo.slnIn the solution file.xprojChange.csproj.

Use Visual Studio for Mac to open it againIdentityServer4.Demo.slnSolution, after a period of timenuget restoreThen you can:

There is an exclamation point next to each project (not captured), and the message is displayed:

Project not built in active configuration

The reason is that the latest. NET Core SDK version is not installed. You can reinstall the latest version.

Reference: Project not build in active configuration Visual Studio MacOS. net Core

I suddenly found that Visual Studio for Mac was available a long time ago, but it was called Visual Studio MacOS and a test version. I thought that Visual Studio for Mac was only available today, and it seems that it is really ignorant.

Recompile the entire solution and find an error (IdentityServer4.Demo is successful, but I failed to try other projects. For demonstration, I manually added the code ):

Error details:

/Library/Frameworks/Mono. framework/Versions/5.0.0/lib/mono/msbuild/15.0/bin/Sdks/Microsoft. NET. sdk/build/Microsoft.NET.Sdk.DefaultItems.tar gets (5, 5): Error: Contains repeated "Content" items .. . Net sdk includes the "Content" item in your project by default. You can delete these items from the project file, or set the "EnableDefaultContentItems" attribute to "false" if you want to display them in the project file ". Repeated items: 'properties/launchSettings. json' (ImplicitServer. Web. Tests)

From the above we can see the cause of the error,. net sdk by default containsContentItem, we can.csprojFileContentRemove include items as follows:

<ItemGroup> <Content Include="Properties\launchSettings.json" /></ItemGroup>

Recompile the solution and Build Successful:

Right-click the project and select "Run Item", or select "Run-Restart Without Debugging" in the menu bar to start the project.

The Debugging project is also very simple. On the menu bar, select "Run-Restart Debugging" To Set breakpoint Debugging:

In addition, it is quite comfortable to write code in Visual Studio for Mac, which is not very different from Visual Studio 2017. Smart Tips are perfect, and even some shortcut keys are supported, such as inputifPost-PressTabKey to expand the code.

Set Nuget Source in Visual Studio for Mac:

Open the Mac terminal command from the current project directory:

Visual Studio for Mac also has a poor experience, such:

Some icons are too small to be clear (for examplegitProject or file change icons are some of the above, but it is difficult to find out, there are some tool icons, etc.) some buttons and Tab switching experience is very poor, very stiff feeling, but it is good to use it. It can be optimized later. Poor compatibility. For example, the error mentioned above, the IdentityServer4.Demo project is available, but I have tried some practical work projects, and there are still some problems to open and use. The unit test project cannot be opened (xUnit), for example.

Maybe there are still some issues that haven't been found, but I think Visual Studio for Mac can be used for development (enterprise development, not self-developed ), after all, it is performed in Mac. NET Core development is quite cool, but Microsoft is mainly engaged in mobile development on this version of Visual Studio for Mac (which can be seen in promotional articles and installation options ),. NET Core service development may have some problems, but it will certainly be improved later. You can use it first, but it is just a pitfall problem.

The above is the preliminary experience of Visual Studio for Mac, which is introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.