ASP.NET MVC Upgrade guide - asp.net-mvc

I have a small ASP.NET MVC application developed using the latest beta version.
What would be an easy to follow step-by-step guide to upgrade to the RC released yesterday?
What key changes would I have to apply to get it working in the new version?

Read the release notes, the steps to follow are listed there.
Repeated here for your convenience.
There are not many changes between the Beta and the RC releases. However, you will need to make a few changes to your applications after installing the Beta release. Most of these changes are apparent when you try to compile your application by using the latest release, so we do not list every possible change.
The following list describes some of the changes that you must make.
Update the references to the
following assemblies to point to the
RC versions:
System.Web.Abstractions.dll
System.Web.Routing.dll
System.Web.Mvc.d
ll
Note If you are running ASP.NET 3.5 SP1, you need to update only the System.Web.Mvc assembly reference.
By default, these assemblies are located in the following folder:
%ProgramFiles%\Microsoft ASP.NET\ASP.NET MVC RC
After you have made these changes, compile your application and resolve any compilation errors. Most of the errors will be the result of one of the breaking changes listed earlier.
Update the section the Web.config file In the Views folder to match the following example. (The changed elements are in bold.)

I think the release notes has a fairly good guide.

There's some issues not mentioned in release note. Read this for more info:
http://forums.asp.net/t/1377139.aspx

You also make sure to add the following tag to your web.config file:
<system.web.extensions/>
It took me a lot of effort to figure it out since it's been nowhere documented.

Related

My website is unavailable after trying to upgrade from Umbraco 7.15.6 to Umbraco 8.1.0

I tried to upgrade my website from 7.15.6 to 8.1.0
I used FileZilla to copy /bin and /Umbraco to my host. Then, I edited the web.config as explained here: https://our.umbraco.com/documentation/Getting-Started/Setup/Upgrading/migrating-to-v8
The installation process didn't start and my website is unavailable.
When I tried to rollback to 7.15.6, I now get the following error: 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 'Umbraco.Web.UmbracoApplication' is ambiguous: it could come from assembly 'D:\home\site\wwwroot\bin\umbraco.DLL' or from assembly 'D:\home\site\wwwroot\bin\Umbraco.Web.DLL'. Please specify the assembly explicitly in the type name.
Source Error:
Line 1: <%# Application Inherits="Umbraco.Web.UmbracoApplication" Language="C#" %> Line 2:
Source File: /global.asax Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4261.0
I copied again /bin and /Umbraco to my host (of 7.15.6), as well as the config and App_Plugins folders
How can I bring my website back???
Thakns.
You should remove umbraco.dll for a start. In fact, all Umbraco DLL's starting with a lowercase 'u' shouldn't be there.
You can't do an upgrade from 7 to 8 by copying files as Umbraco 8 contains a lot of breaking changes and a lot of legacy code has been cleaned up compared to Umbraco 7. Due to this, it is not possible to do a direct upgrade from Umbraco 7 to Umbraco 8.
Instead you can migrate your content from your Umbraco 7 site into your Umbraco 8 site after you fresh up a new Umbraco 8 website - again this is not an upgrade!
PS 1: Please use Nuget to install&upgrade your packages.
PS 2: I wrote a blog about my Umbraco V8 "upgrade" from V7 experience a while ago, please take a look. I'm adding the conclusion bit from my blog here, hope it helps.
It seems to be Umbraco v8 upgrade from v7 is not really an upgrade, but literally creating a new v8 project, doing the data migration, moving the custom code&settings, and making sure all is good again. You should know that for big projects, this is a lot of work and you need to make sure this is really what you want/need to do.
When creating new projects, definitely v8 should be your choice as it is the main focus of Umbraco, and it is the greatest version so far.
For v7 projects, I wouldn't recommend you to do a v8 upgrade, unless you have got real good reasons and time(and money to spend for this). Umbraco will continue to support v7 which is great news for all v7 projects.
For data migration, writing your own data migration code could be a good option, similar to what Paul Seal did.

Where are the predefined file templates located for Razor?

