簡體   English   中英

我如何制作一個可以在Linux上使用Mono的C#在Windows上編碼的程序?

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

我如何制作一個可以在Linux上使用Mono的C#Windows上編寫的程序?

如果我在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(便攜式庫)不適用於單聲道

您可以嘗試獲取Tweetinvi的源代碼,並針對.NET 4(非便攜式版本)針對AutoFact對其進行編譯,然后改用它。

Tweetinvi應該在4.5版之后與Mono合作。 您能檢查一下已安裝的Mono版本嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM