Can not remove Default.aspx from Asp.net MVC 3 Application - asp.net-mvc

I am working on a project that started out using ASP.Net MVC 1 and has since been upgraded to ASP.Net MVC 3. It is my understanding that if I am running my ASP.NET MVC 3 app on IIS 7 using the integrated pipeline that I no longer need the Default.aspx file. However after I have removed the file from the project and physically deleted it I get the following error every time I try to compile in Release mode:
Description: Could not load type 'ProjectName.Default'.
File: Default.Aspx
I have verified that there is no instance of ProjectName.Default or Default.aspx in my project file. I have even done a grep search in all of my files in the project for any mention those names and still have found nothing. What do I need to do to be able to remove Default.aspx from my ASP.Net MVC 3 app and get it to compile in release mode. It compiles just fine in Debug mode by the way.

From the debugging listed here you probably had a cached version of your compiled code. While Visual Studio builds the code behind files into a single DLL, ASP.NET compiles each aspx file into a DLL as well (depending on how you configure it, there can be variations on this). These DLLs are located at %WINDIR%\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files note that this directory is sensitive to .Net version, could be in 2.0 or 4.0, it is also in some way dependent on bit-ness, as there is a similar directory in Framework64.

I tried to clean my solution, delete the project temp files, remove all the leftover crud I could think of. Unfortunately none of this worked so I had to take the brute force approach and checkout a new copy of my project. After doing this I no longer had the error occur when building the new copy that had Default.aspx removed. Unfortunately this solution did not provide me any insight into what leftover file Visual Studio was holding onto.

Related

The name 'Url' does not exist in the current context error VS2017

Getting an error The name 'Url' does not exist in the current context error in asp.net whenever I open a .cshtml file in my web project.
I should note that I got this solution fresh from our source repo and other developers tell me they don't see this issue.
Web project has a referenced to a nuget package and when I look at System.Web.MVC it's Mvc.4.0.40804
Things I've tried based on posted solutions:
1) Unloaded project and deleted .user file and did a clean and rebuilt.
2) Deleted temp ASP files in the .net framework directory.
There are a lot of other solutions saying to move views or adding to web.config file, but if other developers using same solution aren't facing this - I'm thinking it's machine specific.
I don't see any reference errors in the web project.
When I installed VS2017, I just did the ASP.NET development. So, i have no gotten another version of MVC. Could it be that?
Thanks,
Brian
So I ended up modifying my VS2017 install and under ASP.NET and web development, I uninstalled that and reinstalled and made sure ASP.NET MVC 4 was checked off under Optional.

ASP.NET MVC source code missing solution file

I recently inherited some source code developed by someone else who is no longer with the company. However, the solution file was missing and I'm not even sure which version of MVC it was using. I'm experienced with ASP.NET, but not well-versed in MVC so I'm unsure how to go about rebuilding the solution the proper way. Looking for any tips/guidance on how to go about this.
Create a new, blank solution.
Open the solution in Windows Explorer.
Copy the project files into the solution folder.
Within Visual Studio, right-click the solution in Solution Explorer, and then chose the option to Add Existing Project....
Navigate to the solution folder (if necessary), and then select the .csproj (or .vbproj) file. The project will added into the solution.
Now, whether you can compile the solution/project depends on whether the version of MVC is compatible with the tooling installed in your instance of Visual Studio. If the project has NuGet dependencies, they should be restored the first time you build, depending (again) on your version of Visual Studio and tooling.
Edited:
Since you say that even the project file is missing, you can, assuming there are no external dependencies, create a new MVC project and then copy/paste the files into it (or drag & drop the files from Windows Explorer). Assuming there is a Views folder, it will have it's own web.config file. That config file will have bindings for the version of MVC the project was developed with.
MVC4 and newer projects tended to default to using Razor syntax, so the views will be littered with stuff like #Model. If it's using the older WebForms syntax (like <asp:ContentPlaceholder>), it's probably MVC3 or older.
Go to web.config file in the project and look for:
assembly="System.Web.Mvc,Version=3.0.0.0 ..."
In this example is.MVC 3, look for your version

ASP.NET MVC3 not working in Windows 8

