2013-07-24 54 views
2

對不起,我的英語。 我開始學習開發Windows應用商店應用。我找到了一個教程here。我遵循它,創建一個新的Javascript Windows應用商店應用程序。但是,當我建立我的應用程序,將沒有添加代碼,JSHint顯示我的錯誤這樣的:「'WinJS'未定義。」和「Windows」沒有定義。「

'WinJS' is not defined. 
'Windows' is not defined 

還有就是我default.html中

<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="utf-8" /> 
    <title>SimpleChanel9Reader</title> 

    <!-- WinJS references --> 
    <link href="//Microsoft.WinJS.1.0/css/ui-dark.css" rel="stylesheet" /> 
    <script src="//Microsoft.WinJS.1.0/js/base.js"></script> 
    <script src="//Microsoft.WinJS.1.0/js/ui.js"></script> 

    <!-- SimpleChanel9Reader references --> 
    <link href="/css/default.css" rel="stylesheet" /> 
    <script src="/js/default.js"></script> 
</head> 
<body> 
    <div id="main"> 
     <header id="banner"> 
      <button id="backbutton" class="win-backbutton"></button> 
      <h1 id="maintitle" class="win-title">Welcome to Chanel9</h1> 
     </header> 
     <section id="content"></section> 
    </div> 
</body> 
</html> 

而且default.js

// For an introduction to the Blank template, see the following documentation: 
// http://go.microsoft.com/fwlink/?LinkId=232509 
(function() { 
    "use strict"; 
    WinJS.Binding.optimizeBindingReferences = true; 

    var app = WinJS.Application; 
    var activation = Windows.ApplicationModel.Activation; 

    app.onactivated = function (args) { 
     if (args.detail.kind === activation.ActivationKind.launch) { 
      if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { 
       // TODO: This application has been newly launched. Initialize 
       // your application here. 
      } else { 
       // TODO: This application has been reactivated from suspension. 
       // Restore application state here. 
      } 
      args.setPromise(WinJS.UI.processAll()); 
     } 
    }; 

    app.oncheckpoint = function (args) { 
     // TODO: This application is about to be suspended. Save any state 
     // that needs to persist across suspensions here. You might use the 
     // WinJS.Application.sessionState object, which is automatically 
     // saved and restored across suspension. If you need to complete an 
     // asynchronous operation before your application is suspended, call 
     // args.setPromise(). 
    }; 

    app.start(); 
})(); 

有一些關於我的Visual Studio的信息

Microsoft Visual Studio Ultimate 2012 
Version 11.0.50727.1 RTMREL 
Microsoft .NET Framework 
Version 4.5.50709 

Installed Version: Ultimate 

Architecture and Modeling Tools 04940-004-0039002-02068 
Microsoft Architecture and Modeling Tools 

UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries. 

LightSwitch for Visual Studio 2012 04940-004-0039002-02068 
Microsoft LightSwitch for Visual Studio 2012 

Office Developer Tools 04940-004-0039002-02068 
Microsoft Office Developer Tools 

Team Explorer for Visual Studio 2012 04940-004-0039002-02068 
Microsoft Team Explorer for Visual Studio 2012 

Visual Basic 2012 04940-004-0039002-02068 
Microsoft Visual Basic 2012 

Visual C# 2012 04940-004-0039002-02068 
Microsoft Visual C# 2012 

Visual C++ 2012 04940-004-0039002-02068 
Microsoft Visual C++ 2012 

Visual F# 2012 04940-004-0039002-02068 
Microsoft Visual F# 2012 

Visual Studio 2012 Code Analysis Spell Checker 04940-004-0039002-02068 
Microsoft® Visual Studio® 2012 Code Analysis Spell Checker 

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved. 

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved. 

Visual Studio 2012 SharePoint Developer Tools 04940-004-0039002-02068 
Microsoft Visual Studio 2012 SharePoint Developer Tools 

BraceCompleter 1.0 
Automatically inserts closing braces after typing an open brace and pressing Enter. 

CodeMaid #114 
CodeMaid is an open source Visual Studio extension to cleanup, dig through and simplify our C#, C++, F#, VB, XAML, XML, ASP, HTML, CSS and JavaScript coding. 

Written by Steve Cadwallader, for more information visit http://www.codemaid.net/ 

jslint.VS2012 1.0 
Adds JSLlint support into Visual Studio 

NuGet Package Manager 2.0.30625.9003 
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/. 

PreEmptive Analytics Visualizer 1.0 
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product. 

SQL Server Data Tools 11.1.20627.00 
Microsoft SQL Server Data Tools 

Visual Studio 11 Editor Extension 1.0 
Information about my package 

VSCommands11 11.0 
VSCommands 11 

Web Developer Tools 1.0.30710.0 
Microsoft Web Developer Tools contains the following components: 
Page Inspector: Tool that offers an efficient way to decompose Web Applications and diagnose front-end issues. 
Web Publishing: Extensions required for Web Publishing for both hosted servers as well as on premises. 
Web Form Templates: Includes the default templates for Web Form Applications. 
Editor Extensions: Includes HTML, CSS, and JS editor extensions that greatly enhance the development experience. 

ZenCoding 0.7 
Danny Zen Coding is a visual studio plugin for high-speed HTML, XML, XSL (or any other structured code format) coding and editing. 

請幫助我,當我構建每個Javascript Windows應用商店應用時出現此錯誤。

+0

聽起來像VS無法找到WinJS SDK。你可以在解決方案資源管理器的「參考」部分看到它嗎? –

+0

是的,它有,我檢查解決方案中的所有文件和目錄 –

+0

Tieu,你發現是什麼導致了這個問題?我正在使用的Win8項目中遇到過同樣的消息。 – ariestav

回答

0

嘗試通過的NuGet添加它:「安裝,包WinJS」

這將確保它被安裝在溶液中。

相關問題