I've just started playing around with JetBrains Rider IDE using one of my existing ASP.NET MVC projects. When attempting to create a new Razor View from template, I've been unable to find any templates which refer to Razor as stated here. These are all the templates I can see when adding a file template to a chosen folder.
Am I missing something like a plugin, nuget etc...? If worst comes to worst, then I don't mind creating them, it's just a slight annoyance that it clearly states they should be there.
OS: Windows 10 Build 17134
JetBrains Rider: 2018.1 Build #RD-181.4379.1191, built on April 14,
2018
Update
I've raised this with JetBrains support and so far they've advised that some predefined templates (Razor being one) are only available in subfolders of Views folder. More info can be found here. Sadly it's still not working for me but thought I'd add as it may help someone.
It's a bug! It's seems to be okay when creating a new solution but then at corrupts the template analytics when updating nugets and/or adding OWIN (I'm guessing the Startup.cs in the root of the project has something to do with it as well).
YouTrack: https://youtrack.jetbrains.com/issue/RSRP-469774
Update
It took nearly 5 years but they finally fixed it. I don't even use that IDE anymore lol!

MvcSiteMapProvider.dll not working in Visual Studio 2013

I have a MVC 2 project created in Visual Studio 2010 that use MvcSiteMapProvider.dll and works fine. But when loading the project in Visual Studio 2013, everything else work fine except it crashes at
Html.MvcSiteMap().SiteMapPath
The error message is
An exception of type 'MvcSiteMapProvider.MvcSiteMapException' occurred in MvcSiteMapProvider.dll but was not handled in user code
I believe that MvcSiteMapProvider.dll cannot be loaded correctly. I need help on this. Thanks.
Note that there is a separate DLL for each .NET framework version, and I suspect you are targeting the wrong framework. This can happen if you install MvcSiteMapProvider into your project and then change it to a different .NET framework version.
NuGet does not automatically upgrade/downgrade packages to the currently set framework version. This step must be done manually. The best way is to completely uninstall and reinstall the package as per this document. Also be sure to read this before attempting it.
But do note that if you do this NuGet will not remove any files you have changed (like Mvc.sitemap) and then prompt you whether to overwrite them. You should normally say no to each prompt to ensure your custom configuration is not overwritten.
Also note that it is not sufficient to use Assembly Binding Redirection with MvcSiteMapProvider because with each .NET framework version we create a separate build (DLL) that takes advantage of features that are not present in prior versions.

Monodevelop MVC3 razor - what is the trick to get it to work?

I use monodevelop 3.0.4.7 and mono 2.11.4 on mac OS 10.8.
When I create a new solution from scratch in monodevelop I can create several types of ASP.NET mvc3 projects with razor views, but the projects get created with references to system.web.helpers and system.web.webpages that are "not available for Mono/.net 4.0 in mono 2.11.4" and won't build.
If I change my .net version to 4.5 in the project options I get the system.web.webpages reference resolved, and if I simply remove the reference to system.web.helpers I am able to build the default site. However, it is unable to make use of .cshtml views, it only looks for aspx views.
I have tried different things related to references and versions of mono, changing the viewengine to razor in global.asax.cs and even copied dll's from a windows-based asp.net mvc application, but something new breaks all the time.
It seems strange that there are project types included that don't work from scratch, so I'm guessing/hoping I'm missing something much simpler?
I was sitting with the exact same problem, on Linux though, so I decided to ask on the mono mailing list (see the answer to my question here: http://lists.ximian.com/pipermail/mono-list/2012-October/049022.html).
The short answer is: no, you're not missing anything simple.
Long version: The current version of mono is not compiling the System.Web.Helpers.dll, so you have to do some footwork your self, to get it compiled. That is described in the link above.
I guess we just have to wait a little longer before this becomes part of the mono framework :/
I happened across a solution for this issue here:
http://blog.miraclespain.com/archive/2013/Jun-24.html
Basically in xamarin studio you can add a version of nuget from the following add-in repository source:
http://mrward.github.com/monodevelop-nuget-addin-repository/4.0/main.mrep
Once nuget is installed, you can create a new mvc3 razor project, notice the missing references for system.web.helpers and system.web.pages and just remove them, then use nuget to add the microsoft aspnet web pages 2 package which solves the missing references.

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?

Resources