How do I add Asp.NET MVC3 as a Prerequisite in my Visual Studio Installer project?
Just a side note, you don't need MVC 3 to be installed on the host that you use. You just need to do it like we did back in the "old" days.
Check out this blog post by ScottGu on "Running an ASP.NET MVC 3 app on a web server that doesn’t have ASP.NET MVC 3 installed".
You will need to write a custom before install step where you would manually check if the required assemblies have been installed. You may also check the following article on MSDN.
Actually, I'm gonna add another answer to address the question directly.
All you have to do is set "Copy Local = True" for the following referenced assemblies in your project:
Microsoft.Web.Infrastructure
System.Web.Helpers
System.Web.Mvc
System.Web.Razor
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
And the setup project will automatically add them as "project dependencies" and put them into the "bin" folder when the setup is run.
Related
I'm running Visual Studio 2015 Update 3. I chose to create a .Net Core Project with .Net framework option specifically to use MVC 6. I have some classes in the project that I would like to reference from a console application project that I have included in the same solution. Although I can successfully add a reference to the .Net Core Project from the Console App, when I try to use the class from the console app, i'm unable to successfully add a using statement. It was my understanding that using the project template .Net Core App "With Net Framework" would prevent such issues. I've seen other posts regarding csproj xproj incompatibility. But i'm trying to add the reference from one xproj to another xproj. Is this even supported anymore? What a mess.
FYI: I also disabled resharper.
add the reference from one xproj to another xproj
If I understand correctly, the projects you are trying to link are both using project.json, right? This can be done by editing the project.json files. For example, you have "WebApp" and want to reference "ClassLib", edit the project.json file in the "WebApp" project to contain:
{
"dependencies": {
"ClassLib": {
"type": "project"
}
}
}
This part assumes that "ClassLib" is targeting a framework that is compatible with "WebApp", as listed in the "frameworks" section in project.json If your WebApp is targeting .NET Framework 4.6 (net46), then Class Lib should also target net46 or one of the frameworks compatible with "net46", such as "net451" or "netstandard1.3".
I'm trying to add a view to an ASP.NET MVC 5 project in Visual Studio 2013, but the Add button is greyed out.
The default installation of Visual Studio was missing some required elements. When I chose ASP.NET and web development, the following options were not selected on the right side of the page.
.NET Framework project and item templates
NET Framework 4.6.2-4.7.1 development tools
Additional Project templates (previous versions)
.NET WebAssembly build tools
(I found this on the Microsoft web site Microsoft Developer Resources (in spanish!)
I got this for ages, all I did was upgrade the nuget packages for Mvc and it fixed it. I suspect that I had a mismatch of versions in the solution.
Update-Package Microsoft.AspNet.Mvc -Version 5.2.3
The version part is optional, but it should mean that all projects get the same version.
You should create a controller first, then it will create a View folder automatically. Try to right click that file then click create new view. Also Copy might be a specific name, you may need to change that name.
Different from the OP issue (as I'm on VS2017) but in case anyone else comes to this question when they've made the same (basic) error as me...
It took me a few minutes to realise that if you type in a new Model class (as seen below) then this is not what the UI wants; it requires you to select an existing Model from the dropdown. Once I created the model and then selected it 'Add' was enabled.
My MVC 3 project is building successfully in my development machine with Visual Studio 2010 + MVC 3. In the build server, VS2010 is not used and I've installed 'ASP.NET MVC 3 Tools Update'. I've also downloaded NAnt and used TortoiseSVN to checkout all the files except bin directories.
But while building using Nant default.build, I'm getting build error
'The type or namespace name 'Mvc' does not exist in the namespace
'System.Web'
(are you missing an assembly reference?). Same with 'Controller', 'ActionResult', 'GlobalFilterCollection' etc (type or namespace could not be found).
I can see System.Web.Mvc.dll in
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.Mvc\v4.0_3.0.0.0__31bf3856ad364e35\
. What am I missing here? Why NAnt can't find this file? Is there no other way than copying the assembly files into local bin?
I had the same issue and wasn't able to locate the System.Web.MVC reference assembly.
Finally found out and it was located inside the following location.
Note if your VS was installed in C: (Sometimes the MVC is not in the defaul location which everybody talk about, i mean the "Reference Assemblies" folder located in the C: drive.
if its not there, it should definitely be in here:
Program files(x86) --> Microsoft ASP.NET --> ASP.NET MVC 2 --> Assemblies System.Web.Mvc.dll
Hope this one is helpful.
Here is my answer -
Best way is to use NuGet package manager.
Just update the below MVC package and it should work
Why is System.Web.Mvc not listed in Add References?
If you use NuGet packages, you need to update MVC package. This worked for me.
If you Installed MVC Package from NuGet packages. simply uninstall package and install it again.
It's work for me
Which version of msbuild are you using to build the web project?
Is the web project referencing a specific version of or file path to System.Web.Mvc.dll?
Download and install ASP.NET MVC 3:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=4211
According to: http://weblogs.asp.net/scottgu/archive/2011/05/03/asp-net-mvc-3-tools-update.aspx
"The ASP.NET MVC 3 Tools update only includes Visual Studio tooling improvements and default project template changes – it does not include any changes to the ASP.NET MVC 3 runtime binaries."
After reading quite few articles on deployment, i am bit confused about the procedure.
All the articles refer to dlls which aren't reference in Asp.net mvc project. The dlls are like following :-
Microsoft.Web.Infrastructure.dll
System.Web.Razor.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.Razor.dll
I created the MVC Music Store application from a tutorial on asp.net website and it works fine in visual studio. In the project, there is no reference to the above given assemblies(not even the razor but i am using razor engine only).
So why should i add the above files to the bin directory if my project is running without referencing them in the first place
Those assemblies need to be available somehow. If you have installed ASP.NET MVC 3 then they will be registered in the GAC (see here: http://weblogs.asp.net/scottgu/archive/2011/01/18/running-an-asp-net-mvc-3-app-on-a-web-server-that-doesn-t-have-asp-net-mvc-3-installed.aspx).
If not (e.g. if you are using shared hosting which doesn't have ASP.NET MVC 3 installed), then you will need to bin deploy them as described here: http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx
Refer to the second link to actually do the deployment. The first link is more for background reading.
I keep on getting: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web'
I have installed MVC3 and MS .Net Framework 4 and want to upgrade a solution that was written in MVC1 and upgraded to MVC2. I would now like to upgrade to MVC3 but keep on getting the above error. I suspect that it is the reference that I have to System.web, if I view the properties of it in VS2010 I can see that it is still pointing to Version 2.0
I delete the reference and add a new one to the system.web.dll in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0 but when I right click on the reference in VS2010 solution explorer to view the properties it still points to the version 2 in C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.dll
I did add the something new to VS2010, I think it was a Powertools pack and adding the reference looks different, could it be that? I did add the ref to the new system.web.mvc dll and that shows correctly. Just as a note, I did the upgrade by hand as per the MS notes and tried the upgrade tool.
Try following the upgrade steps. Also there's a project upgrade tool you may checkout.
The documentation was solid on the upgrade. The problem was with the Powertools and once I un-installed it I could add the reference again.