AJAX error - Indirect reference is being made to assembly - ajax

I'm upgrading a project from the v2.0 framework to the v4.5.1 framework and I'm getting the following error...
Indirect reference is being made to assembly System.Web.Extensions version 4.0.0.0, which contains 'AjaxControlToolkit.MaskedEditExtender'. This Project references a prior version of System.Web.Extensions version 1.0.61025.0. To use 'AjaxControlToolkit.MaskedEditExtender', you must replace the reference to System.Web.Extensions with version 4.0.0.0 or higher.
My question is what do I need to change in my web.config so that my project will compile?

Keith,
In order to resolve this issue you need to change the target framework from 2.0 to 4.0 or later (In your case 4.5.1) in the solution's properties.
Once you have done this rebuild your solution web.config settings should work again.

Related

The name 'Sitecore' does not exist in the current context

I have a new instance of Sitecore 9. I'm trying to create my first component, an ascx file with a codebehind file, and I have this line:
var item = Sitecore.Context.Item;
The build is failing with the error "The name 'Sitecore' does not exist in the current context"
please make sure that you have added the reference to "Sitecore.Kernel.dll". i would suggest you to also checkout the nuget packages provided from Sitecore:
Sitecore Nuget Feeds
Depending on your deployment Strategy it would be a good practice to use the nuget. Sitecore has created every nuget package with ".NoReferences" extension for example : "Sitecore.Kernel.NoReferences" which is great for dependency management.
If you are using MVC you will need also "Sitecore.Mvc.dll".
In my case, I had a error specification in the output window for this error which turned out to be an hint to solve this error.
The .NET framework version of my visual studio project was targeted at v4.6.1, updating the project's target framework to v4.6.2 fixed my error : "The name 'Sitecore' does not exist in the current context"!
It seems that the Sitecore.kernel.dll (responsible for using term 'Sitecore' for reference in code like controllers) with version 11.1.0.0 was built against the ".NETFramework,Version=v4.6.2" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.6.1" (of my visual studio project).
Here is the error specification (hint!) in my VS output window that I mentioned earlier:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3274: The primary reference "Sitecore.Kernel, Version=11.1.0.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.6.2" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.6.1".

Kendoui Mvc samples and dll version

I have downloaded the KendoUI sample from
http://docs.telerik.com/kendo-ui/aspnet-mvc/tutorial-saleshub/kendo-saleshub-intro
I have: *VisualStudio 2013 AND *KendoUI trial version: 2014.2.903.545
In references section of this sample, Kendo.Mvc was marked yellow therefore i replaced it by adding mine version. Still I am getting following error.
Warning 1 The primary reference "Kendo.Mvc" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0". SalesHub.Client
How can i get the older version to run this sample? Or these sample are simply obsolete and no more maintained. I am facing same issues nearly with all the samples downloaded. If i upgrade the sample project to higher version of .NET framework then obviously other packages started to cry.
Warning 10 Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. SalesHub.Client
--
All you need to do is change the target framework for the project.
If you right click the project go to properties and select application you will probably see that the project is targeting the 4.0 framework.
Just change this to 4.5 and the project should build and run for you.

Is it possible to reference different NuGet package versions in a Visual Studio solution?

We are a team composed of 7 members and we want to create a Cloud Application (Windows Azure) with Visual Studio. Our application is hosted on GitHub so we have choose to use NuGet packages to keep our repository light as possible.
However two different projects in our Visual Studio solution need reference either Newtonsoft.Json version 4.0.2 or Newtonsoft.Json version 4.5.11.
We have tried to reference the right version for each project but we get this errors on build:
The type 'Newtonsoft.Json.Linq.JObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'Newtonsoft.Json, Version=4.0.2.0, Culture=neutral, PublicKeyToken=null'.
Cannot implicitly convert type 'Newtonsoft.Json.Linq.JObject' to 'Newtonsoft.Json.Linq.JObject'
The second error suggests that there are conflicts between the two versions even if no project in our solution references the two version at the same time.
Do you have any idea to solve this problem?
Thanks.
PS: Here are the most relevant information we have found about this issue.
http://docs.nuget.org/docs/reference/known-issues
https://stackoverflow.com/search?q=NuGet+multi+packages+version
After a while... Know that we have rewrite the piece of code which use the old reference to Newtonsoft.Json version 4.0.2.
Thanks.

EF 4.1 to EF 4.3.1: Something is still referencing 4.1, but can't find it

Setup:
I have an app that is a copy of another app, that worked with EF 4.1. In the new app, I have added a nuget package reference to EF 4.3.1 in a domain project.
All works on my local machine, but on the server throws the following error:
Could not load file or assembly 'EntityFramework, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Clearly, something is still referencing the old entity framework 4.1, but the only dll it finds is the EF 4.3.1 dll.
There are no references to EntityFramework in the web.config.
Question:
How do I find what is still referencing the old dll?
I have removed all EF references from all projects in the solution and added the EF 4.3.1 package to each project, but still no joy.
Notes:
I could try a binding redirect using the dependentAssembly (see accepted answer in this SO question)
However, I can't find what names and tokens to use.
Still, it would be better to get to the route of the problem, rather than just redirecting a binding.
Have you recompiled the application after changing the reference, or just uploaded the new EntityFramework.dll file? It's possible the application's library is still referencing the old version in your production environment. Do a re-compile and re-publish.
EDIT (see comments) : Open all your .csproj files in notepad and look for the Reference tags, double check that the old version doesn't exist in all the projects.

AjaxControlToolkit.CalendarExtender and System.Web.Extentions version error

I have VS 2005, 2008 on my dev box.
New project from other developers who only have 2005 installed. When I build it I get error.
Error 1 Indirect reference is being made to assembly
System.Web.Extensions version 3.5.0.0, which contains
'AjaxControlToolkit.CalendarExtender'. This Project references a prior
version of System.Web.Extensions version 1.0.61025.0. To use
'AjaxControlToolkit.CalendarExtender', you must replace the reference
to System.Web.Extensions with version 3.5.0.0 or higher.
When I change the version of Web.Extentions to 3.5 I get another failure
Could not load file or assembly 'AjaxControlToolkit,
Version=1.0.20229.23876, Culture=neutral,
PublicKeyToken=28f01b0e84b6d53e' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
Should I change the Public key for:
add assembly="System.Web.Extensions, Version=1.0.61025.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35"
to the newer one, or is this the wrong thing to do. the Server does NOT have 3.5 runtime.
TIA
If your server doesn't have the 3.5 runtime and you aren't able to install it, I suppose you must stick with the 1.0.61025.0 version of System.Web.Extensions.
I would guess that the problem you are encountering is because the AjaxControlToolkit dll that you are using was built with the 3.5 runtime. Thus, your project is referring both to the 1.0.6... version directly and to the 3.5 version through the AjaxControlToolkit reference, and getting confused. You might try downloading the toolkit source and building it from scratch, referencing the 1.0.61025.0 version of System.Web.Extensions. Then make sure to reference this toolkit instead of the default one.
http://ajaxcontroltoolkit.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=11121
Also, you might try making sure that all the references to the System.Web.Extensions DLL version number are consistent, both in your project's references and in the web.config file. Note that if you have a reference selected, you can toggle the "SpecificVersion" property to True in the Properties panel; presumably this makes .NET more picky as to which DLL version it chooses.

Resources