Open an exising MVC 3 project in visual studio 11 developer preview - asp.net-mvc-3

I've trying to open and convert an existing vs 2010 mvc 3 project in the new dev 11 preview and am running in to a difficult issue. The solution file will convert successfully, however the one mvc 3 web project in the solution shows in the solution explorer as unloaded post conversion. When i attempt to reload the project from solution explorer, i get prompted to convert the project and receive the following error in the upgradelog.xml
The project file'myproject.csproj' cannot be opened. There is a missing project subtype. Subtype: '{E53F8FEA-EAE0-44A6-8774-FFD645390401}' is unsupported by this installation.
From what i could track down, this has to do with MVC, but that doesn't really help me work around the issue. Any suggestions or workarounds would be appreciated.

Update: Actually, MVC 3 for Visual Studio 11 Dev Preview has just been published: http://www.microsoft.com/download/en/details.aspx?id=1491
We have not yet shipped MVC 3 support in Visual Studio 11. You can work around this by editing your csproj file and removing the project type GUID {E53F8FEA-EAE0-44A6-8774-FFD645390401}. This will cause your project to load like a normal WAP. You will be able to edit your code, however MVC-specific actions (Add Controller, etc) will not be available.

You may want to try the steps from the Upgrading an ASP.NET MVC 3 Project to ASP.NET MVC 4 section of the release notes, even if the document describes the VS2010 version.
I managed to convert a VS2010/MVC3 project, but VS11 shows a warning every time I open the solution, stating that the project requires ASP.NET Web pages with Razor syntx 1.0. OTOH, the project seems to run without any problems (VS11 setup also installed ASP.NET Web pages 2).

Related

Creating web application using VS 2015 Update 3 creates with references 1.0.0-rc2-final

Creating a web application as ASP.NET Core Web Applicaiton (.NET Framework) creates with most of the references as 1.0.0-rc2-final.
I am using the RTM version of VS 2015 Update 3. Hoping the references to be full version rather than rc2-final.
Are the templates updated properly? Do I need an update for the tools? If needed, where will I get it?
Thanks
ASP.Net Core tooling isn't included in Update 3 so apart from Update 3 you also need to install Web tooling. Go to: https://www.microsoft.com/net/download and download ".NET Core Tooling Preview 2 for Visual Studio 2015" (at the bottom of the page).
Probably going to have to update the project with nuget or by hand this assumes you have installed the SDK Core Preview2 Tooling located here.
NET Core 1.0 for Visual Studio
NB: while the framework has RTM'd the tooling is still in preview status since they are still working on it, hence Preview2 status.
if you have a Global.json file I would also suggest clearing out the entry that says "sdk": {}

Cannot add view to ASP.NET MVC 5 project

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.

VS 2013 and MVC 5 - class for view set in web.config ignored by intellisense

I have a number of extension methods on System.Web.Mvc.HtmlHelper. They all work, the pages load up just fine. No compilation errors nor runtime errors. I am using my own derived view class, derived from System.Web.Mvc.WebViewPage< T >
The issue is intellisense in these views are not showing my extension methods as available. In fact they're not showing anything as available from my derived view class. When I go to definition on the #Html it shows that VS is looking at System.Web.WebPages.HtmlHelper.
Is there a way to correct this and have Visual Studio recognize the base class I'm using? Once again this all builds correctly and runs just fine, everything works as expected.
Additional info while researching this:
It looks like tooling support for VS 2012 and MVC 5 has yet to be released and is currently expected to be released in mid-november. Source. This may indicate the support isn't complete in VS2013 as well.
When you upgrade to MVC5 through Nuget, there are a number of files that need to be edited in order to ensure that your application builds and runs correctly, and has support for the right tooling.
All of this information is captured in this Microsoft guide for upgrading from ASP.NET MVC 4 to ASP.NET MVC 5. Please note that if you read the comments of the guide, there is still an issue with VS2012's tooling due to what VS2012 expects versus the updates to the way the new toolchain attempts to find binaries. A patch is expected for MVC5 support in VS2012 by November 2013.
Hopefully following the steps in the guide help you solve your issue. They worked fine for me. (Note that I started from a base project and attempted to upgrade it in VS2013. I did not start with an existing project.)

Why I am not getting WCF Web API Objects in Visual Studio 2010

