I installed gridmvc latest using nuget. Things work fine in my local environment but when i deploy it to production, I get this error. Please help.
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: CS1705: Assembly 'GridMvc, Version=2.0.4.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Source Error:
[No relevant source lines]
Source File: Line: 0
Show Detailed Compiler Output:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212
Try to clean & compile in release before publishing to production and let me know if the same issue happens to you.
Please follow the guide below: http://www.codeproject.com/Tips/597253/Using-the-Grid-MVC-in-ASP-NET-MVC
and make sure you've done the same steps while configuring your environment and code.
I hope the above will address you issue.
It's resolved now. All I had to do was, remove old referenced dll under References in this case (System.Web.Mvc 4.0.0.0). Add new reference System.Web.Mvc 4.0.0.1. Click on the new referenced dll, in the properties windows set Copy to Local = True.
The in my project's root web.config file, change the following
FROM
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
TO
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.1" />
</dependentAssembly>
Then do clean and rebuild. Then copy the new System.Web.Mvc (4.0.0.1) dll over to production.
Related
I upgraded my ASP.NET CORE application from sdk .NET Core 2.0 to .NET Core 2.1.
I can run the solution in my localhost but when I deploy it to another server there is an exception. And the exception is below.
The steps I have done to solve the issue so far are below and it throws the same error with all the modification that I did seems nothing works.
Does anybody have any suggestion how to solve this issue?
Steps I've done:
Modify the setting for the project
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Platforms>AnyCPU;x64</Platforms>
<RuntimeFrameworkVersion>2.1.0</RuntimeFrameworkVersion>
<UseNETCoreGenerator>true</UseNETCoreGenerator>
<RazorCompileOnBuild>true</RazorCompileOnBuild>
</PropertyGroup>
I also added binding redirect in the web.config
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"
bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.1.0"
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.1.0" />
</dependentAssembly>
</assemblyBinding>
Install .net core 2.1 on the server
I also deleted my .vs folder and close my visual studio and open it again.
Exception :
Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException: One or more compilation failures occurred:error CS1705: Assembly Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
I had same problem. When I added the Views folder from the solution to the publish folder then the problem went away. For some reason Razor requires these source files to be present in the server AND up-to-date even when it compiles them also into .dll. Therefore it is strange indeed that the Views folder is not automatically copied during publish.
I personally made a junction like this
junction "MyProject\bin\Release\netcoreapp2.1\linux-x64\publish\Views" "MyProject\Views"
Alternatively, disabling the following line might help (have not tested but this issue seems to be related since in earlier versions of Net.Core there was no Razor compilation).
<RazorCompileOnBuild>true</RazorCompileOnBuild>
to
<RazorCompileOnBuild>false</RazorCompileOnBuild>
after moved my MVC 4 project from VS 2012 to VS 2013 Community I get the following error (in the LogIn.cshtml page).
CS0433: The type 'System.Web.Mvc.WebViewPage "exists in the elements c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll and c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\v4.0_3.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll
I deleted all files from C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files, cleaned the solution but the problem remains. How to fix it ?
EDIT
The Test project used the MVC 3, that was the reason
If you have already tried the above solutions and are still getting the same problem then try this one->
Go to your project folder and in there locate the bin folder --> Remove System.Web.Mvc.dll and System.Web.Mvc.xml from there.
You could check in your web.config files.
Check if the version is the same as you're using as reference.
Application web.config file:
<add assembly="System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
and
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.1" />
And the Views web.config file:
<add assembly="System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
In my example, my MVC dll is the version 3.0.1. But Visual Studio built my solution as if it were 3.0.0. So I had to map the references in the web.config files to 3.0.1.
Check if you are referencing both DLLs to your project.
Your project is reading in two assemblies that might be referenced in your project:
System.Web.MVC version 4.0.0.0 and in System.Web.MVC version 3.0.0.0
In your root web.config, near the bottom, you will have something like the following:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="4.0.0.0-4.0.0.1" newVersion="4.0.0.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
For me, I simply changed the 'oldVersion' number to 1.0.0.0-4.0.0.1 so that this application will always use the 'newVersion'.
I am asp.net death page, this is coming after i upgraded webgrease and bootstrap for mvc4 using nuget.
Server Error in '/' Application.
Could not load file or assembly 'WebGrease' or one of its
dependencies. Strong name signature could not be verified. The
assembly may have been tampered with, or it was delay signed but not
fully signed with the correct private key. (Exception from HRESULT:
0x80131045) Description: An unhandled exception occurred during the
execution of the current web request. Please review the stack trace
for more information about the error and where it originated in the
code.
Exception Details: System.IO.FileLoadException: Could not load file
or assembly 'WebGrease' or one of its dependencies. Strong name
signature could not be verified. The assembly may have been tampered
with, or it was delay signed but not fully signed with the correct
private key. (Exception from HRESULT: 0x80131045)
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'WebGrease' could not be loaded.
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.18045
Force uninstall the package using Package Manager Console
uninstall-package -f WebGrease
then install the previous version 1.3.0 using the following command
install-package WebGrease -Version 1.3.0
Open your Web.config file and replace below dependency under runtime tag
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
I had to add the following code in web.config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
...
I had the same error. It was happened because nuget updated WebGrease dll but didn't update a web.config file (especial version of used dll).
So I changed next line in my web.config:
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
to
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
Number of version (1.6.5135.21930) I took from dll properties.
After this everything works correct.
We’re aware of an error in the assembly’s strong name signature and so we’re actively working to release an updated version as soon as possible. For now, we have unlisted the WebGrease 1.5.1 package from nuget.org.
Try this: Check if the above dll's are in GAC. If so, in your custom app bin folder check if the above dll's are present if so remove them from your reference.
This occurs in ASP.Net MVC 4 project.
I found an excellent suggestion to view MSBuild detailed output here. Seems like System.Web.Providers.dll is referencing 4.5.0.0 causing this error.
I attempted a Binding redirect in web.config under runtime -> assemblyBinding
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="1.0.0.0-4.4.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
When I rebuilt the project, I still got the below message:
Consider app.config remapping of assembly "EntityFramework,
Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version
"4.4.0.0" [] to Version "5.0.0.0"
[C:\Rhipheus\Cloudlene.Rhipheus\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll]
to solve conflict and get rid of warning.
I extended redirect to 4.5.0.0:
Consider app.config remapping of assembly "EntityFramework,
Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version
"4.5.0.0" [] to Version "5.0.0.0"
[C:\Rhipheus\Cloudlene.Rhipheus\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll]
to solve conflict and get rid of warning.
Same message but now the version reported is 4.5.0.0. I took the redirect up to 4.9.0.0 to no avail (same message with just the version's bumped matching my redirect).
Can someone point me to what I'm doing wrong? I appreciate in advance for not closing this as not constructive ;)
OK. Once I included 5.0.0.0, the warning went away. Guess, binding redirect must not only redirect older references but the 'primary reference' too.
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
I receive the following two errors when I try to compile my MVC4 web project:
CA0058 Error Running Code Analysis CA0058 : The referenced assembly 'DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' could not be found. This assembly is required for analysis and was referenced by: C:\Users\bflynn\Visual Studio Sites\mnp\bin\mnp.dll, C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\Microsoft.Web.WebPages.OAuth.dll. [Errors and Warnings] (Global)
and
CA0001 Error Running Code Analysis CA0001 : The following error was encountered while reading module 'Microsoft.Web.WebPages.OAuth': Assembly reference cannot be resolved: DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246. [Errors and Warnings] (Global)
I recently added the DotNetOpenAuth.AspNet package to the application, and it seems tied to that. I have Cleaned, Rebuilt, Open/Closed the program, Uninstalled/Re-installed the package, yet the errors persists.
I just ran into this too.
Don't upgrade DOA to 4.1
It looks like the aspnet dll has a specific version referenced. Altough it's .nuspec file says 4.0+ is ok...
Solution:
Uninstall-Package -Force each DotNetOpenAuth package (core /aspnet /oauth/openid etc)
Install-Package DotNetOpenAuth.AspNet -Version 4.0.4.12182
I used this to resolve the issue:
1. Uninstall-Package Microsoft.AspNet.WebPages.OAuth –RemoveDependencies
2. Install-Package DotNetOpenAuth.AspNet -Version 4.0.4.12182
3. Install-Package Microsoft.AspNet.WebPages.OAuth
I ran into the same issue the other day and reported it http://aspnetwebstack.codeplex.com/workitem/443
Problem was reported on 21. september 2012. (http://aspnetwebstack.codeplex.com/workitem/443)
It was closed on 5. june 2013 with message:
The next version of MVC will not have a dependency on DotNetOpenAuth. Use the recommended workarounds below.
So I used the workaround https://stackoverflow.com/a/12847018/1016682
Code Analysis error Could not load file or assembly 'System.Net.Http, Version=2.0.0.0 in MVC4 Web API
See Yao's answer. The only solution I found that actually works for this.
I had the same issue. Though the code analysis issue got fixed, the web application wouldn't run because of the following error.
Could not load file or assembly 'DotNetOpenAuth.AspNet' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
It turned that the web.config was not cleaned as part of the uninstall.
I had to remove the following dependentAssembly from web.config under the runtime/assemblyBinding section.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
</dependentAssembly>
</assemblyBinding>
</runtime>
The details can be read in http://www.bigcode.net/2013/07/error-running-code-analysis-in-vs2012.html