我怎样才能在 C# 中用单声道制作一个在 Windows 上编码的程序,能够在 linux 上工作?

How can i make a Program coded on Windows in C# with mono, able to work on linux?

如何在 C# 中用单声道制作一个在 Windows 上编码的程序,能够在 linux 上工作?

如果我在 linux 开始我的程序,我会得到:http://pastebin.com/YdnAk7nD。 也许是我的代码有问题?:

using System;
using Tweetinvi;
using System.Threading;

namespace TwitterBot
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            Console.WriteLine ("Bot started");

            TwitterCredentials.SetCredentials("*****");

            var loggedUser = User.GetLoggedUser();
            var settings = loggedUser.GetAccountSettings();

            int i = 1;
            int fails = 0;
            while (true) {
                var user = User.GetUserFromId (i);
                i++;

                if (user != null) {
                    loggedUser.FollowUser (user);
                    Console.WriteLine ("Now following: " + user.Name);
                } else {
                    Console.WriteLine("Can not follow user with id: " + i);
                    fails++;
                }

                if (fails >= 100) {
                    fails = 0;
                    Console.WriteLine ("Sleep for 5 minutes");
                    Thread.Sleep (1000 * 60 * 5);
                    Console.WriteLine ("Woken up after 5 minutes");

                }
            }

        }
    }
}

Tweetinvi 使用 AutoFac 3.*.

AutoFac (portable library) does not work on mono

您可以尝试获取 Tweetinvi 的源代码并针对 AutoFact for .NET 4(非便携式版本)编译它并改用它。

Tweetinvi 在 4.5 版本之后应该可以与 Mono 一起使用。能否请您检查一下您安装的 Mono 版本?