在 Mac 和 Windows 上打开相同的 .NET Core 解决方案 [英] Opening the same .NET Core solution on both Mac and Windows

查看:34
本文介绍了在 Mac 和 Windows 上打开相同的 .NET Core 解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到在 Visual Studio 2015 中创建的 .NET Core 项目与在 Mac 中使用 dotnet new 创建的 .NET Core 项目之间存在差异.

考虑到 VS Code 显然与 VS 2015 不同,是否可以同时使用 Mac 和 Windows 机器处理相同的 .NET Core 解决方案,或者由于 .sln 和VS 2015 需要 .xproj 吗?

解决方案

这应该没问题!我已经使用 Visual Studio 2015 在 Windows 上成功启动了 .NET Core 项目,并使用 Visual Studio Code 1.3+ 在我的 Mac 上继续它们.

Visual Studio 添加了诸如 .sln.xproj 之类的额外文件,但 Visual Studio Code 会很乐意忽略它们.我唯一需要做的就是让 Visual Studio Code 识别我的解决方案:

  • 我首先必须单击状态栏中的提示才能启用 C# 支持.一旦我这样做了,它就会识别出我的解决方案中的所有项目.

    I've noticed differences between a .NET Core project created in Visual Studio 2015 and a .NET Core project created using dotnet new in Mac.

    Considering that VS Code is obviously not the same than VS 2015, is it possible to work on the same .NET Core solution using both a Mac and a Windows machine or are the solutions/projects fundamentally different due to the .sln and .xproj needed in VS 2015?

    解决方案

    This should work fine! I've successfully started .NET Core projects on Windows with Visual Studio 2015 and continued them on my Mac with Visual Studio Code 1.3+.

    Visual Studio adds extra files like .sln and .xproj, but Visual Studio Code will happily ignore them. The only thing I had to do to get Visual Studio Code to recognize my solution was:

    • Install the C# extension from Microsoft
    • Open the root solution folder in Visual Studio Code
    • Open a code file somewhere in the project and check the lower-right status bar:

    I first had to click a prompt in the status bar to enable C# support. Once I did that, it recognized all the projects in my solution.

    这篇关于在 Mac 和 Windows 上打开相同的 .NET Core 解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