Feedback
Did this article resolve your question/issue?

   

Article

Upgrade: Compilation errors in MVC views for authentication after upgrade to Sitefinity 10.0

« Go Back

Information

 
TitleUpgrade: Compilation errors in MVC views for authentication after upgrade to Sitefinity 10.0
URL NameCompilation-Error-in-MVC-views-for-authentication-after-upgrade-to-Sitefinity-10-0
Article Number000188467
EnvironmentProduct: Sitefinity
Version: 10.x, 11.x, 12.x, 13.x
OS: All supported OS versions
Database: All supported Microsoft SQL Server versions
Question/Problem Description
Compilation Error in MVC views for authentication after upgrade to Sitefinity 10.0 or above.
Steps to Reproduce1. Upgrade a site to Sitefintiy 10.0
2. Open it in Visual Studio
3. Compile the site
Clarifying Information
Error Message1. Error 130 'Telerik.Sitefinity.Frontend.Identity.Mvc.Models.LoginForm.ForgotPasswordViewModel' does not contain a definition for 'EmailNotFound' and no extension method 'EmailNotFound' accepting a first argument of type 'Telerik.Sitefinity.Frontend.Identity.Mvc.Models.LoginForm.ForgotPasswordViewModel' could be found (are you missing a using directive or an assembly reference?) D:\SiteInfinity\site\obj\FeatherCodeGen\ResourcePackages\Bootstrap\MVC\Views\..mvc\views\loginform\ForgotPassword.ForgottenPassword.cshtml

2. Error 131 'Telerik.Sitefinity.Frontend.Identity.Mvc.Models.LoginForm.LoginFormViewModel' does not contain a definition for 'IncorrectCredentials' and no extension method 'IncorrectCredentials' accepting a first argument of type 'Telerik.Sitefinity.Frontend.Identity.Mvc.Models.LoginForm.LoginFormViewModel' could be found (are you missing a using directive or an assembly reference?) D:\SiteInfinity\site\obj\FeatherCodeGen\ResourcePackages\Bootstrap\MVC\Views\..mvc\views\loginform\LoginForm.LoginForm.cshtml

3. Error 132 'Telerik.Sitefinity.Frontend.Identity.Mvc.Models.Registration.RegistrationViewModel' does not contain a definition for 'EmailAddressShouldBeTheUsername' and no extension method 'EmailAddressShouldBeTheUsername' accepting a first argument of type 'Telerik.Sitefinity.Frontend.Identity.Mvc.Models.Registration.RegistrationViewModel' could be found (are you missing a using directive or an assembly reference?) D:\SiteInfinity\site\obj\FeatherCodeGen\ResourcePackages\Bootstrap\MVC\Views\..mvc\views\registration\Registration.RegistrationForm.cshtml

4. Error 133 'Telerik.Sitefinity.Frontend.Identity.Mvc.Models.Registration.RegistrationViewModel' does not contain a definition for 'UserName' and no extension method 'UserName' accepting a first argument of type 'Telerik.Sitefinity.Frontend.Identity.Mvc.Models.Registration.RegistrationViewModel' could be found (are you missing a using directive or an assembly reference?) D:\SiteInfinity\site\obj\FeatherCodeGen\ResourcePackages\Bootstrap\MVC\Views\..mvc\views\registration\Registration.RegistrationForm.cshtml

5. Error 134 'Telerik.Sitefinity.Frontend.Identity.Mvc.Models.Registration.RegistrationViewModel' does not contain a definition for 'UserName' and no extension method 'UserName' accepting a first argument of type 'Telerik.Sitefinity.Frontend.Identity.Mvc.Models.Registration.RegistrationViewModel' could be found (are you missing a using directive or an assembly reference?) D:\SiteInfinity\site\obj\FeatherCodeGen\ResourcePackages\Bootstrap\MVC\Views\..mvc\views\registration\Registration.RegistrationForm.cshtml

