If I run this command on my system
<Exec Command="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler -v localhost -p $(SourceDir)\wwwroot -u -f projectCompileCode\project -c -errorstack -nologo" />
I get the following error:
error ASPParse: Could not load the type: Projectname:SomeFile.
The project is web application project
This my stack trace:
[HttpException]: Could not load type 'ProjectName.FileName'. at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCa e, Boolean throwOnError) at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeN me, String codeFileBaseTypeName, String src, Assembly assembly) at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDicti nary parseData)
[HttpParseException]: Could not load type ''ProjectName.FileName. at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virt alPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseReader(StreamReader reader, VirtualP th virtualPath) at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPat virtualPath) at System.Web.UI.TemplateParser.ParseInternal() at System.Web.UI.TemplateParser.Parse() at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType( at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider( uildProvider buildProvider) at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResu t(Boolean isPrecompiledApp) at System.Web.Compi开发者_如何学编程lation.BuildManager.CompileGlobalAsax() at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() at System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath tartingVirtualDir) at System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath starting irtualDir) at System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCa lback callback) at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManag rCallback callback) at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManag rCallback callback) at System.Web.Compilation.ClientBuildManager.PrecompileApplication(Client uildManagerCallback callback, Boolean forceCleanBuild) at System.Web.Compilation.ClientBuildManager.PrecompileApplication(Client uildManagerCallback callback) at System.Web.Compilation.Precompiler.Main(String[] args)
If I build in v2.0.50727 then still it is giving the same error.
My application is built in with VS 2010, .net frame asp.net frame work 4
Any help is greatly apperciated.
Have you tried:
- Checking references
- Doing a clean and a build
- Checking the Inherits attr in the HTML against the code behind
- Creating a new App Pool in IIS for this web site?
I see a similar problem. Works locally from within VS2008, but once published and deployed to the server, I get the same error as described here.
None of the suggestions I have provided worked for me; maybe they will work for you.
I had the same error. When I opened the web site DLL in ILDASM, the Type for a control was completely missing, as if it didn't even get compiled.
As it turns out, the codebehind files got excluded from the project. This is strange considering that the builds on my machine were successful! At any rate, I carefully re-included codebehind files and it all started working.
This often happens because the project file (.csproj or .vbproj) does not contain the necessary references to the files in question. Try cleaning/rebuilding all projects and making sure that the latest project files are moved to the server as well.
Another possibility is that the file was not actually included in your project at all. This allows the builds in Visual Studio to run just fine, but will break when compiling the .NET code (with aspnet_compiler for example) because all .aspx/.ascx/etc. files within the specified folder are compiled - whether they are included in your project or not.
精彩评论