we switched recently our asp.net 3.5 solution from VS 2008 to VS 2010 while still wanting it to be in .net 3.5 (as the deployment server runs on 3.5 only)
The libraries are ok, but the web site is causing us problems. The error message we get on every aspx page is like this:
D:\WebSites\.....aspx: ASP.NET runtime error: Could not load type 'Microsoft.Build.Framework.ITaskItem2' from assembly 'Microsoft.Build.Framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
I found out that the interface the compiler is looking for (ITaskItem2) is only available in .net 4.0, but it keeps looking for it in 3.5 assembly which is obviously wrong.
We were trying to locate where this discrepancy is originating, but with no luck.
It hinders our work significantly, because the intellisense is not working for asp components, also debugging of the web pages is not working.
But even when this error occurs in VS, the pages work ok when displaying them in browser (using IIS), so this is VS-only problem.
If you have any idea, what could be wrong here, please let me know.
Thanks
So, I managed to get things right after lots of experimenting.
The solution was to let the VS generate new standard web.config for web site and adding the few extra options we are using into it..
There are only 2 differences between the old and new web.config:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
was changed to
<runtime>
<assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
Not sure if this affects something.
But what seems more important, in the non-working web.config there was one additional section in <runtime>:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework"
publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
I am not a web.config guru and I do not see what's wrong with the provided section, but without it the things started to work miraculously.
Related
Problem: I want to deploy modified code into web server. web server is having IIS version set to V2.0. and now I have developed and published code on my local machine with version 4.0. (there is App_code.dll as part of all dll files).
Now whenever I am deploying all files along with App_code.dll I am getting following error:"
Could not load file or assembly 'App_Code' or one of its dependencies.
This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded"
1) My question is how do I build App_code.dll in older version.
2) I tried changing target framework to V2.0 while publishing but then its not working because AJAX functions from other dll are not compiling..
can anyone please suggest what to do to run the site..
Help is appreciated.
Thanks
Sorry about the answers I've given... But try this...
Try adding <codeBase> elements to the application config file to specify the exact location of each dll, and the version of .Net it requires. Apparently this works because <codebase> is checked BEFORE the probing heuristics kick in each time an assembly needs to be loaded.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="sharedlibA" culture="neutral" publicKeyToken="..." />
<codeBase version="1.0.0.0" href="bin\sharedlibA.dll" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="sharedlibB" culture="neutral" publicKeyToken="..." />
<codeBase version="1.0.0.0" href="bin\sharedlibB.dll" />
</dependentAssembly>
</assemblyBinding>
</runtime>
If that doesn't work try this.
Late answer but, I'm writing this for future viewers.
I had same error after publish the application to the Server.
I figure it out doing like this.
While publish there is configuration in Setting.
In publish section there is option called
Precompile during publishing
you have to check the checkbox and save then Publish. This will takes your code files .vb/.cs and converts them into a compiled DLL files.
In my case it was unchecked.
I'm having a problem with bindingRedirect in the web.config file for a website.
These are the circumstances. I have the 4.1.0.0 version of a third-party assembly. I have another third-party assembly that references version 4.0.0.0 of the first assembly. And I have a bindingRedirect in my web.config which causes 4.1.0.0 to be loaded when 4.0.0.0 is asked for. This works in my development environment and, until 5 days ago, it worked on the hosting company's server, where the production website is. But five days ago I started getting an error on the hosting company's server saying that version 4.1.0.0 could not be found -- in other words, suddenly my bindingRedirect was being ignored.
Since I haven't made any changes, I am assuming that something in the hosting company's environment changed. I'm trying to work with the hosting company's tech support team, but they don't seem to completely understand bindingRedirect and the question "what changed in your environment on Saturday?" is too broad for them to answer. Perhaps if I could pin down what sorts of changes could cause a bindingRedirect to stop working I might have a chance at getting their tech support team to dig a little more deeply on their end.
Thus, my primary question to this forum is "what could have changed in the environment that would cause the bindingRedirect to suddenly be ignored?" Could a change to machine.config have done it? What else could do it? I am not [yet] asking for actions I can take on my end to make it start working again -- I need more information before I try to fix it or ask for advice.
This is the relevant portion of the web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core"
publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0"
newVersion="4.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
I recently setup a new Windows 10 workstation , imported my IIS settings from previous windows 10 IIS.
Everything is setup correctly with IIS, however everytime I run a new project I get an error about Missing System.Web.WebPages.Deployment :
Could not load file or assembly 'System.Web.WebPages.Deployment, Version=1.0.0.0
The fix is simple, I just add the following to the web config.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-X.X.X.X" newVersion="X.X.X.X"/>
</dependentAssembly>
</assemblyBinding>
The problem is that now just because I'm having an issue I'm forcing a checkout on all projects and questions from other developers all of which do not have this issue. I've attempted to re-register .net framework like I did back in the day, however that's now part of Windows 10 to include 4.6.2
This is happening on older ASP.NET WebForms written in VS2013 with a mix of newer MVC apps written in VS 2015.
I've found nothing to address a System wide issue with this assembly.
Make sure you have System.Web.WebPages.Deployment.dll on your BIN folder.
I am currently working on an Asp.Net MVC web project. My project is being used on 3 different web servers, each with their own SQL database. Recently I have been having a very annoying bug that doesn't hurt anything, but wastes my time and is making me pull my hair out.
The issue only occurs when I switch between web servers (ie, when I want to quit publishing to Site A and publish the change to Site B also), or when I make a change to the web.config file in my project.
This is a look at how my connection strings are sorted in my web.config. When I need to publish to site or test changes via localhost, I simply just comment the current string, and uncomment the desired choice.
Web.config code (Server C is being user here)
<connectionStrings>
<!-- Server A-->
<!--add name="MyEntities" connectionString="******;user id=********;password=**********;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient"-->
<!--Server B-->
<!--add name="MyEntities" connectionString="******;user id=********;password=**********;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient"-->
<!--Server C-->
<add name="MyEntities" connectionString="******;user id=********;password=**********;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient"/>
</connectionstrings>
If i were to comment out Server C, and then uncomment Server A and build the project, this error would occur:
BindingRedirect is missing required field 'newVersion'
When I double click and check the error's location it leads me to this line of code:
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" nembnwVersion="5.5.0.0" />
As you can see, "newVersion" somehow was changed to "nembnwVersion = "5.5.0.0""...
I then have to correct the error and rebuild again. Once rebuilding I get a message saying that my file has been edited, and needs to be reloaded. I reload and the error occurs. This happens every single time I change the web.config or attempt to edit what server I am currently using. How can I stop my web.config to automatically changing "newVersion" to the random string of characters? As i mentioned, its not a project-breaking bug but it sure is very annoying and wastes my time.
I encountered binding redirect do working because of a missing namespace on the assemblyBinding element.
Correct Code:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CMS.CompanyValues" publicKeyToken="1a696d1f90f6158a"/>
<bindingRedirect oldVersion="1.0.0.0-1.0.3191.28836" newVersion="1.0.3191.28836"/>
</dependentAssembly>
Incorrect Code:
Note missing: xmlns="urn:schemas-microsoft-com:asm.v1"
<assemblyBinding>
<dependentAssembly>
<assemblyIdentity name="CMS.CompanyValues" publicKeyToken="1a696d1f90f6158a"/>
<bindingRedirect oldVersion="1.0.0.0-1.0.3191.28836" newVersion="1.0.3191.28836"/>
</dependentAssembly>
Hope it will helps you.
I've deployed a MVC 4.5 web site here
However, when I view the site in browser after deployment, I have to turn custom errors off to see the following error:
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly
'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or
one of its dependencies. The system cannot find the file specified.
I ensured that CopyLocal is set to True for the DLL in my References folder. What other changes need to be made for a successful deployment?
I was having this same issue today and I'm not completely sure what I did to fix it. So I'll try giving a detailed walk through of my process.
I tried deploying a default app out of VS13 and it was too bombing with this message. FAIL.
I then removed the Newtonsoft.Json assembly and manually added the 5.0.6 version I needed. I also made sure CopyToLocal was set to true. FAIL. My sadness grows.
I enabled NuGet Package Restore. FAIL. My sadness turns to anger.
I deleted my Azure site in a fit of rage, recreated it, and the republished out again. SUCCESS!!!
So, the only logical(ish) answer I think I can give is to delete your Azure website, recreate it, and then publish again.
I hope this helps someone.
I fixed this problem by redirecting the assembly version from 0.0.0.0-6.0.0.0 to 6.0.0.0
by adding a depententAssembly in Web.config:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- Add these 4 lines to Web.config, under runtime/assemblyBinding -->
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<!-- End of copy -->
</assemblyBinding>
</runtime>
<configuration>
You will find other dependentAssemblies there too, like System.Web.Mvc, WebGrease.
The newest version of Newtonsoft.Json is now 6.0.3. You may have to increase 6.0.0.0 later. Find the current newest version by looking at the version in the Solution Explorer. References -> Newton.Json -> (right click -> Properties) -> Version in the Property view
If you're sure CopyLocal is true, then the only other possibility is that you have project reference to a different assembly version than what's listed in your packages.config. Make sure the DLL version matches the version in the packages.config.