I got the following error: "An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately."
Parser Error Message: `Could not load type 'nadeem.MvcApplication'`.
Source Error: Line 1: <%# Application Codebehind="Global.asax.cs" Inherits="nadeem.MvcApplication" Language="C#" %>
Right-click your Global.asax file and click View Markup. You will see the attribute Inherits="nadeem.MvcApplication". This means that your Global.asax file is trying to inherit from the type nadeem.MvcApplication.
Now double click your Global.asax file and see what the class name specified in your Global.asax.cs file is. It should look something like this:
namespace nadeem
{
public class MvcApplication: System.Web.HttpApplication
{
....
If it doesn't, then you will receive the error you received. The value in the Inherits attribute of your Global.asax file must match a type that is derived from System.Web.HttpApplication.
I had this exact same issue when I downloaded the project source into two locations. The issue turned out to be by downloading the source it altered the sites virtual directory location and since I had not rebuilt the second source there were no DLLs there.
To fix this issue open the project you wish to build and go to the
web sites properties (Project menu)
Create the virtual directory for
the project.
rebuild the project.
Fixed
After going through all of my projects in my Solution to set the compile to output to bin\debug and bin\release, this problem started for me. I finally realized that the startup project (i.e. the project with global.asax) needed to output to bin only.
Since normally you create an MVC project the Global.asax markup has something like the following:
<%# Application Codebehind="Global.asax.cs" Inherits="StackOverflow.MvcApplication" Language="C#" %>
Have you placed the Global.asax.cs in another project? If you have remove the CodeBehind="..." declaration from Global.asax and change the Inherits="..." declaration to reference the correct namespace and classname as it is defined in Global.asax.cs file.
If you haven't moved it try a Clean and then Rebuild of the Project in Visual Studio using the context Menu on the Web project. That worked for me when I got this error.
Go to Project Properties
Look Output Path in the Page bottom
Change path to: bin\
Save and Run Project
The case is solved, but you may also get this error if your project is building to a different directory than IIS_Virtual_Directory\bin and dlls are missing.
As Kevin answered. I was changing the project name and namespacing in my MVC project. When I ran the application I got the same error "Line 1: <% .....".
To fix this, I needed to update the namespace within Global.asax (Right Click -> View Markup) then in the Inherits attribute update this to "<correct root namespace for MVC project>.MvcApplication".
For me Deleting the dlls from the BIN folder and then building the project worked
simply just copy the project to another location and run it will work i think problem because of the cleaning is not correctly done and there may be setup change in the output /bin
When I got this error it was after I deleted and recloned a Git folder; what happened was I forgot to build the solution in VS2010. As soon as I built it, everything worked fine. Sometimes it's something really simple like that.
In my situation I was getting this same error. I am using git along with Source Tree for version control. In my case git had been enabled in the project, but I wasn't using Visual Studio to stage my commits, etc .. I was using Source Tree. This doesn't really matter what I was using the problem is that visual studio had put the following line into my gitignore file:
#Build Results
[Bb]in/
That was ignoring the bin folder so my bin folder never got pushed up to the server, once I removed that line and committed the entire bin directory and pushed it up to the server and then went to the server and did a git pull. The bin folder showed up and everything started working!
BTW, my final gitignore file (#Build results) section ended up looking like this:
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Oo]bj/
Im still unsure if I need the Obj folder to be pushed to the server, but everything is working fine now.
In my case the solution was the next:
Verify the markup of Global.asax, in the attribute Inherits I had this Inherits="NameOfMyProject.Global"
Then, verify the Global.asax.cs and I found this:
public class Global_asax : System.Web.HttpApplication
Therefore, I changed the attribute Inherits in my Global.asax, and finally the markup was the next:
Inherits="NameOfMyProject.Global_asax"
Also, I started the: ASP.NET state service, in the Administrative Tools. Then, my app run normally.
I was learning from a video resource and ran into this error when told to hit Ctrl-F5 in the View in order to load it directly. By doing this, I ran into the same error message you posted.
In order to fix this, I built the solution (Build > Build Solution or Ctrl+Shift+B) and then retried.
In my case, it helps:
if you use a folder other than the default project ( naprmer on the D drive , in the case of Windows), then change to the default folder , create the project , run it. Then again, you can create projects in the folder in which you want . Strange. But this has helped in my case.
This happened to me when i was trying to merge two solutions.
the problem was the namespace was not well configured in all files.
one part of story solved with #Kevin Aenmey answer but many other's ... not!
so the only way for me was to search for old namespace in the whole solution and replace them all with new namespace.maybe not the best option but in case of bad luck works nice
This error causes when Namespace is Renamed.
-
Go to Folder Explore ( Don't Use Solution Explore) . Find Global.asax File
.
Open File (in Notepad / any editor) and Change Replace Old namespace name New Namespace
.
Save It should work now..
I had the same problem and that was because I didn't build the solution. Rookie mistake. Just: build solution (Ctrl + shift + b)
I had this problem after adding a new project to my solution. The solution built, no problem - but then bombed at runtime.
It turned out that the new project was set to target .NET 4.6.1 by default, whereas everything else in mhy solution targets .NET 4.5.
Changing the target framework in the new project to .NET 4.5 to match the others fixed the problem.
(thanks for no warning on that one Microsoft guys)
I use FTP to upload DLLs of my site on the server but sometimes this error happen when the main DLL of the website has not been uploaded correctly on the server.
So I recommend you to rebuild you project and re-upload main DLLs on the server again.
In our case - deleting all the contents of a published intranet site, and republishing the project that worked fine in debug fixed the problem.
Related
I created a project, lets say named AddonLib, which is part of a big solution. For some unknown reason, the folder where the source code was put was named AddonLib_1. I've been trying to get rid of that "_1" for too long now and is driving me crazy. Things I've tried:
removed the project, from TFS and the solution. Renamed the directory. When I try to add the project again, I get the message "The project file "blabla\AddonLib_1\AddonLib.vcxproj" has been moved, renamed or is not on your computer".
Edited the xml file of the solution. Check the project file just to be sure. Removed any trace of the project with and without _1. The project AddonLib is no longer part of the solution. Try to add it back again, same error as before.
Cleared the VS cache following the instructions here. Repeated previous step. Same error.
I cannot find any reference to AddonLib_1 on my code, xml files, anything. But everytime I try to load the project, I get the same error.
Looking for the string "AddonLib_1" using findstr gives no results...
This causes the build to break. Even if there are no references (that I can find) to AddonLib_1, when building in the server I get an error "project AddonLib_1/AddonLib.vcxproj could not be found blablabla"....
Besides the solution xml file, the project xml file, the xml files of the few projects that depend on this project, where else can the information that once the project was in the directory AddonLib_1 ?
More info:
I can remove the project. Remove it from TFS, from the solution, and delete the directory. Create a new project with the desired name. Add the source and header files. Now, I need to add some info to the project xml file. If I open the xml file and edit, when I try to load back the project (Which was loaded before!) I get the same error message. If I open the xml again, undo the minor change I did, I still get the error. Again, this is in a new project, starting from zero.
I was able to solve this issue by removing the .suo file as described in this apparently unrelated answer
I'm attempting to publish a ClickOnce Office Extension project (VS2010). By default the output folder of ClickOnce has a child folder (with each version of the binary files) named "Application Files." I need to change this to something without a space in the name, for example "AppFiles."
I haven't found any place in the docs where this is explained and the few answers I have found have said to use Mage to manually modify .VSTO file next to the bootstrap setup.exe. I'd like to avoid that if at all possible.
What is the best way to go about changing this?
I have tried a few different things. Instead of using the built in Microsoft.Common.props, In a copy of Microsoft.Common.targets I've modified the _DeploymentApplicationFolderName property inside the _CopyFilesToPublishFolder target to "Application_Files." Also in a copy of Microsoft.VisualStudio.Tools.Office.targets, I've modified the Value of the ApplicationFilesFolderName property set inside InitializePublishProperties to "Application_Files."
Even after doing that, when I publish I get the following error:
Error 121 Publish failed with the following error: Could not find a part of the path '<path to output directory>\app.publish\Application Files\ProjectStats_1_0_0_15'.
I'm guessing the problem is this is happening when the copy from the output dir to the publish dir happens but I don't know. Either way, the output directory hierarchy seems fine and the VSTO refers to the proper path in the hierarchy for the relevant dlls. It's just the publish process fails.
It turns out there's no way to fix this and still use the Publish wizard in Visual Studio. After looking at the code for the Publish method in Microsoft.VisualStudio.Tools.Applications.Project.ClickOnceProvider.BuildManager class in the Microsoft.VisualStudio.Tools.Applications.Project.dll assembly, the directory name "Application Files" is hard coded. There is no way to automatically fix this from what I can tell.
I have a Setup deployment project in VS 2010.
The project compiles perfectly with the GUI interface of VS 2010, but any time I trying to compile it via vs cmd (devenv.com) it comes up with this error:
ERROR: Unable to update the dependencies of the project.
Notice that there is NO dll that mentioned in the error (e.g. the error does NOT contain "The dependencies for the object ‘xxx’ cannot be determined").
Please do not tell me to clean all the files in this setup and start from ground up - this is not a real solution!
I have 5 projects with this exact error, and I don't want to re-arrange each one.
More then that, this does not promise me that the problem will not re-occur in the future.
Thanks very much!
I used to rebuild these installer projects from scratch when they stopped working (for whatever reason), but I've found a much much quicker (and less error-prone) workaround. It works for me. Maybe it will work for you.
Remove the Installer project from your solution through the IDE
interface
Add the Installer project back into your solution (Add >
Existing Project...)
Rebuild
It works practically every time for me...
The hotfix didn't fix the issue on my computer (tried on two computers, rebooted all that jazz)
Instead I used source control to figure out what happened to my .vdproj.
It appears extra corrupt entries are added to the "File" section of the .vdproj.
Suppose you are getting an error such as
ERROR: Unable to update the dependencies of the project. The dependencies for the object 'AutoMapper.DLL' cannot be determined.
In your .vdproj search for AutoMapper and you should come across several { } where it is used.
A normal one looks like this:
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_263299FB43D185D41A44FBEE0253D3ED"
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:AutoMapper, Version=1.1.0.188, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_263299FB43D185D41A44FBEE0253D3ED"
{
"Name" = "8:AutoMapper.DLL"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:AutoMapper.DLL"
whereas a corrupt chunk is missing the name of the dll (AutoMapper.DLL in this case) in the ScatterAssemblies section.
Remove this corrupt entry, that is the entire section starting from "{9F6F8455-.. down to the next chunk.
I fixed this by editing the vdproj by hand and removing the Hierachy and File sections and then rebuilding the vdproj
see: Setup project error: Unable to update the dependencies of the project
This worked for me:
Run a clean solution command from VS2010
Open source code folder in explorer
Search for *.exe files, sort by location
Manually delete all files in Release folder
If there exists some_project.vshost.exe locked up file, open properties of this project in VS, and uncheck "Enable the Visual Studio hosting process" under debug. Then remove it as well. It should build now.
This is copied from #timB33's external link, which works. All links to the MS hotfix appear to broken, so this was the only way I could find to fix without removing and recreating the setup project.
I have consistently used this method to get around this bug instead of rebuilding my setup projects. This applies to both merge module projects AND setup projects. Manually remove the data in the Hierarchy and Files section of the project files.
Open .VDPROJ file
Find the "Hierarchy" section. Delete everything so the section looks like this:
"Hierarchy"
{
}
Find the "File" section. Delete everything so the section looks like this:
"File"
{
}
Reload the project
Rebuild the project.
You may need to re-add project outputs if missing something
support.microsoft.com/kb/2286556
thanks Hans, this update fixed my problem.
I am working on ASP.MVC3 project. I created a base project where I will have all common files / pages like Master Page, Global.asax, Web.Config, Script files, CSS files, and images. And I have another solution which will contain module related stuff and I am linking common files / pages from first solution with “Add As Link” (Add Existing Item Add As Link ) option (I am working with VS.net 2010 IDE).
After linking all the files are coming into second solution and looking fine.
But when I run, the application is not running. Getting the message enable debut which already there.
when i clilck OK i am getting the error “the operation could not be completed. Unexpected error” (i think its expecting the physical file in the second solution location only).
After some R & D I placed the web config and global.asax directly (which is normal) in the second solution then the application started running. The same case for images / css / script files.
Please let us know the issue what we are doing wrong or is there any other way to share/link files from another solution.
Thanks in Advance.
You're probably better off doing it the other way around - create a website project and link your libraries / base classes to your project by adding a reference to them. This way you add all your images, css files etc direct into the website.
That's the more usual way of doing it in my experience, hope it helps.
The reason it doesn't work is because the linked files aren't copied to your working directory. To make your solution work you simply publish it to some other folder and it would re-create the site with copies of all linked files. There's no need to re-organize your solution as it would deploy all linked files once you publish it.
I'm getting the following error when I try to debug my MVC solution:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: The type 'HandiGamer.MvcApplication' is ambiguous: it could come from assembly 'C:\Users\Kevin\documents\visual studio 2010\Projects\HandiGamer\HandiGamer\bin\HandiGamer.DLL' or from assembly 'C:\Users\Kevin\documents\visual studio 2010\Projects\HandiGamer\HandiGamer\bin\HandiGamer.WebUI.DLL'. Please specify the assembly explicitly in the type name.
Source Error:
Line 1: <%# Application Codebehind="Global.asax.cs" Inherits="HandiGamer.MvcApplication" Language="C#" %>
Source File: /global.asax Line: 1
This is the first time I've encountered this error with my project. All I've changed since the last time I debugged it was a .master page, a view, and I added a couple ViewModel classes. My solution has two projects - HandiGamer.WebUI and HandiGamer.Domain - but I've never encountered an ambiguity issue with them before. Rebuilding my solution did nothing. I'm not sure what else to do.
Have you renamed you assembly recently? In this case it can be that the old DLL is still in your bin folder ...\Projects\HandiGamer\HandiGamer\bin and is being loaded on runtime. As the error message tells you, the DLLs
HandiGamer.DLL
HandiGamer.WebUI.DLL
both contain HandiGamer.MvcApplication so the parser cannot decide which of them to take and is getting a conflict when you try to run it (compiling usually works fine with no errors, the issue typically occurs during runtime).
To resolve this, delete them from the bin folder above manually, then rebuild the entire solution. Unfortunately, 'Clean Solution' does not always clean up everything correctly so you have to do it sometimes by yourself.
Hint: If you unload the project (in Visual Studio: right-click the project, then select "Unload..."), you can edit the project file afterwards in the text editor and then search for assemblies there (to do that, right-click again on the unloaded project, then select "Edit...").
It contains all the references you have specified - but be careful not to mess it up. After you have searched and found the information you were looking for, close it and re-load the project. This is usually much faster than going though all entries in the References section of your project.
It looks like the MvcApplication class is defined in both assemblies in the HandiGamer namespace. Try opening them with Reflector to confirm this by searching for this class name. Then remove the duplicate class by leaving it only in your ASP.NET MVC application assembly. The other project must be a class library, not a web application.