2016-03-04 80 views
0

我按照「http://dotnet.github.io/getting-started/」上的說明在ubuntu.14.04-x64上安裝了Dotnet。然後我寫了線程一個簡單的代碼,dotnet ubuntu14.04錯誤CS0246:無法找到類型或命名空間名稱'Thread'

using System; 
using System.Threading; 

namespace mythread 
{ 
public class threader 
{ 
    public static void thread1() 
    { 
     for (int i = 0; i < 10; i++) 
     { 
      Console.WriteLine("Thread1 value: {0}.", i); 
     } 
    } 
    public static void thread2() 
    { 
     for (int j = 0; j < 10; ++j) 
     { 
      Console.WriteLine("Thread2 value: {0}.", j); 
     } 
    } 
} 

public class class1 
{ 
    public static void Main() 
    { 
    ThreadStart t1 = new ThreadStart(threader.thread1); 
    ThreadStart t2 = new ThreadStart(threader.thread2); 
    Thread tr1 = new Thread(t1); 
    Thread tr2 = new Thread(t2); 
    tr1.Start(); 
    tr2.Start(); 
    } 
} 
} 

運行此代碼我收到錯誤 「錯誤CS0246後:類型或命名空間名稱‘主題’找不到(是否缺少using指令或一個彙編參考?)「。 任何人都可以幫我解決它嗎?

我project.json是提前

{ 
    "version": "1.0.0-*", 
    "compilationOptions": { 
     "emitEntryPoint": true 
    }, 

    "dependencies": { 
     "NETStandard.Library": "1.0.0-rc2-23811" 
    }, 

    "frameworks": { 
     "dnxcore50": { 
      "dependencies": { 
     "System.Threading": "4.0.11-rc2-23811", 
     "System.Threading.Tasks": "4.0.11-rc2-23811" 
      } 
     } 
    }, 
    "configurations": { 
    "Debug": { 
     "compilationOptions": { 
     "define": ["DEBUG", "TRACE"] 
     } 
    }, 
    "Release": { 
     "compilationOptions": { 
     "define": ["RELEASE", "TRACE"], 
     "optimize": true 
     } 
    } 
    } 
} 

感謝。

+0

System.Threading.Thread參考對於任何人想知道如何版本組件和包。 「看看這個軟件包的myget dev feed:https://dotnet.myget.org/gallery/dotnet-core。關於這是如何做的更多文檔將作爲https://github.com/的一部分發布。 DOTNET/corefx /問題/ 5453「。 – Dhananjay

回答

1

您需要project.json

+0

工作,謝謝你。 – Dhananjay

相關問題