Error message about existing - asp.net

I'm using VS 2010 with ASP.net MVC 2.
I recieved a program that was completed and when I was debugging the program I recieve an error message.
"Error 4 The type 'System.Web.Routing.RouteTable' exists in both 'C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll' and 'C:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\lib\AspNetMvc\System.Web.Routing.dll' C:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\src\Chapter01\GuestBook\Global.asax.cs"
and
"Error 1 The type 'System.Web.Routing.RequestContext' exists in both 'c:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll' and 'c:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\lib\AspNetMvc\System.Web.Routing.dll' C:\Documents and Settings\Vincent\Desktop\3\Manning.ASP.NET.MVC.2.in.Action.Jun.2010\aspnetmvc2inaction_code\src\Chapter01\GuestBook\Controllers\AccountController.cs".
The program was converted into VS 2010 format.
What should I do?
// Fullmetalboy

When you convert a project from .Net 2.0/3.5 to 4.0 in VS2010 the web projects will prompt you to upgrade the framework to 4.0 but you will need to manually go into the project properties and upgrade class library projects and certain other projects manually in the project properties. So this type of error is probably caused by your web project referencing the 4.0 version of System.Web.Routing but a class library in your solution is still referencing the 3.5 version.

One of the projects in your solution is referencing a single type (RouteTable/RequestContext) in two different places. I always start with cleaning and rebuilding the solution, but if that doesn't fix it, you're going to have to check the project references and resolve it that way. If all else fails, try to make a new project from scratch and manually add the references and projects you need and then copy and paste your old code.

Someone copied the ASP.NET MVC source code into the "lib" folder of your application and either included that folder in the project (so it is getting built when you build your project) or he/she built it before you got it and referenced it from within the project. Now it is in conflict with the ASP.NET libraries that exist in default installation folder on the system 'c:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.dll'.

Since you're using the .NET 4.0 Framework, the library System.Web.Routing is ambiguous. Make sure you have referenced System.Web.dll (version 4.0) and remove the reference to System.Web.Routing.dll

Related

Copy Visual Studio Project - Compilation Error

I have an ASP.Net MVC 5 project inside a Visual Studio 2015 solution. I needed an exact copy of the project so in the File Explorer I copied the project and pasted to create a new project.
I renamed the copied project so that both projects now have a different name. I also updated the Namespaces inside of any classes in the copied project to reflect the new project name.
MyProjects.ProjectOne
MyProjects.ProjectTwo
I also deleted the Bin directory in the newly copied project. Both projects are targeted at the .Net Framework 4.0. I've restarted Visual Studio, but I still get the following compilation error when I now try to run either Project:
Compiler Error Message: CS0234: The type or namespace name 'ProjectOne' does not exist in the namespace 'MyProjects' (are you missing an assembly reference?)
I'm running out of ideas with regards to solving this.
Any advice would be greatly appreciated.
Thanks.
Make sure that the project which you copied has the correct references, and that the versions of the assemblies are the same as on the old project. You can also use the Object Browser to inspect an assembly and verify whether it contains the types that you expect it to contain.
For more information, see Troubleshooting .NET Framework Targeting Errors.

error when deployed to azure

When i Publish my project i m getting this error:
error CS0009: Metadata file
'D:\home\site\approot\packages\Microsoft.ApplicationInsights\1.1.1-beta\lib\net45\Microsoft.ApplicationInsights.dll'
could not be opened -- Invalid COR20 header signature.
(I m using asp.net core 1)
Did Someone knows or has experienced the same problem?
Thanks
This problem can occur when you have added a third-party DLL to your application and have not properly added it to your compiler’s project file or references list.
If that's the case this might work:
Open your project in Visual Studio .NET. Make sure the DLL exists and has been properly added to the reference list. If you are using VBC or CSC to compile your project, check your application’s CompileApplication.rsp file to make sure the DLL is in the /references list like the other DLLs.
Your DLL may not be compatible with .NET or with .NET’s 32-bit mode. Ensure that your DLL is .NET compatible.
If your project still won’t compile properly, try switching your application’s compiler selection in Iron Speed Designer’s Application Wizard from 'vbc.exe' or ‘csc.exe’ to Visual Studio .NET or vice versa. Using Visual Studio .NET will take longer to build than .NET’s VBC or CSC built-in compilers, but Visual Studio .NET will resolve all of the references properly without having to change your application’s CompileApplication.rsp file.

