2

ASP.NET precompilation of my ASP.NET MVC application fails when it gets deployed to AppHarbor, ostensibly because a non-existent type is referred to in a Razor view. This might well be correct, but in which file is in error!?

Microsoft (R) ASP.NET Compilation Tool version 4.0.30319.17929
Utility to precompile an ASP.NET application
Copyright (C) Microsoft Corporation. All rights reserved.

d:\temp\0kxqxggv.qii\temp\root\aecd3928\90d8ef26\App_Web_24m5b001.0.cs(36): error CS0234: The type or namespace name 'User' does not exist in the namespace 'MyApp.Models' (are you missing an assembly reference?)

[HttpCompileException]: d:\temp\0kxqxggv.qii\temp\root\aecd3928\90d8ef26\App_Web_24m5b001.0.cs(36): error CS0234: The type or namespace name 'User' does not exist in the namespace 'MyApp.Models' (are you missing an assembly reference?)
   at System.Web.Compilation.AssemblyBuilder.Compile()
   at System.Web.Compilation.WebDirectoryBatchCompiler.CompileAssemblyBuilder(AssemblyBuilder builder)
   at System.Web.Compilation.WebDirectoryBatchCompiler.<CompileNonDependentBuildProviders>b__0(AssemblyBuilder assemblyBuilder)
   at System.Web.Compilation.CompilationUtil.CompileParallel(ICollection assemblyBuilders, Action`1 action)
   at System.Web.Compilation.WebDirectoryBatchCompiler.CompileNonDependentBuildProviders(ICollection buildProviders)
   at System.Web.Compilation.WebDirectoryBatchCompiler.Process()
   at System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors)
   at System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors)
   at System.Web.Compilation.BuildManager.PrecompileWebDirectoriesRecursive(VirtualDirectory vdir, Boolean topLevel)
   at System.Web.Compilation.BuildManager.PrecompileWebDirectoriesRecursive(VirtualDirectory vdir, Boolean topLevel)
   at System.Web.Compilation.BuildManager.PrecompileWebDirectoriesRecursive(VirtualDirectory vdir, Boolean topLevel)
   at System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath startingVirtualDir, IEnumerable`1 excludedVirtualPaths)
   at System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath startingVirtualDir, IEnumerable`1 excludedVirtualPaths)
   at System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCallback callback, IEnumerable`1 excludedVirtualPaths)
   at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback callback, List`1 excludedVirtualPaths)
   at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback callback, List`1 excludedVirtualPaths)
   at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback, Boolean forceCleanBuild)
   at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback)
   at System.Web.Compilation.Precompiler.Main(String[] args)




Website precompilation failed with exit code 1. Precompilation can optionally be disabled in application settings
aknuds1
  • 65,625
  • 67
  • 195
  • 317

2 Answers2

0

have you tried to enable view compilation on visual studio? If you enable that you can debug the error on your ide

change MvcBuildViews to true in .csproj file inside project -> propertygroup

<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <PropertyGroup>
  <MvcBuildViews>true</MvcBuildViews>
 </PropertyGroup>

Compile Views in ASP.NET MVC

Community
  • 1
  • 1
avalla
  • 560
  • 4
  • 19
0

This might be old but it might help someone else to know how to read this kind of log and where to look for the error in the future.

As it is on the 4th line on error log.

d:\temp\0kxqxggv.qii\temp\root\aecd3928\90d8ef26\App_Web_24m5b001.0.cs(36): error CS0234: The type or namespace name 'User' does not exist in the namespace 'MyApp.Models' (are you missing an assembly reference?)

There is enough info to know where and why the error occurred.

Where: On this file named App_Web_24m5b001.0.cs located at d:\temp\0kxqxggv.qii\temp\root\aecd3928\90d8ef26\App_Web_24m5b001.0.cs on line (36)

Why: The type or namespace name 'User' does not exist in the namespace 'MyApp.Models' (are you missing an assembly reference?)

Note If you are deploying to appharbor using source control lit might be you changed Userand forgot to include the changes to commit that caused this error. At least that is what happed to me.

iAM
  • 1,365
  • 15
  • 25