Skip to main content

I’ve been investigating the Habitat Home Corporate Demo website in my last blog-posts:

While writing those I’ve run into 2 issues with the current release that is out there on GitHub. In this blogpost I would like to walk you through this and show you the fix you can make while the issues haven’t yet been solved by the demo team.

Missing using statement in FormWrapper.cshtml

When you’ve installed Habitat Home Corporate through my first blog-post, you’ll end up with an exception on the following pages:

  • https://habitathomecorporate.dev.local/Download-our-whitepaper
  • https://habitathomecorporate.dev.local/About-Us/Contact-Us

These are the two pages that actually have a Sitecore Forms form on the page and something is incorrectly configured. The following error occurs:

Server Error in ‘/’ 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: CS1061: ‘System.Web.WebPages.Html.HtmlHelper’ does not contain a definition for ‘Sitecore’ and no extension method ‘Sitecore’ accepting a first argument of type ‘System.Web.WebPages.Html.HtmlHelper’ could be found (are you missing a using directive or an assembly reference?) 

It turns out that on the file system is that the web.config is missing in the C:\inetpub\wwwroot\habitathomecorporate.dev.local\Areas\Forms\Views directory. If you open up the Habitat Home Corporate solution, rebuild the solution (which restores various Foundation Nuget packages), and find the correct web.config in \packages\sitecore.demo.feature.forms\9.2.0.36\contentFiles\any\any\Areas\Forms\Views.

Copy over web.config from that Nuget package to the \Areas\Forms\Views directory and the pages should load again.

The following issue was created for this one.

Correct AccountCollectionModel is missing in xConnect

When we actually submit one of the 2 Sitecore Forms, the submit actions fail. It can’t trigger a goal, it can’t register an outcome…

After the default install we end up with a Sitecore.HabitatHome.Foundation.Accounts.Models.AccountCollectionModel, 1.0.json file into the C:\inetpub\wwwroot\habitathomecorporate_xconnect.dev.local\App_Data\Models and C:\inetpub\wwwroot\habitathomecorporate_xconnect.dev.local\App_Data\jobs\continuous\IndexWorker\App_Data\Models directories.

And therefore Sitecore is throwing an error:

6860 19:46:47 ERROR Cannot create tracker.
Exception: Sitecore.XConnect.Client.XdbModelConflictException
Message: One or more local models conflict with the xDB service layer.
‘Sitecore.Demo.Foundation.Accounts.Models.AccountCollectionModel, 1.0’ does not have a remote version

The file it’s expecting is called: Sitecore.Demo.Foundation.Accounts.Models.AccountCollectionModel, 1.0.json instead of Sitecore.HabitatHome.Foundation.Accounts.Models.AccountCollectionModel, 1.0.json (which got deployed through the build.ps1 script we ran during the installation).

The solution is simple: copy over the file from  c:\Projects\Sitecore.HabitatHome.Corporate\publish\App_Data\xConnectModels\Sitecore.Demo.Foundation.Accounts.Models.AccountCollectionModel, 1.0.json to the Models folders of your xConnect instance and to the IndexWorker Models folder under that same instance (2 locations) and remove the incorrect one.

You then should be able to post the forms and no errors should be thrown anymore.

The following issue was created for this one.

That’s it for now, hope this helps in getting you to run a fully functional Sitecore Habitat Home Corporate demo site.

Happy Sitecoring …

Robbert