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.
Related
Currently I'm playing with sitecore 7. I followed this blog to setup my visual studio with the sitecore.
Everything is fine until when I tried to create a sc:placeholder on the aspx.
It throws this error regardless whatever sitecore control I have tried to insert:
Error 180 The type or namespace name 'Web' does not exist in the namespace 'Sitecore' (are you missing an assembly reference?)
C:\inetpub\wwwroot\abc Sc7\Website\layouts\Customized\MainLayout.aspx.designer.cs
I tried to create a placeholder using code behind, no error was thrown.
I have tried to create an empty web application project. And added a reference to only Sitecore.Kernel.dll
I created a dummy page to test out the reference to the dll thing.
It still throws the same errors.
I know the blog mentions it, but have you added a reference to the "Sitecore.Kernel" DLL in your project? Open your references folder and ensure that there is not a problem with the reference.
Make sure your project is using .net 4.5 (you will need to use something other than VS2010)
After default sitecore installtion Sitecore.Kernel assembly is placed in bin folder. Maybe you used 'Clean project' and after this operation your assembly was deleted. Please check if this assembly is present in bin folder. It should be loaded by IIS automatically from bin folder, even if you have wrong reference in you csproj file.
When I start new project I always move dlls from bin folder to other folder, and put references to this files in csproj, so when I run clean project (or clean solution from VS) i have empty folder (only one file is present - *.lic file).
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.
I am getting a build error when I attempt to build my asp.net application. The error is:
The type 'MediCare.Framework.Authentication.IUserAuthenticate' is defined in an assembly that is not referenced. You must add a reference to assembly 'MediCare.Framework, Version=1.0.1.95, Culture=neutral, PublicKeyToken=1999fa3c42b9'.
I can see the class in the library which is in the references folder. How do I debug this issue?
My intention is to point the references folder to the library source code's bin directory (since the pdb file is lcoated there and any updates to the library will reflect in the application). However, when I point the references folder to the bin directory of the source code, I get the error message above.
Update The application was originally developed in VS 2008 and I am modifying it in 2010. I think I am confused about where the GAC assemblies would be, if I am using VS 2010 (2.0 framework location or 4.0 framework location) ? .NET 4.0 has a new GAC, why?
Update (06-26-2012)
The file in the GAC ("C:\Windows\assembly\") has been deleted. But this error is still occuring.
This could possibly be caused by version inconsistencies. Meaning, in order to fix this, I would do a complete clean build of your assemblies (and also an assemblies that might be nested inside an assembly). Just go out cold and do a new build on all assemblies. That should work.
Go into windows explorer, right click on the DLL file that your project is using that contains this class, and look at the version tab. Make sure version number matches what you see in the error message. My guess is that it won't.
If it does match, then check the GAC and make sure there isn't a different version of the DLL there that it could be picking up. To do that, go to windows explorer, and navigate to c:\windows\assembly. See if that assembly is in there with a different version number. If it is, you may need to delete it from the GAC (use caution though because other apps may depend on it being there).
I have a Visual Studio 2010 solution with two projects:
An ASP.NET MVC 3 web application.
A class library.
The MVC application has a project reference to the class library.
When I use the "Build Deployment Package" option in Visual Studio to build the zip file with my web application for deployment, it does not include the class library. Thus, after deploying, I get an exception due to the missing assembly.
I have verified that the project reference is set to "Copy Local = true." When you build and debug the site, things work fine and the class library is in the bin folder. It's only when you build the deployment package that it goes missing.
If I switch from a project reference to a direct assembly reference, pointing to the bin/Debug/ClassLibrary.dll file, the package properly builds and includes the class library. I only see the issue when it's a project reference.
How can I get the class library as a project reference to be properly included in the web application package?
I'm not sure how to fix this if you're doing the deploy from VS.NET, but I did figure out how to do it from a MSBuild script.
The basic syntax to create an MSDeploy/WebDeploy .zip package for a .csproj in MSBuild is like this:
<MSBuild Projects="Path\To\Project.csproj"
Targets="ResolveReferences;Package"
Properties="Configuration=Release;DeployOnBuild=true;DeployTarget=Package;PackageLocation=Path\To\Output.zip" />
Note the Targets="ResolveReferences;Package". I started with Targets="Package", but that only half works.
Apparently, if you want to get the assemblies created from project references, you need to call ResolveReferences first. Just building the package won't do that, and you'll be missing any assemblies that are included in the project output as the result of project references.
Is it something silly like only having client profile on the class library?
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