I have installed WCF Web API Preview 5 using NuGet Visual Studio extension (WebApi.All). I am trying to implement some simple examples on the internet, but it seems like they have different Assemblies to the ones I installed. For example, I cannot get HttpHostConfiguration, DelegatingChannel, HttpMessageChannel, etc.
I have made sure my target framework is set to ".NET Framework 4". Am I missing something, or has anyone else experienced a similar issue. Btw, my project is an MVC3 project.
Thanks for your help.
It sounds like the sample code you are trying to use is from preview 4 or before. A number of breaking changes where made in preview 5.
To get the Http server configuration you can use the GetDefaultHttpConfiguration() extension method on the RouteCollection. The DelegatingChannel has been renamed to DelegatingHandler.
See the release notes here or this blog post from Howard Dierking for more info.
You need to add a reference to the dll that contains those classes. They are probably not referenced by default in a MVC3 project.

Conversion of MVC 2 project in VS2008 to VS 2010.. failure on one project.. Project type wrong?

So I'm trying to take a VS2008 MVC1 project to MVC3.
Here are the steps I'm trying to do.
Use conversion to to convert vs2008 mvc1 to vs 2008 mvc2 (success)
Tool: http://weblogs.asp.net/leftslipper/archive/2010/03/10/migrating-asp-net-mvc-1-0-applications-to-asp-net-mvc-2-rtm.aspx
Open vs2008 sln in vs2010 to convert (failed on my main app project)
Convert from .Net3.5 to .Net 4.0
Use tool to covert to MVC3
On step two, it fails on my main project, and then will not open the project with the error.
The Project <project path> cannot be opened
The project type is not supported by this installation
I found some StackOverflow posts abotu similar issue with RC1 and RC2, but installaed my MVC2 from the webplatform installer and so it should eb the latest, not the RC.
I assume this line is my problme, anyone know how to fix it?
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
I tried posting my csproj, but it excedded the max lines.. if there is a part neede to diagnose this just let me know.
Thanks,
Cal-
Personally I use the following migration path *:
Ensure that I have ASP.NET MVC 3 RTM Tools Update installed
Open the ASP.NET MVC 1.0 project in Visual Studio 2010
The migration wizard kicks in and asks me if I want to convert to .NET 4.0 and I say Yes
Make sure that the System.Web.Mvc assembly referenced in my project is V2.0.0.0. If it is still the old I remove it and add the correct version
At this stage I ensure that I have a working ASP.NET MVC 2.0 application and close Visual Studio.
There is one final step left. For it, depending on my mood, I do one of the following:
Do the migration manually by following the upgrade guide
Use the ASP.NET MVC 3 Project Upgrade Tool
* To answer this question I did the previous steps on a real ASP.NET MVC 1.0 project and it was successfully upgraded to ASP.NET MVC 3
Okay I did it both ways and got the same result.
I did figure it out, here's what was going on. Be aware that steps 1 and 3 are probably all that's needed to fix it, but I'm including step two, both for clarity of my debugging process and completeness in case it's required and my assumptions are false.
Even though MVC# was installed, and showed as installed in the Add removed programs, MVC 3 was not showing up as a reference. I unininstalled, reinstalled and rebooted and it started showing up.
I had to modify the project Type Guids in he CSPROJ file, first I deleted them one at a time till the Main app project was able to load, then I recovnerted. All projects except the main one worked, but it didnt' convert. It did not covnert becuase of an unrecognized project Type Guid.
Becasue it didnt convert I got this error:
The type 'System.Web.Mvc.ViewMasterPage' is ambiguous: it could come from assembly 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Mvc\v4.0_3.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll' or from assembly 'C:\Windows\assembly\GAC_MSIL\System.Web.Mvc\1.0.
Note the Coverted did not throw and error, it merely logged that the project did not get convereted. You have to look at the logs carefully to notice.
Luckily you can run the converter on the same soloution multiple times. that's how I noticed this.
I had to modify the Project Type guids again, because of the unrecognized type guid again. I just created a new MVC3 project and edited the CSPROJ to get the correct type guids.
{E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
Note: this is what the guids already looked like, but I copied them from an existing good project and pasted them in the file and it started working, my best guess is there was an invisible character put in there by the conversion process.
After this I reconverted and it worked perfectly, and the errors went away.
Thanks,
Cal-

Resources