Can you please tell me why I am getting an error? Server Error in \'/Scaffld\' A
ID: 3882338 • Letter: C
Question
Can you please tell me why I am getting an error?
Server Error in '/Scaffld' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'MVCDemo' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 27:
Line 28:
Line 29: public class _Page_Views_Home_Edit_cshtml : System.Web.Mvc.WebViewPage<MVCDemo.Models.Employee> {
Line 30:
Line 31: #line hidden
Source File: c:WindowsMicrosoft.NETFramework4.0.30319Temporary ASP.NET Filesscaffldcc97fe4692cadddfApp_Web_edit.cshtml.a8d08dba.aontqujh.0.cs Line: 29
Show Detailed Compiler Output:
c:windowssystem32inetsrv> "C:WindowsMicrosoft.NETFramework4.0.30319csc.exe" /t:library /utf8output /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Data.DataSetExtensions4.0_4.0.0.0__b77a5c561934e089System.Data.DataSetExtensions.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Core4.0_4.0.0.0__b77a5c561934e089System.Core.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.ServiceModel4.0_4.0.0.0__b77a5c561934e089System.ServiceModel.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Drawing4.0_4.0.0.0__b03f5f7f11d50a3aSystem.Drawing.dll" /R:"C:WindowsMicrosoft.NETFramework4.0.30319mscorlib.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.ServiceModel.Web4.0_4.0.0.0__31bf3856ad364e35System.ServiceModel.Web.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.ServiceModel.Activities4.0_4.0.0.0__31bf3856ad364e35System.ServiceModel.Activities.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.ComponentModel.DataAnnotations4.0_4.0.0.0__31bf3856ad364e35System.ComponentModel.DataAnnotations.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_32System.EnterpriseServices4.0_4.0.0.0__b03f5f7f11d50a3aSystem.EnterpriseServices.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Web.DynamicData4.0_4.0.0.0__31bf3856ad364e35System.Web.DynamicData.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Xml.Linq4.0_4.0.0.0__b77a5c561934e089System.Xml.Linq.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Configuration4.0_4.0.0.0__b03f5f7f11d50a3aSystem.Configuration.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Web.WebPages.Deployment4.0_1.0.0.0__31bf3856ad364e35System.Web.WebPages.Deployment.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Web.ApplicationServices4.0_4.0.0.0__31bf3856ad364e35System.Web.ApplicationServices.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Web.WebPages4.0_2.0.0.0__31bf3856ad364e35System.Web.WebPages.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILMicrosoft.CSharp4.0_4.0.0.0__b03f5f7f11d50a3aMicrosoft.CSharp.dll" /R:"C:WindowsMicrosoft.NETFramework4.0.30319Temporary ASP.NET Filesscaffldcc97fe4692cadddfssemblydl3903a0c7ec971a1c4_e528d301System.Web.Http.WebHost.DLL" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.ServiceModel.Activation4.0_4.0.0.0__31bf3856ad364e35System.ServiceModel.Activation.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Runtime.Serialization4.0_4.0.0.0__b77a5c561934e089System.Runtime.Serialization.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Web.Helpers4.0_2.0.0.0__31bf3856ad364e35System.Web.Helpers.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Web.Mvc4.0_4.0.0.0__31bf3856ad364e35System.Web.Mvc.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_32System.Data4.0_4.0.0.0__b77a5c561934e089System.Data.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem4.0_4.0.0.0__b77a5c561934e089System.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.WorkflowServices4.0_4.0.0.0__31bf3856ad364e35System.WorkflowServices.dll" /R:"C:WindowsMicrosoft.NETFramework4.0.30319Temporary ASP.NET Filesscaffldcc97fe4692cadddfApp_global.asax.vmzfjits.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_32System.Web4.0_4.0.0.0__b03f5f7f11d50a3aSystem.Web.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Web.Services4.0_4.0.0.0__b03f5f7f11d50a3aSystem.Web.Services.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Activities4.0_4.0.0.0__31bf3856ad364e35System.Activities.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Web.WebPages.Razor4.0_2.0.0.0__31bf3856ad364e35System.Web.WebPages.Razor.dll" /R:"C:WindowsMicrosoft.NETFramework4.0.30319Temporary ASP.NET Filesscaffldcc97fe4692cadddfssemblydl321274484ad68c4_e528d301System.Net.Http.WebRequest.DLL" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.IdentityModel4.0_4.0.0.0__b77a5c561934e089System.IdentityModel.dll" /R:"C:WindowsMicrosoft.NETFramework4.0.30319Temporary ASP.NET Filesscaffldcc97fe4692cadddfssemblydl3cae5d78ab850c4_e528d301System.Net.Http.Formatting.DLL" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Xml4.0_4.0.0.0__b77a5c561934e089System.Xml.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Data.Entity4.0_4.0.0.0__b77a5c561934e089System.Data.Entity.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Web.WebPages.Deployment4.0_2.0.0.0__31bf3856ad364e35System.Web.WebPages.Deployment.dll" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Web.Razor4.0_2.0.0.0__31bf3856ad364e35System.Web.Razor.dll" /R:"C:WindowsMicrosoft.NETFramework4.0.30319Temporary ASP.NET Filesscaffldcc97fe4692cadddfssemblydl384ab3d32fa85c4_e528d301System.Web.Http.DLL" /R:"C:WindowsMicrosoft.NETFramework4.0.30319Temporary ASP.NET Filesscaffldcc97fe4692cadddfssemblydl359b9a9287e82a6_c429d301Scaffld.DLL" /R:"C:WindowsMicrosoft.NETFramework4.0.30319Temporary ASP.NET Filesscaffldcc97fe4692cadddfssemblydl3e5ff29994410c3_e528d301Newtonsoft.Json.DLL" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILMicrosoft.Web.Infrastructure4.0_1.0.0.0__31bf3856ad364e35Microsoft.Web.Infrastructure.dll" /R:"C:WindowsMicrosoft.NETFramework4.0.30319Temporary ASP.NET Filesscaffldcc97fe4692cadddfssemblydl3920f00fa48668c4_e528d301System.Net.Http.DLL" /R:"C:WindowsMicrosoft.NetssemblyGAC_MSILSystem.Web.Extensions4.0_4.0.0.0__31bf3856ad364e35System.Web.Extensions.dll" /out:"C:WindowsMicrosoft.NETFramework4.0.30319Temporary ASP.NET Filesscaffldcc97fe4692cadddfApp_Web_edit.cshtml.a8d08dba.aontqujh.dll" /D:DEBUG /debug+ /optimize- /w:4 /nowarn:1659;1699;1701 /warnaserror- "C:WindowsMicrosoft.NETFramework4.0.30319Temporary ASP.NET Filesscaffldcc97fe4692cadddfApp_Web_edit.cshtml.a8d08dba.aontqujh.0.cs" "C:WindowsMicrosoft.NETFramework4.0.30319Temporary ASP.NET Filesscaffldcc97fe4692cadddfApp_Web_edit.cshtml.a8d08dba.aontqujh.1.cs"
Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
Copyright (C) Microsoft Corporation. All rights reserved.
c:WindowsMicrosoft.NETFramework4.0.30319Temporary ASP.NET Filesscaffldcc97fe4692cadddfApp_Web_edit.cshtml.a8d08dba.aontqujh.0.cs(29,76): error CS0246: The type or namespace name 'MVCDemo' could not be found (are you missing a using directive or an assembly reference?)
Show Complete Compilation Source:
Line 1: #pragma checksum "c:usersharris adocumentsisual studio 2010ProjectsScaffldScaffldViewsHomeEdit.cshtml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "63D7194D17A95DFA11E7F5FB7AB00C45"
Line 2: //------------------------------------------------------------------------------
Line 3: // <auto-generated>
Line 4: // This code was generated by a tool.
Line 5: // Runtime Version:4.0.30319.296
Line 6: //
Line 7: // Changes to this file may cause incorrect behavior and will be lost if
Line 8: // the code is regenerated.
Line 9: // </auto-generated>
Line 10: //------------------------------------------------------------------------------
Line 11:
Line 12: namespace ASP {
Line 13: using System;
Line 14: using System.Collections.Generic;
Line 15: using System.IO;
Line 16: using System.Linq;
Line 17: using System.Net;
Line 18: using System.Web;
Line 19: using System.Web.Helpers;
Line 20: using System.Web.Security;
Line 21: using System.Web.UI;
Line 22: using System.Web.WebPages;
Line 23: using System.Web.Mvc;
Line 24: using System.Web.Mvc.Ajax;
Line 25: using System.Web.Mvc.Html;
Line 26: using System.Web.Routing;
Line 27:
Line 28:
Line 29: public class _Page_Views_Home_Edit_cshtml : System.Web.Mvc.WebViewPage<MVCDemo.Models.Employee> {
Line 30:
Line 31: #line hidden
Line 32:
Line 33: public _Page_Views_Home_Edit_cshtml() {
Line 34: }
Line 35:
Line 36: protected ASP.global_asax ApplicationInstance {
Line 37: get {
Line 38: return ((ASP.global_asax)(Context.ApplicationInstance));
Line 39: }
Line 40: }
Line 41:
Line 42: public override void Execute() {
Line 43:
Line 44: #line 2 "c:usersharris adocumentsisual studio 2010ProjectsScaffldScaffldViewsHomeEdit.cshtml"
Line 45:
Line 46: ViewBag.Title = "Edit";
Line 47:
Line 48:
Line 49: #line default
Line 50: #line hidden
Line 51: WriteLiteral(" <h2>Edit</h2> <script");
Line 52:
Line 53: WriteAttribute("src", Tuple.Create(" src="", 94), Tuple.Create(""", 129)
Line 54: , Tuple.Create(Tuple.Create("", 100), Tuple.Create<System.Object, System.Int32>(Href("~/Scripts/jquery-1.7.1.min.js")
Line 55: , 100), false)
Line 56: );
Line 57:
Line 58: WriteLiteral(" type="text/javascript"");
Line 59:
Line 60: WriteLiteral("></script> <script");
Line 61:
Line 62: WriteAttribute("src", Tuple.Create(" src="", 172), Tuple.Create(""", 211)
Line 63: , Tuple.Create(Tuple.Create("", 178), Tuple.Create<System.Object, System.Int32>(Href("~/Scripts/jquery-ui-1.8.20.min.js")
Line 64: , 178), false)
Line 65: );
Line 66:
Line 67: WriteLiteral(" type="text/javascript"");
Line 68:
Line 69: WriteLiteral("></script> <link");
Line 70:
Line 71: WriteAttribute("href", Tuple.Create(" href="", 252), Tuple.Create(""", 277)
Line 72: , Tuple.Create(Tuple.Create("", 259), Tuple.Create<System.Object, System.Int32>(Href("~/Content/Site.css")
Line 73: , 259), false)
Line 74: );
Line 75:
Line 76: WriteLiteral(" rel="stylesheet"");
Line 77:
Line 78: WriteLiteral(" type="text/css"");
Line 79:
Line 80: WriteLiteral(" /> <link");
Line 81:
Line 82: WriteAttribute("href", Tuple.Create(" href="", 321), Tuple.Create(""", 367)
Line 83: , Tuple.Create(Tuple.Create("", 328), Tuple.Create<System.Object, System.Int32>(Href("~/Content/themes/base/jquery.ui.all.css")
Line 84: , 328), false)
Line 85: );
Line 86:
Line 87: WriteLiteral(" rel="stylesheet"");
Line 88:
Line 89: WriteLiteral(" type="text/css"");
Line 90:
Line 91: WriteLiteral(" /> <script");
Line 92:
Line 93: WriteLiteral(" type="text/javascript"");
Line 94:
Line 95: WriteLiteral("> $(function () { $("input:text.date").datepicker( { " +
Line 96: " dateFormat: "dd/mm/yy" }); }); </script> ");
Line 97:
Line 98:
Line 99: #line 22 "c:usersharris adocumentsisual studio 2010ProjectsScaffldScaffldViewsHomeEdit.cshtml"
Line 100: using (@Html.BeginForm())
Line 101: {
Line 102:
Line 103:
Line 104: #line default
Line 105: #line hidden
Line 106:
Line 107: #line 24 "c:usersharris adocumentsisual studio 2010ProjectsScaffldScaffldViewsHomeEdit.cshtml"
Line 108: Write(Html.EditorForModel());
Line 109:
Line 110:
Line 111: #line default
Line 112: #line hidden
Line 113:
Line 114: #line 24 "c:usersharris adocumentsisual studio 2010ProjectsScaffldScaffldViewsHomeEdit.cshtml"
Line 115:
Line 116:
Line 117:
Line 118: #line default
Line 119: #line hidden
Line 120: WriteLiteral(" <br /> ");
Line 121:
Line 122: WriteLiteral(" <input");
Line 123:
Line 124: WriteLiteral(" type="submit"");
Line 125:
Line 126: WriteLiteral(" value="Save"");
Line 127:
Line 128: WriteLiteral(" /> ");
Line 129:
Line 130:
Line 131: #line 27 "c:usersharris adocumentsisual studio 2010ProjectsScaffldScaffldViewsHomeEdit.cshtml"
Line 132: }
Line 133:
Line 134: #line default
Line 135: #line hidden
Line 136: }
Line 137: }
Line 138: }
Line 139:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
---------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%Microsoft.NETFramework4.0.30319spnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%Microsoft.NETFramework644.0.30319spnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
<connectionStrings>
<add name="SampleDBContext" connectionString="metadata=res://*/Models.SampleDataModel.csdl|res://*/Models.SampleDataModel.ssdl|res://*/Models.SampleDataModel.msl;provider=System.Data.SqlClient;provider connection string="data source=HARRISA2-PCSQLEXPRESS;initial catalog=master;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
--------------------------------------------------------------------------------------------------------------
@model DateTime?
@Html.TextBox("", (Model.HasValue ? Model.Value.ToString("dd/MM/yyyy") : string.Empty), new { @class = "date" })
-------------------------------------------------------------------------------------------------------------------
@model MVCDemo.Models.Employee
@{
ViewBag.Title = "Edit";
}
<h2>Edit</h2>
<script src="~/Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="~/Scripts/jquery-ui-1.8.20.min.js" type="text/javascript"></script>
<link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
<link href="~/Content/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(function () {
$("input:text.date").datepicker(
{
dateFormat: "dd/mm/yy"
});
});
</script>
@using (@Html.BeginForm())
{
@Html.EditorForModel()
<br />
<input type="submit" value="Save" />
}
Explanation / Answer
You could perform the following steps:-
First Restart Visual Studio, then remove the assembly reference and after that re-add it. Then after that perform a clean and rebuild the application and at last try to the install Microsoft.AspNET.MVC from the NuGet package manager.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.