简体   繁体   English

我如何制作一个可以在Linux上使用Mono的C#在Windows上编码的程序?

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

How can i make a Program coded on Windows in C# with mono, able to work on linux ? 我如何制作一个可以在Linux上使用Mono的C#Windows上编写的程序?

If i start my Program on linux, i get this: http://pastebin.com/YdnAk7nD . 如果我在Linux上启动我的程序,则会得到以下信息: http : //pastebin.com/YdnAk7nD Maybe its a problem with my code ?: 也许是我的代码有问题?:

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 uses AutoFac 3.*. Tweetinvi使用AutoFac 3. *。

AutoFac (portable library) does not work on mono AutoFac(便携式库)不适用于单声道

You could try to get source code for Tweetinvi and compile it against AutoFact for .NET 4 (not portable version) and use it instead. 您可以尝试获取Tweetinvi的源代码,并针对.NET 4(非便携式版本)针对AutoFact对其进行编译,然后改用它。

Tweetinvi should work with Mono after the version 4.5. Tweetinvi应该在4.5版之后与Mono合作。 Could you please check the version of Mono you've installed? 您能检查一下已安装的Mono版本吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM