Hi!
I'm getting all red squigglies on my CSHTML files but the site is still working without compile-time or runtime errors. I'm getting this warning on CSHTML that has Kendo() used on them:
Warning CS1702
Assuming assembly reference 'System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' used by 'Kendo.Mvc' matches identity 'System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' of 'System.Web.Mvc', you may need to supply runtime policy
Also, maybe not related, but all kendo control is not rendering properly at all: Attached
Here is my Web.Config:
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
configSections
>
<
section
name
=
"log4net"
type
=
"log4net.Config.Log4NetConfigurationSectionHandler, log4net"
/>
</
configSections
>
<
appSettings
>
<
add
key
=
"webpages:Version"
value
=
"3.0.0.0"
/>
<
add
key
=
"webpages:Enabled"
value
=
"false"
/>
<
add
key
=
"ClientValidationEnabled"
value
=
"true"
/>
<
add
key
=
"UnobtrusiveJavaScriptEnabled"
value
=
"true"
/>
</
appSettings
>
<
system.web
>
<
authentication
mode
=
"Windows"
/>
<
authorization
>
<
deny
users
=
"?"
/>
</
authorization
>
<
compilation
debug
=
"true"
targetFramework
=
"4.7.1"
>
<
assemblies
>
<
add
assembly
=
"netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
/>
</
assemblies
>
</
compilation
>
<
httpRuntime
requestValidationMode
=
"4.7.1"
targetFramework
=
"4.7.1"
encoderType
=
"System.Web.Security.AntiXss.AntiXssEncoder, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
/>
<
globalization
uiCulture
=
"auto:en"
culture
=
"en-GB"
/>
<
pages
>
<
namespaces
>
<
add
namespace
=
"Kendo.Mvc.UI"
/>
</
namespaces
>
</
pages
>
</
system.web
>
<
system.web.extensions
>
<
scripting
>
<
webServices
>
<
jsonSerialization
maxJsonLength
=
"2147483644"
/>
</
webServices
>
</
scripting
>
</
system.web.extensions
>
<
system.webServer
>
<
staticContent
>
<
remove
fileExtension
=
".woff"
/>
<
remove
fileExtension
=
".woff2"
/>
<
remove
fileExtension
=
".otf"
/>
<
mimeMap
fileExtension
=
".woff"
mimeType
=
"application/x-font-woff"
/>
<
mimeMap
fileExtension
=
".woff2"
mimeType
=
"font/woff2"
/>
<
mimeMap
fileExtension
=
".otf"
mimeType
=
"font/otf"
/>
</
staticContent
>
<
modules
>
<
remove
name
=
"FormsAuthentication"
/>
</
modules
>
<
httpProtocol
>
<
customHeaders
>
<
add
name
=
"Node"
value
=
"Local"
/>
</
customHeaders
>
</
httpProtocol
>
</
system.webServer
>
<
runtime
>
<
gcServer
enabled
=
"true"
/>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Web.Optimization"
publicKeyToken
=
"31bf3856ad364e35"
/>
<
bindingRedirect
oldVersion
=
"1.0.0.0-1.1.0.0"
newVersion
=
"1.1.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"WebGrease"
publicKeyToken
=
"31bf3856ad364e35"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.6.5135.21930"
newVersion
=
"1.6.5135.21930"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Antlr3.Runtime"
publicKeyToken
=
"eb42632606e9261f"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-3.5.0.2"
newVersion
=
"3.5.0.2"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Newtonsoft.Json"
publicKeyToken
=
"30ad4fe6b2a6aeed"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-11.0.0.0"
newVersion
=
"11.0.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"AutoMapper"
publicKeyToken
=
"be96cd2c38ef1005"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-6.2.2.0"
newVersion
=
"6.2.2.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Web.Helpers"
publicKeyToken
=
"31bf3856ad364e35"
/>
<
bindingRedirect
oldVersion
=
"1.0.0.0-3.0.0.0"
newVersion
=
"3.0.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Web.WebPages"
publicKeyToken
=
"31bf3856ad364e35"
/>
<
bindingRedirect
oldVersion
=
"1.0.0.0-3.0.0.0"
newVersion
=
"3.0.0.0"
/>
</
dependentAssembly
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Web.Mvc"
publicKeyToken
=
"31bf3856ad364e35"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-5.2.4.0"
newVersion
=
"5.2.4.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
</
configuration
>
And here is the Views\Web.Config
<?
xml
version
=
"1.0"
?>
<
configuration
>
<
configSections
>
<
sectionGroup
name
=
"system.web.webPages.razor"
type
=
"System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
>
<
section
name
=
"host"
type
=
"System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
requirePermission
=
"false"
/>
<
section
name
=
"pages"
type
=
"System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
requirePermission
=
"false"
/>
</
sectionGroup
>
</
configSections
>
<
system.web.webPages.razor
>
<
host
factoryType
=
"System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
/>
<
pages
pageBaseType
=
"System.Web.Mvc.WebViewPage"
>
<
namespaces
>
<
add
namespace
=
"System.Web.Mvc"
/>
<
add
namespace
=
"System.Web.Mvc.Ajax"
/>
<
add
namespace
=
"System.Web.Mvc.Html"
/>
<
add
namespace
=
"System.Web.Optimization"
/>
<
add
namespace
=
"System.Web.Routing"
/>
<
add
namespace
=
"DA.Services.IBS.Web.FinancePortalFull"
/>
<
add
namespace
=
"Kendo.Mvc.UI"
/>
</
namespaces
>
</
pages
>
</
system.web.webPages.razor
>
<
appSettings
>
<
add
key
=
"webpages:Enabled"
value
=
"false"
/>
</
appSettings
>
<
system.webServer
>
<
handlers
>
<
remove
name
=
"BlockViewHandler"
/>
<
add
name
=
"BlockViewHandler"
path
=
"*"
verb
=
"*"
preCondition
=
"integratedMode"
type
=
"System.Web.HttpNotFoundHandler"
/>
</
handlers
>
</
system.webServer
>
<
system.web
>
<
compilation
>
<
assemblies
>
<
add
assembly
=
"System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
/>
</
assemblies
>
</
compilation
>
</
system.web
>
</
configuration
>
I'm not using v5.2.3.0 of System.Web.Mvc. I'm on Kendo v2018.1.117.545
_Layout.s
@using DA.Services.IBS.Web.FinancePortalFull.Helpers
<!DOCTYPE html>
<
html
prefix
=
"og: http://ogp.me/ns#"
>
<
head
>
<
title
>@ViewBag.Title | Finance System</
title
>
<
link
href
=
"~/favicon.ico"
rel
=
"shortcut icon"
type
=
"image/x-icon"
/>
<
meta
charset
=
"utf-8"
/>
<
meta
http-equiv
=
"X-UA-Compatible"
content
=
"IE=edge"
>
<
meta
name
=
"viewport"
content
=
"width=device-width, initial-scale=1.0"
>
<
link
href
=
'https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700'
rel
=
'stylesheet'
type
=
'text/css'
>
<!-- Add local styles, mostly for plugins css file -->
@if (IsSectionDefined("Styles"))
{
@RenderSection("Styles", required: false)
}
<!-- Add jQuery Style direct - used for jQGrid plugin -->
<
link
href
=
"@Url.Content("
~/Scripts/plugins/jquery-ui/jquery-ui.min.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<!-- Primary Inspinia style -->
@Styles.Render("~/Content/css")
@Styles.Render("~/Content/plugins/kendo/css")
@Styles.Render("~/Content/plugins/font-awesome/css")
<!-- Section for main scripts render -->
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@Scripts.Render("~/bundles/kendo")
</
head
>
<
body
class
=
"md-skin"
>
<!-- Wrapper-->
<!-- PageClass give you ability to specify custom style for specific view based on action -->
<
div
id
=
"wrapper"
class
=
"@Html.PageClass()"
>
<!-- Navigation -->
@Html.Partial("_Navigation")
<!-- Page wraper -->
<
div
id
=
"page-wrapper"
class
=
"gray-bg @ViewBag.SpecialClass"
>
<!-- Top Navbar -->
@Html.Partial("_TopNavbar")
@Html.Partial("_NotificationBox")
<!-- Main view -->
@RenderBody()
<!-- Footer -->
@Html.Partial("_Footer")
</
div
>
<!-- End page wrapper-->
@{
<
input
id
=
"BASE_URL"
type
=
"hidden"
value
=
"@(string.Format("
{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~/")))" />
}
<
script
type
=
"text/javascript"
>
window.applicationBaseUrl = @Html.Raw(HttpUtility.JavaScriptStringEncode(new Uri(new Uri(Context.Request.Url.GetLeftPart(UriPartial.Authority)), Url.Content("~/")).ToString(), true));
window.BASE_URL = $("#BASE_URL").val();
</
script
>
</
div
>
<!-- End wrapper-->
<!-- Section for main scripts render -->
@Scripts.Render("~/plugins/slimScroll")
@Scripts.Render("~/bundles/inspinia")
<!-- Handler for local scripts -->
@RenderSection("scripts", required: false)
</
body
>
</
html
>
Bundles:
// Kendo UI Scripts
bundles.Add(
new
ScriptBundle(
"~/bundles/kendo"
).Include(
"~/Scripts/plugins/kendo/kendo.all.min.js"
,
"~/Scripts/plugins/kendo/kendo.aspnetmvc.min.js"
));
// CSS style (kendo)
bundles.Add(
new
StyleBundle(
"~/Content/plugins/kendo/css"
).Include(
"~/Content/plugins/kendo/kendo.common-material.min.css"
,
"~/Content/plugins/kendo/kendo.material.min.css"
,
"~/Content/plugins/kendo/kendo.dataviz.material.min.css"
,
"~/Content/plugins/kendo/kendo.mobile.all.min.css"
,
"~/Content/plugins/kendo/kendo.mobile.material.min.css"
,
"~/Content/plugins/kendo/kendo.material-mobile.min.css"
));
As per chrome's Network tab in dev-mode, there is no missing file and no errors on the console tab either.
Usually such error appears when the assembly you have referenced in the project has different version than what you have in web.config.
Below you will find links to StackOverflow where such MVC exeption has been discussed. I hope that the suggestions in the links will help:
- https://stackoverflow.com/questions/29093832/add-assembly-system-web-mvc-version-4-0-0-0-culture-neutral-publickeytoken
- https://stackoverflow.com/questions/30664140/how-to-resolve-assuming-assembly-reference-system-web-mvc/30664141
Regards,
Neli
Progress Telerik
I noticed that if I update these packages, I start getting issues with the latest Kendo:
Microsoft.AspNet. v5.2.4
Microsoft.AspNet. Razor v3.2.4
Microsoft.AspNet. WebPages v3.2.4
I'm on these versions and everything started working normally:
Microsoft.AspNet. v5.2.3
Microsoft.AspNet. Razor v3.2.3
Microsoft.AspNet. WebPages v3.2.3
Thank you for the additional information.
I have updated the mentioned packages in several projects, but I did not manage to reproduce the described problem.
If you have updated an existing project to the latest Kendo version, please make sure you have followed the steps described in the linked article.
Regards,
Neli
Progress Telerik
I have the same problem.
Kendo.Mvc: 2018.1.131.545
Microsoft.AspNet.Razor: 3.2.4
Microsoft.AspNet.WebPages: 3.2.4
Severity: Warning
Code: CS1702
Description: Assuming assembly reference 'System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' used by 'Kendo.Mvc' matches identity 'System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' of 'System.Web.Mvc', you may need to supply runtime policy
Detail Description: The two assemblies differ in release and/or version number. For unification to occur, you must specify directives in the application's .config file, and you must provide the correct strong name of an assembly.
web.config has bindings setup but this does not remove the warnings.
<
configuration
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"System.Web.Mvc"
publicKeyToken
=
"31bf3856ad364e35"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-5.2.4.0"
newVersion
=
"5.2.4.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
</
configuration
>
I agree with the previous posts.
It happens when one upgrades to the latest MVC and Razor packages (5.2.4/3.2.4) from Microsoft via nuget.
Plus, Kendo 2018.1.221 still has the issue.
** The fix is for brand new Kendo dll's that support the latest MVC and Razor to be built and made available.**
Please expedite this.
We are still not able to reproduce the described problem. We did the following steps with VS 2017:
1. Create an ASP.NET MVC application - System.Web.Mvc is Version=5.2.3.0 in it.
2. Add to the project an older Telerik UI for ASP.NET MVC 5 Trial - version 2017.3.913 through NuGet.
3. Update System.Web.Mvc to 5.2.4.0 through NuGet.
4. Rebuild the project both in Debug and Release modes - No warnings.
5. Update Telerik UI for ASP.NET MVC 5 Trial to latest version 2018.1.221 through NuGet.
6. Rebuild the project both in Debug and Release modes - No warnings.
It would be helpful if you specify the following details, in order to reproduce the issue on our side:
1. Visual Studio version used
2. Older Telerik UI for ASP.NET MVC version used prior the update
3. Is the issue reproducible on your side following the steps described above?
4. If the answer to point 3 is no, then is the issue reproducible by changing some of the steps or adding other steps?
If still the issue is not reproducible, we will appreciate if you could send us a sample project where we could reproduce the issue and inspect its configuration.
Regards,
Neli
Progress Telerik
I was able to reproduce with a new project. With VS 2017 15.5.7
After step 5 the following appears in the "Error List" tab:
Warning CS1702 Assuming assembly reference 'System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' used by 'Kendo.Mvc' matches identity 'System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' of 'System.Web.Mvc', you may need to supply runtime policy ...\Views\Home\Index.cshtml 33 Active
The warnings are coming from the Kendo DLLs and they are looking for assembly reference 'System.Web.Mvc, Version=5.2.3.0".
I downloaded the latest Kendo MVC source from your site and it's not using the latest MVC or Razor based upon the packages folder.
Are you not using DLLs in the packages folder? If you are, then that's the problem.
Also, adding this to web.config, does seem to suppress the warning for me, even when opening views.
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" compilerOptions="/nowarn:1702" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v4.0" />
<providerOption name="WarnAsError" value="false" />
</compiler>
</compilers>
</system.codedom>
Also, adding this to web.config suppresses the warnings, even for views.
Under system.codedom / compilers / compiler, add compilerOptions="/nowarn:1702"
To be clear, I am saying the Kendo DLL build is the problem, not developer builds.
I pulled down the latest source today. If I open up the project file named Kendo.Mvc.csproj and look at line 234, this is what I see:
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
To me, this is the problem.