2013-07-19 51 views
0

我啓動Visual Studio 2012的Win8,選擇C#爲新建項目,Windows運行時組件,然後乾脆當我輸入"cw+TAB+TAB" to print "Console.WriteLine();"目標框架場死

出現這條線:global::System.Console.WriteLine();我的代碼如下:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 

namespace WindowsRuntimeComponent1 
{ 
    public sealed class Class1 
    { 
     global::System.Console.WriteLine(); 
    } 
} 

以下錯誤出現:

Error 1 Invalid token '(' in class, struct, or interface member declaration" , 
Error 2 The type or namespace name 'Console' does not exist in the namespace 'System' (are you missing an assembly 

對這些錯誤的答案都是一樣的在線:我有滾動」 .NetFrame工作「返回形式4.5到4.0 - 但是,當我去解決方案資源管理器的屬性,目標框架是空白和禁用。我無法做任何改變,所以我該如何解決這個問題?

錯誤的解決方案可能不僅僅是改變.NET Framework,隨意分享你對這個問題的所有了解。

+0

Win8應用程序的運行時間不同於普通的.net應用程序。如果你想使用'Console',你可能想使用一個運行CLR的版本。 –

回答

0

微軟的Visual Studio 2012,至少Express版本(沒有試過臨+),船舶在多個版本 - Microsoft Visual Studio 2012 for Windows 8是專門針對建築的Win8應用程序(這些Windows應用商店應用,以前被稱爲「新城」的應用程序)。 Win8應用程序的運行時間不同於CLR,並且在早期的框架版本中不存在,因此阻止的目標框架下拉列表。

如果您正在尋找允許您構建WinForms,WPF和控制檯應用程序的「傳統」IDE,則需要Microsoft Visual Studio 2012 for Desktop

如果您正在尋找Web開發,您需要Microsoft Visual Studio 2012 for Web

+0

謝謝!我覺得這很有幫助! – user2600978