6. Error 135 'Telerik.Sitefinity.Frontend.Identity.Mvc.Models.Registration.RegistrationViewModel' does not contain a definition for 'UserName' and no extension method 'UserName' accepting a first argument of type 'Telerik.Sitefinity.Frontend.Identity.Mvc.Models.Registration.RegistrationViewModel' could be found (are you missing a using directive or an assembly reference?) D:\SiteInfinity\site\obj\FeatherCodeGen\ResourcePackages\Bootstrap\MVC\Views\..mvc\views\registration\Registration.RegistrationForm.cshtml
Defect Number
Enhancement Number
Cause
The error indicates that the problem is in the authentication views located in ResourcePackages folder, they still reflect the state before the upgrade to Sitefinity 10.0.
In Sitefinity 10.0 with the introduction of authentication based on Identity Server 3, the widgets that provide authentication are updated.
Resolution
The problem can be caused by different reasons, below are several resolution cases:

Option 1:
Sitefinity precompiles the .cshtml views that are stored in the ResourcePackages folder and the errors refer to that methods that are no longer available in Sitefinity 10 are still searched. This can be only a problem with the precompilation and to check if this is the case delete the "obj" folder and then compile the project again. If it compiles without an issue the cause was due to a problem with the precompilation of razor views if it doesn`t resolve go to the second cause.

Option 2:
The ResourcePackages folder was not updated with the upgrade to Sitefinity 10.0 and still use the files for the pre-upgrade version. Check if the files are upgraded, go to ~/ResourcePackages\Bootstrap\MVC\Views\LoginForm and openForgotPassword.ForgottenPassword.cshtml and make sure the template is like below:
@model Telerik.Sitefinity.Frontend.Identity.Mvc.Models.LoginForm.ForgotPasswordViewModel
@using Telerik.Sitefinity.UI.MVC;
@using Telerik.Sitefinity.Frontend.Mvc.Helpers
<div class="@Model.CssClass">
<h3>@Html.Resource("ForgotPasswordHeader")</h3>
@if (Model.EmailSent)
{
<p>@Html.Resource("ForgotPasswordRequestSent") <i>@Html.Encode(Model.Email)</i></p>
<p>@Html.Resource("ForgotPasswordRequestSentUseLink")</p>
<a href="@Model.LoginPageUrl" class="btn btn-default">@Html.Resource("ForgotPasswordBackToLogin")</a>
}
else
{
using (Html.BeginForm("SendPasswordResetEmail", "LoginForm"))
{
<p>@Html.Resource("EnterLoginEmailAddress")</p>
<div class="form-group">
<label>@Html.Resource("ForgotPasswordEmail")</label>
@Html.TextBoxFor(u => u.Email, new { @class = "form-control" })
</div>
<button type="submit" class="btn btn-primary">@Html.Resource("ForgotPasswordSendButton")</button>
}
}
</div>
If it is not get the Sitefinity 10 version of the ResourcePackages from GitHub, Sitefinity/feather-packages https://github.com/Sitefinity/feather-packages. Get the Bootstrap4 package.
Note: Back up the previous ResourcePackages folder in case customizations were done to the templates in this package.

Option 3:
Open Visual Studio, right-click the project and select 'Clean', then delete the 'obj' folder and Build the project.

Option 4:
Edit the .csproj file of the Sitefinity site and locate FeatherPrecompilation.targets and RazorGenerator.MsBuild.targets. (there must be only 1 entry for these if there are more than one its a problem)
Comment those out temporarily and this will allow to build the site and continue.

4.1. The removed entries are:
<Import Project="Build\FeatherPrecompilation.targets" />
<Import Project="Build\RazorGenerator.MsBuild\build\RazorGenerator.MsBuild.targets" />
May either come from the Build\ path if the site was upgraded with Sitefinity project manager or coming from packages/ folder if it was upgraded with NuGet packages. Ensure that there is only one entry in the .csproj for FeatherPrecompilation.targets and RazorGenerator.MsBuild.targets .
Workaround
Notes
Last Modified Date6/30/2021 6:06 AM
Attachment 
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.