ASP.NET Webforms Project created with VS2012 RC does not run in VS2012 RTM

I used the RC version of Visual Studio 2012 to create an ASP.NET Webforms project and I intentionally took the 4.0 version of .Net and of the project template to avoid complications after the release of VS2012.
Now I anyway bumped into the problem, that is revealed in the following error message:
'jquery' is not a valid script name. The name must end in '.js'.
As I noticed in the references, following assembly references are broken:
Microsoft.ScriptManager.jQuery
Microsoft.ScriptManager.jQuery.UI.Component
System.Web.Providers
I tried to re-install jQuery using NuGet but did not find these assemblies.
If I now create a new .Net 4.0 ASP.NET Webforms project in Visual Studio 2012 I get a lot of new references which are not present in my current (originally created in the RC-version, now opened in VS2012 RTM), like:
AspNet.ScriptManager.jQuery
AspNet.ScriptManager.jQuery.UI.Combined
but I can't find them among reference sources if I try to add a new reference to my original project.
How can I make my application runnable in VS2012?
Check packages
AspNet.ScriptManager.jQuery.1.7.1
AspNet.ScriptManager.jQuery.UI.Combined.1.8.20
make sure the following dlls are in the lib folder
AspNet.ScriptManager.jQuery.dll
AspNet.ScriptManager.jQuery.UI.Combined.dll
And check the reference in your project to make sure all references are resolved.
Sometimes, the dlls didn't added to the source control and when you do a get latest from the source control these two dlls are missing.

What is my problem with ASP.NET pubslishing?

I am done testing my site and I want to upload it to a site like this
http://www.university.edu/mydepartment/myname
the admin told me the server runs on .NET 3.5. So i used Linq ...
now i tried to upload the site by two ways:
when i just copy everything (with modification of web.config database settings) i get an error:
CS0246: The type or namespace name
'DataClassesDataContext' could not be
found (are you missing a using
directive or an assembly reference?)
Version Information: Microsoft .NET
Framework Version:2.0.50727.3082;
ASP.NET Version:2.0.50727.3082
Note here it says version 2.0
did he just lie to me? or its my configuration mistake?
anyway, i added the reference, nothing changes.
I tried also publishing (Build, publish) with option to keep the pre-comiled site updatable, and I get one line saying:
this is a makefile and should be
deleted!
what is going on?
It looks like it can't find your DBML file, or your DBML file isn't called "DataClasses.dbml". Also, the .NET Framework Version is not lying. It is reporting the CLR version, which is still 2.0 for the 3.5 .NET Framework.

asp.net mvc 2 method not found

When I run my asp.net mvc 2 site (shared hosting) I get the following error:
Method not found: 'Void System.Web.Mvc.DataAnnotationsModelValidatorProvider.
set_AddImplicitRequiredAttributeForValueTypes(Boolean)'.
In the bin directory I have System.Web.Mvc.dll version 2.0.50217.0
On my local dev machine it runs fine.
Is it possible that if the hosting provider has a different mvc 2 version installed it would cause this error?
The official System.Web.Mvc is version 2.0.0.0. It seems that you are using some custom built version - 2.0.50217.0 that might be missing this method. Try deploying your application without the assembly in the bin folder.
I think a better way would be to copy the ASP.NET MVC 2 dll into your code directory(where ever you put your dependencies) and reference it from there. This way you can avoid this type of errors if the hosting machine doesn't have ASP.NET MVC 2 installed on it.
Thanks all for your help,
A referenced project had a different version in the bin folder (even though I cleaned the solution and set also the that project to reference the dll in the dependencies folder, it still copied the one from the bin folder).
After deleting that one and rebuilding, redeployed dlls and it ran.

Resources