aspnet_compiler.exe Precompile errors when deploying after 2.0 upgrade

  1. Avatar of Cali LaFollett

    I'm using the built in VS.NET 2015 Publish Web to publish our flockcall.com site to Azure. This was working perfectly prior to the 2.0 BetterCms update we recently performed. Upon attempting to deploy our the updates, we are now receiving the following error and are unable to publish:

    1>------ Build started: Project: FlockCall.Web, Configuration: Release Any CPU ------ 1> Restoring NuGet packages... 1> To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'. 1> All packages listed in packages.config are already installed. 1> FlockCall.Web -> D:\Development\Repositories\FlockCall\fcWeb\FlockCall.Web\bin\FlockCall.Web.dll 2>------ Publish started: Project: FlockCall.Web, Configuration: Release Any CPU ------ 2>Transformed Web.config using D:\Development\Repositories\FlockCall\fcWeb\FlockCall.Web\Web.Release.config into obj\Release\TransformWebConfig\transformed\Web.config. 2>Copying all files to temporary location below for package/publish: 2>obj\Release\AspnetCompileMerge\Source. 2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v / -p D:\Development\Repositories\FlockCall\fcWeb\FlockCall.Web\obj\Release\AspnetCompileMerge\Source -u -d D:\Development\Repositories\FlockCall\fcWeb\FlockCall.Web\obj\Release\AspnetCompileMerge\TempBuildDir 2>ASPNETCOMPILER(0,0): Error ASPRUNTIME: Type is not resolved for member 'BetterModules.Core.Exceptions.CoreException,BetterModules.Core, Version=1.0.0.32, Culture=neutral, PublicKeyToken=null'. 2>

  2. Avatar of Cali LaFollett

    Continued... your form doesn't allow a longer post.

    I tried running the aspnet_compiler.exe directly with the -errorstack and -f switches. This is the output:

    error ASPRUNTIME: Type is not resolved for member 'BetterModules.Core.Exceptions.CoreException,BetterModules.Core, Version=1.0.0.32, Culture=neutral, PublicKeyToken=null'.

    [SerializationException]: Type is not resolved for member 'BetterModules.Core.Exceptions.CoreException,BetterModules.Core, Version=1.0.0.32, Culture=neutral, PublicKeyToken=null'. at System.Web.Compilation.BuildManagerHost.get_InitializationException() at System.Web.Compilation.ClientBuildManager.CreateHost()

    [HttpException]: Type is not resolved for member 'BetterModules.Core.Exceptions.CoreException,BetterModules.Core, Version=1.0.0.32, Culture=neutral, PublicKeyToken=null'. at System.Web.Compilation.ClientBuildManager.EnsureHostCreated() 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)

    Our app does build and run fine, we just can't get past our deployment issues.

  3. Avatar of Cali LaFollett

    To clarify, the app builds and runs fine locally using the standard VS.NET Build.

  4. Avatar of Cali LaFollett

    Simonas:

    Sorry for my delayed response. I copied the both of the BetterModules DLLs into the 4.0 direction and tried the precompilation command again and was able to get more better stack trace info:

    error ASPRUNTIME: The constructor to deserialize an object of type 'BetterModules.Core.Exceptions.CoreException' was not found.

    [SerializationException]: The constructor to deserialize an object of type 'BetterModules.Core.Exceptions.CoreException' was not found. at System.Web.Compilation.BuildManagerHost.get_InitializationException() at System.Web.Compilation.ClientBuildManager.CreateHost()

    [HttpException]: The constructor to deserialize an object of type 'BetterModules.Core.Exceptions.CoreException' was not found. at System.Web.Compilation.ClientBuildManager.EnsureHostCreated() 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)

    Looks like I will have to wait a bit to get BetterCms deployed to our production servers.

  5. Avatar of Cali LaFollett

    In reviewing Github, the CoreException is indeed Attributed with Serializable but it doesn't have a parameterless constructor:

    https://github.com/devbridge/BetterModules/blob/master/BetterModules.Core/Exceptions/CoreException.cs

    It's imperative all Serializable classes have a parameterless constructor. I'm not sure why the aspnet_compiler.exe is exposing it during a pre compile. Regardless, your code would fail if it ever had to be serialized.

    Any way to get this hot fixed? I know I could pull down the source and do it myself but I'm really trying to stick with Nuget for all external source references.

  6. Avatar of Cali LaFollett

    This is still an issue. I can't officially deploy this until the change mentioned above is made. We would love to upgrade to 2.0 but it's hard to when deployments are failing.

  7. Avatar of Cali LaFollett

    I'm still unable to upgrade to 2.0 because it uses BetterModules 1.0 which can't be published because the CoreException is not serializable. My only recourse is to pull all repos locally and alter them myself. I want to avoid this since I would prefer to use Nuget for package management.

    Is anyone actively monitoring this support page anymore?

  8. Avatar of Paulius

    Hi, we will upgrade the BCMS nuget.org package to support BetterModules 2.0 in two upcoming weeks.

  9. Avatar of Cali LaFollett

    Thanks Paulius!

    I've forked both BetterCMS and BetterModules to perform the update locally. Adding the default parameterless constructors helped and resolved the original error but this resulted in a new error I can't track down and have given up researching it. I do not have the details handy at the moment.

    I am working around the issue right now by not performing using the "PrecompileBeforePublish=true" publishing setting when building my site. This does cause a hit to startup time but I can live with it for now.

    I recommend testing your up coming changes by perform a quick publish using the built in VS.NET publishing profiles for your Demo site to a test server. You will get the above errors during the preview process and won't even get a chance to deploy.

  10. Avatar of Paulius

    The released 2.0.6 version should solve this. https://www.nuget.org/packages/BetterCms

  11. Avatar of Cali LaFollett

    Paulius,

    Unfortunately, 2.0.6 did not solve it. I also see that BetterModules Core Exceptions still do not have a default constructors. You must have default constructors for classes that are Serializable: https://github.com/devbridge/BetterModules/blob/dev/BetterModules.Core/Exceptions/CoreException.cs

    This appears to only happen when using the site precompile feature of aspnet_compiler.exe.

    Please consider ensuring you test be attempting to pre compile the sites.

    Even though it's not critical to running the site, it is an optimization I would like to make use of.

  12. Avatar of Lukas

    Hi Cali,

    Please make sure that after the update to 2.0.6, BetterModules.Core and BetterModules.Core.Web packages are updated to version 1.0.1, since the changes were introduced in this version: https://github.com/devbridge/BetterModules/blob/dev1.0.1/BetterModules.Core/Exceptions/CoreException.cs We have tested the aspnet_compiler.exe using a default MVC 5 project with Better CMS 2.0.6 and the minimum required configuration. It worked fine both through VS 2015 deploy tool and calling the compiler directly from the Command Prompt. So firstly, we would suggest You to check the current vresion of Better Modules and verify that Exception Classes have a parameterless constructor (one way to do that is by using Object Browser in Visual Studio). Hope this helps!

* Mandatory
* Mandatory
* Mandatory

Verify that you are human