2

私の英語でごめんなさい。Windows ストア アプリの開発を学び始めました。そして、ここでチュートリアルを見つけました。それに従って、新しい Javascript Windows ストア アプリを作成します。しかし、コードを追加せずにアプリをビルドすると、JSHint は次のようなエラーを表示します。

'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 ストア アプリをビルドすると、このエラーが発生します。

4

1 に答える 1

0

NuGet 経由で追加してみてください: "Install-Package WinJS"

これにより、ソリューションに確実にインストールされます。

于 2016-07-12T05:11:36.020 に答える