C# 使用 Visual Studio 开发单声道应用程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/802605/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 01:48:10  来源:igfitidea点击:

Using visual studio for developing mono applications

c#visual-studiovisual-studio-2008mono

提问by Josh

How do I use Visual Studio to develop applications on Mono? Is this possible?

如何使用 Visual Studio 在 Mono 上开发应用程序?这可能吗?

采纳答案by Jon Skeet

You just build the applications in Visual Studio, and run them under Mono instead of under .NET. The binaries should be compatible... but you'll need to make sure you don't use any libraries which aren't available in Mono - see the Mono Application Compatibility Guidelines.

您只需在 Visual Studio 中构建应用程序,然后在 Mono 下而不是在 .NET 下运行它们。二进制文件应该是兼容的……但是您需要确保不使用 Mono 中不可用的任何库 - 请参阅Mono Application Compatibility Guidelines

(According to that page, you need to turn off incremental builds in Visual Studio though - a point I wasn't aware of before :)

(根据该页面,您需要关闭 Visual Studio 中的增量构建 - 我以前不知道这一点:)

回答by Sam Cogan

See thisarticle on how to run your apps while targeting the mono framework from VS.

请参阅文章对如何瞄准目标的同时,从VS.单框架上运行你的应用程序

回答by Anton Gogolev

Miguel has posted this entrya while ago, so it's quite dated. You can also try thisand this(all hail Web Archive!)

Miguel不久前发布了这个条目,所以它已经过时了。你也可以试试这个这个(所有的网页存档都好!)

回答by Piotr Zurek

Since version 2.0 MonoDevelop supports VisualStudio project/solutions file format. This means that you can use the same code base on Windows with VS and .Net and on Linux with MonoDevelop and Mono. That in my opinion is the best way to go about it. There are no major reasons to run application in Mono on Windows, other than for testing purposes and for that I'd rather set up a virtual machine to test the software in native environment.

从版本 2.0 MonoDevelop 开始支持 VisualStudio 项目/解决方案文件格式。这意味着您可以在带有 VS 和 .Net 的 Windows 以及带有 MonoDevelop 和 Mono 的 Linux 上使用相同的代码库。在我看来,这是最好的方法。除了出于测试目的之外,没有什么主要原因可以在 Windows 上的 Mono 中运行应用程序,为此我宁愿设置一个虚拟机来在本机环境中测试软件。

回答by Greg Hurlman

I've posted an article on how to integrate Mono 2.8 (the build for .Net 4.0) into Visual Studio 2010 here- there's a link there to another profile built for Mono 2.4 (.Net 3.5) if that's what you're aiming for.

我在这里发布了一篇关于如何将 Mono 2.8(.Net 4.0 的构建)集成到 Visual Studio 2010 中的文章- 如果这是您的目标,这里有一个指向另一个为 Mono 2.4(.Net 3.5)构建的配置文件的链接.

You can integrate the new Mono 2.8 profile with 3 simple steps:

您可以通过 3 个简单的步骤集成新的 Mono 2.8 配置文件:

  1. Download the profile itself from here.
  2. Unzip the contents of the profile Zip to one of the following directories:

    • 32-bit systems: C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile
    • 64-bit systems: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile
  3. The "Mono" folder in the ZIP should be directly under the "Profile" directory.

  4. Restart Visual Studio if it had been running, open the properties of the project you want to use with Mono, and select the Mono Profile for 2.8:

  1. 这里下载配置文件本身。
  2. 将配置文件 Zip 的内容解压缩到以下目录之一:

    • 32位系统: C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile
    • 64-bit systems: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile
  3. ZIP 中的“Mono”文件夹应直接位于“Profile”目录下。

  4. 如果 Visual Studio 一直在运行,则重新启动它,打开要与 Mono 一起使用的项目的属性,然后选择 Mono Profile for 2.8:

Note:You will not be able to select the Mono Profile straight from the New Project dialog box; for some reason, that list of profiles doesn't match. Create your project as a .Net Framework 4.0 project first, and after creation set the project properties to Mono.

注意:您将无法直接从 New Project 对话框中选择 Mono Profile;出于某种原因,该配置文件列表不匹配。首先将项目创建为 .Net Framework 4.0 项目,创建后将项目属性设置为 Mono。

If you've upgraded your MonoDevelop install to the latest version (as of today, anyway), this Visual Studio solution & Project file will open with no problem - no changes required at all.

如果您已将 MonoDevelop 安装升级到最新版本(无论如何,截至今天),此 Visual Studio 解决方案和项目文件将毫无问题地打开 - 根本不需要更改。

If you encounter the problem that you need .NETFramework,Version=v4.0,Profile=Monoin order to run the application, the trick was to create registry key.

如果您遇到.NETFramework,Version=v4.0,Profile=Mono运行应用程序所需的问题,诀窍就是创建注册表项。

For running Windows 7 x64, it was: HKEY\_LOCAL\_MACHINESOFTWAREWow6432NodeMicrosoft .NETFrameworkv4.0.30319SKUs .NETFramework,Version=v4.0,Profile=Mono

对于运行Windows 7 x64,它是:HKEY\_LOCAL\_MACHINESOFTWAREWow6432NodeMicrosoft .NETFrameworkv4.0.30319SKUs .NETFramework,Version=v4.0,Profile=Mono

I suppose for x86it's HKEY\_LOCAL\_MACHINESOFTWAREMicrosoft.NETFramework v4.0.30319SKUs.NETFramework,Version=v4.0,Profile=Mono

我想x86HKEY\_LOCAL\_MACHINESOFTWAREMicrosoft.NETFramework v4.0.30319SKUs.NETFramework,Version=v4.0,Profile=Mono

(Where v4.0.30319 would be the version of the current 4.0 framework installed.)

(其中 v4.0.30319 将是当前安装的 4.0 框架的版本。)

回答by Fab

Yes, you can develop on Visual Studio and target Mono (Mono for x86).

是的,您可以在 Visual Studio 上开发并针对 Mono(x86 的 Mono)。

Here is an answerI made on all the available possible alternative to compile against Mono on Windows. However, it's focused for Mono x86. As a summary, let's list the possible choice for VS development:

这是我对在 Windows 上针对Mono进行编译的所有可用替代方案的答案。但是,它专注于Mono x86。作为总结,让我们列出 VS 开发的可能选择:

  • MonoHelper addin
  • Mono Profile
  • MonoHelper 插件
  • 单声道配置文件

For Android/Ios, you can also cross-compile and debug inside Visual Studiowith Xamarin addin. Although it's not free for commercial huge applications, there a free version available to make small ones.

对于Android/Ios,您还可以在Visual Studio 中使用Xamarin 插件进行交叉编译和调试。虽然它对于商业大型应用程序不是免费的,但有一个免费版本可用于制作小型应用程序。

Note:For those who wonder why in the world I would like to develop in Visual Studio on Windows, instead of MonoDevelop on Unix, let say that developer experience in MonoDevelop does not compare to VS one (especially when it comes to debugger/refactoring, the last due more to Resharper than to VS itself).

注意:对于那些想知道为什么我想在 Windows 上的 Visual Studio 中进行开发而不是在 Unix 上的 MonoDevelop 中进行开发的人来说,可以说 MonoDevelop 中的开发人员体验无法与 VS 相比(尤其是在调试器/重构方面,最后一个归因于 Resharper 而不是 VS 本身)。