is there anything special I need to do to get ASP.NET MVC3 enabled on my Windows 8 Release Preview install? Creating even a blank ASP.Net MVC3 Razor application in VS2010, deploying to the local IIS instance as a new application, and loading the page in the browser doesn't work. I'm met with the following error:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
So I've then gone in to the new VS2010 project, right click, select "Add Deployable Dependencies" and selected "ASP.NET MVC" along with "ASP.NET Web Page with Razor syntax"
Then I re-deploy the project to local IIS application. No change. Still "web server not configured to list contents of the directory".
It's worth noting the VS 2010 Development Web Server works fine.
Any ideas?
Found it. Turns out even though I'm using ASP.NET MVC3 and had the .Net 4.0 framework installed, the Windows 8 "feature" for ASP.NET 4.5 needed to be installed for all this to wire up. Seems a bit counter-intuitive, but changing that did it.
You may want to consider running the MVC3 installer on your host machine so that all dependencies for MVC3 projects are stored in the GAC. If you need the install package you can download it from:
http://www.microsoft.com/web/gallery/install.aspx?appid=MVC3
I can't verify that this works on the Windows 8 preview, but it would be my first instinct upon running into your problem.
Did you ensure that the worker process for the site is configured for .NET 4?
When you say you "Deployed", how did you do that? It sounds like the folder is not being set to an application.
For me .NET 3.5 was not installed for IIS 8 in Windows features. Although I'm pretty sure my app is .NET 4.0... Worth trying though.
I had problems installing MVC3 MS VS 2010. Windows 8 x64. The platform installer shows no errors.
Root cause : aspnetwebpages.msi breaks updating web.config files. I updated two web.config files which appeared to only contain blanks.
Here are my directions:
Ensure C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config is valid. Use web.config.default, copy then rename to web.config to correct if it looks wrong.
Ensure C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config is valid. Use web.config.default, copy then rename to web.config to correct if it looks wrong.
I don't know why the files were bad in the first place.

Installing a modified version of ASP.NET MVC

I have made a relatively simple change to the MVC 1.0 source code to correct a bug in the DropDownList HtmlHelper (discussed in another question).
I was able to rebuild the MVC solution, ran all the tests, including the one I hadd added to show the bug I was fixing, and built a new DLL.
But how do I use that?
I tried moving the new MVC dll into the project and changing all the project references to point to it, but when I try to run the MVC website, it's throwing an exception saying there's a conflict between my version of MVC and the MVC in the GAC.
I tried to use gacutil.exe to remove the one from the GAC, but it says it can't do that because it would make another program (the Microsoft Installer? fail.
What do I have to do to install my newly built version in place of the "official" version?
If you want to remove it from the GAC without uninstalling MVC (which includes the Visual Studio templates you probably need), you need to do this in the registry:
Find registry key HKEY_CLASSES_ROOT\Installer\Assemblies\Global and look for key starting with System.Web.Mvc – delete it
Now you should be able to use gacutil.exe to remove System.Web.Mvc from the GAC, and you should be able to use your version from your /bin folder.
How about changing the version number when you compile the modified MVC framework?

Install ASP.Net MVC without administrator rights?

Unfortunately, my company's IT policy doesn't allow me admin privileges to my own machine. However, I want to start working ASP.Net MVC; but the installer won't install the framework w/o admin rights. Is there anyway I can install MVC manually; like copying relevant DLLs somewhere, etc. Any constructive advice is greatly appreciated.
You can download & compile ASP.NET MVC yourself - and either include it as a referenced project, or just grab the resulting binaries and add them to your project like any other DLL.
Look for the link to MVCBetaSource.zip on this page - it's a pretty straightforward build using Visual Studio, and (if I recall correctly) includes the few binaries (System.Web.Abstractions and System.Web.Routing) that aren't part of the MVC source itself.
As of preview 3 or 4, ASP.Net MVC became binnable. What I've done in my solutions is have a 'binary references' folder at the root of the solution and make references to those local files in each project that needs them. You should copy:
System.Web.Abstractions.dll
System.Web.Mvc.dll
System.Web.Routing.dll
Once done, refer to these assemblies and things should work just fine. The biggest hurdle you face is extracting them from the MSI.
MVC is bin deployable, so if .Net 3.5 is installed with SP1 you should be good. Just make sure you mvc dll gets put in your bin folder and deploys out. The tricky part is the wildcard in IIS6, IIS7 will do this automatically but for 6 you need to make a rule, good luck.

Resources