I am starting to learn web development using Microsoft WebMatrix 3. I'm using the book Introducing Microsoft WebMatrix, which targets an earlier version, but a lot of things are the same. I'm getting compilation errors when I attempt to use the Microsoft ASP.NET Web Helpers Library, though, and I don't know why or how to troubleshoot the issue. Specifically, I am getting compiler error CS0103 when attempting to use the Video object or the LinkShare object. I've been searching the Internet for days, and I can't find anyone that has had the same issue and resolved it.
Steps to Reproduce the Error
- Run WebMatrix 3.
- On the Quick Start page, click New, then Template Gallery.
- Select Empty Site, and click Next. A new site named "Empty Site" is created.
- Open the Default.cshtml page for editing.
- Based on the tutorial Displaying Video in an ASP.NET Web Pages (Razor) Site, add the following to the body of the page:
@Video.MediaPlayer(path: "myvideo.wmv", width: "400", height: "600", autoStart: true, playCount: 2, uiMode: "full", stretchToFit: true, enableContextMenu: true, mute: false, volume: 75) - Run the site. An error page appears in the browser with the following statement:
"Compiler Error Message: CS0103: The name 'Video' does not exist in the current context"
Fair enough. I'll use NuGet to obtain the Microsoft Web Helper Library. - Back in the WebMatrix window, click NuGet.
- Select the WebMatrix Package Source.
The following error message appears:The schema version of 'Microsoft.AspNet.WebPages' is incompatible with version 2.5.40416.9020 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942.
Click OK to ignore the error and continue. I tried going to that website and following the instructions, but I already have the latest version of NuGet for WebMatrix. - Type
Web Helpersin the search box and press Enter. - Select "ASP.NET Web Helpers Library" and click Install. Confirm the installation and accept the EULA. The same error regarding the schema version of 'Microsoft.AspNet.WebPages' appears. Click OK to ignore the error.
- Click Close to exit the NuGet Gallery, and click OK to close any remaining error windows.
- Run the site. The same error message as before appears.
This demonstrates the error with the Video object, and I am also receiving the same error when I attempt to use the LinkShare object.
Environment Information
- OS: Windows 8.1 Pro with Media Center Version 6.3 (Build 9600)
- Browser: Internet Explorer 11.0.9600.16476; Update Versions: 11.0.2 (KB2898785)
- WebMatrix Version 3.0 Version Information:
- WebMatrix: 7.1.1932.0
- IIS Express: 8.0.8418.0
- .NET Framework: 4.0.30319.34003 built by: FX45W81RTMGDR
- Web Deploy: 7.1.1762.0
- Web Platform Installer: 7.1.40719.0
- ASP.NET Web Pages: 2.0.20715.0
Project Information
The following packages are shown under Empty Site → App_Data → packages:
- Microsoft.AspNet.Razor.2.0.20715.0
- Microsoft.AspNet.WebPages.2.0.20710.0
- Microsoft.AspNet.WebPages.Data.2.0.20710.0
- Microsoft.AspNet.WebPages.WebData.2.0.20710.0
- Microsoft.Web.Infrastructure.1.0.0.0
- microsoft-web-helpers.2.1.20710.2 ← added by NuGet
The following DLLs are shown under Empty Site → bin:
- Microsoft.Web.Helpers.dll ← added by NuGet
- Microsoft.Web.Infrastructure.dll
- System.Web.Helpers.dll
- System.Web.Razor.dll
- System.Web.WebPages.Deployment.dll
- System.Web.WebPages.dll
- System.Web.WebPages.Razor.dll
- WebMatrix.Data.dll
- WebMatrix.WebData.dll
Summary
I'm getting the CS0103 compiler error when attempting to use the Video object or the LinkShare object from the ASP.NET Web Helpers library. It's clear that the compiler is not locating definitions for the objects I am trying to use, but I do not know why, and as a WebMatrix beginner, I don't know how to figure out why. In Visual Studio, this error would indicate that I am probably missing a reference in the project, but everything seems to be present in the project in WebMatrix, and nothing seems to be missing from the command line shown on the error page.