Can I compile and run a MVC1.0 application under .NET 4.0? - asp.net-mvc

We have an MVC1.0 application that is compiled against and runs with .Net Framework 3.5.
The application was scanned for security and the scanning organisation reported
Microsoft ASP.NET ValidateRequest Filters Bypass Cross-Site Scripting
Vulnerability
https://community.qualys.com/docs/DOC-3495
What versions of Microsoft ASP.NET are vulnerable? Microsoft has
confirmed that ASP.NET versions 1 and 2 are both vulnerable.
Additionally, Qualys has confirmed that ASP.NET version 3 is also
vulnerable, as it includes the vulnerable component from version 2 by
default. We have tested this in our Labs and confirmed the exploit
works on a fully patched version 3.
We are already upgrading our application to MVC3, but that takes some more time to finish.
Is there any chance I can run and compile a MVC1.0 application against .NET 4.0?

This may arise compatibility issues, Even though there are very few dependencies over the .net framework.
You can refer the following posts.
Is ASP.NET MVC 1 forwards compatible with ASP.NET MVC 2?
ASP.Net MVC 1.0 in Visual Studio 2010

From what I understand, anything that runs on .NET 3.5 should function and complile just fine in .NET 4.0, with perhaps some warnings about depreciated functions, but they will still work.
In case you are still curious/not comfortable, there are some tools available to help verify dependencies and other items such at NDepend

Best recommendation... try it! I can't think of any other reason than what Tommy mentioned about deprecated functions. Also, you can update most of your references with
Update-Package
without arguments.
If it compiles fine, do a quick test run over the views. If nothing seems broken, then it probably isn't.

Related

using .NET Standard 2.1 with UWP

I made the big mistake of taking some NuGet library updates today. It forced me to either roll back a week's worth of work or upgrade to ASP .NET Core 3.0. I hate to use stuff that's not production, but I didn't want to untangle the libraries either, so I upgraded. Then it forces me to retarget .NET Standard 2.1 libraries. Which I did.
My problem now is with the client UWP code. When I try to compile, I get:
error : Project '..\ClassLibrary1\ClassLibrary1.csproj' targets 'netstandard2.1'. It cannot be referenced by a project that targets 'UAP, Version=v10.0.10586'.
This happens even with a virgin UWP and .NET Standard 2.1 library. Any clues on how to make Visual Studio 2019 client code work with the latest upgrade?
All Windows 10 SDKs currently don't support .NET Standard 2.1.
Windows 10 19H2 is using the same SDK number as 19H1, so it is unlikely that it will support .NET Standard 2.1. (But I certainly hope it does.)
Microsoft hasn't made an official announcement, but Windows 10 20H1 is getting a meaningful SDK update, so it is likely that it will support it. And once that's the case, UWP apps will require 20H1 to run (so that will become the minimum supported version).
One of the big issue with this situation is that Entity Framework Core 3.0 requires .NET Standard 2.1, so it can't be used in UWP apps for now (Update: This issue is resolved with Entity Framework Core 3.1 supporting .NET Standard 2.0).
By the way, as an experiment, I was able to fork Entity Framework Core 3.0 (for SQLite) and make it compile on .NET Standard 2.0. I basically had to manually copy a few new APIs from .NET Core 3.0 (like IAsyncXXX). And it worked, so it is an option for people who really need it. Note that, I did not try it with the SQL Server provider.
Update: The UWP team is planning to enable UWP apps to use .NET 5 and that's when UWP will support .NET Standard 2.1 (and more). This could happen in 20H2 or 21H1.
UWP does not support .Net standard 2.1 yet. It only support till .Net standard 2.0 and that too from windows 1709 onwards.
If you look at the link for 2.1 it states
Platform Support
An upcoming version Universal Windows Platform
so it may be 19H2
UPDATE
Microsoft is going to release a new framework called WinUI 3, this is going to support UWP as well as Win32 based application model. WinUI 3 would support .Net 5 for both the platforms. WinUI 3 preview is going to be available in mid May 2020, with final release in late 2020. WinUI 3 would be supported on windows 10 1803+.

VS2015 ASP.NET MVC the name 'model' does not exist in the current context

I was working on an ASP.NET MVC 4 in VS2013 and everything was fine, then I've uninstalled 2013 and installed 2015, I was able to open the project, build it and even run, everything works fine (run/debug). The problem is that all my views are covered in errors:
the name 'model\Scripts\Url...' does not exist in the current context
In addition, the .Where method of a list in the model shows an error as well as all the #Html helpers. I want to emphasize that the project still works w\o any problems so the issue is UI or package related. I tried to force uninstall\upgrade Microsoft.AspNet.MVC but the package manager console throws an error and rolls back the attempt. I can provide any necessary info if it helps, thank you in advance.
The newly released VS2015 IDE seems to no longer support MVC3/MVC4 projects, while it only supports the MVC5:
Unable to find MVC3 , MVC4, MVC5 projects (or) No information about supported MVC Framework versions
If there are strict requirements to convert any existing MVC3/4 solution to MVC5 (for VS 2015), you can proceed with the steps listed in the
How to Upgrade an ASP.NET MVC 4 and Web API Project to ASP.NET MVC 5 and Web API 2 guide.
Update 2016-05-03
It seems that after installing the VS 2015 SP2 update, it behaves much better. If you have a chance, I suggest that you upgrade your IDE and check if the issue goes away.

How far is Mono with MVC3 and EF Support?

I have a really neat NAS box from QNAP (http://www.qnap.com) and I was just wondering if I can get my MVC3 apps working on it.
I see from the QNAP forums that the latest version will run on a QNAP box (assuming I can figure out the linux commands) but my question is more specific to mono ...
According to http://www.mono-project.com/Compatibility there is no support for EF ... do they mean that any code using EF (already compiled) will not run?
This will likely mean my apps wont work on Mono (shame).
There is also no mention of MVC3 on that page which implies they either forgot about it or are saying that the full support for C# 4.0 and ASP.Net 4.0 covers this.
If anyone has any experience with running MVC apps on a linux box can you let me know if any of this possible to get running / workaround please?
MVC 3 works but they don't ship it by default:
ASP.NET MVC3 Support
Currently code that uses Entity Framework will not run under Mono. However, Microsoft recently open-sourced Entity Framework and there is now a drive to get it working on Mono. Hopefully it will be done soon:
Mono 2.11.3 is out

Wrapping up Asp.net Framework 4.0 in 3.5

I am working on an application in VS 2010 and using Asp.net framework 4.0 which i just migrated from Framework 3.5. The reason i had to migrate it to 4.0 is, i have a third party toolkit dll which is built in Framework 4.0, so in order to include it i had to change target framework of this project to 4.0. As, this project is being referred from other projects ans so on.., i end up converting whole application to framework 4.0. Every thing worked okay but as the application is using spring.net also, after successfully building the application, i found broken controls on almost all the pages. i am getting java script errors (about undefined control)for usercontrol PopupDatePickerControl we are using in the application. i downloaded and included latest version of Spring.net. i have no idea what is causing this problem. Please help if any one has experience working with this combination of framework 4.0 and spring.net? OR there is any way out to wrap up Framework 4.0 into 3.5. so i don't have to do this Migration.
Thanks!
Sounds like a shot in the dark on so many levels. It's probably not the combination of 4.0 and Spring.NET, unless you aren't referencing the correct Spring.NET dlls. Can you post parts of your IoC configuration and a rough outline of your app's architecture?
Also, what is the other third party toolkit you mentioned?

Top Issues Running ASP.NET app on Mono

Assume I have an ASP.NET MVC app that's not doing anything too fancy (no P/Invoke, no unsafe, etc).
I've considered the idea of running on Mono to support Linux, among other platforms. I haven't used Mono in a long time. What are the top issues I'm likely to face?
Mono doesn't support Themes
Mono doesn't have a great GC which means it'll leak more memory and fragment the RAM for you
Mono doesn't create literal controls the same way .Net does for "empty spaces" which might be a problem
Except for those issues you should mostly be safe for ASP.NET 2.0 as far as I know...
asp.net mvc is targeted for mono 2.6, which is due in september 2009
You mentioned ASP.NET MVC, which runs on .net 3.5, and mono is for framework 2.0.
ScottHansleman wrote blog entry on how to run mvc on 2.0, you can try it. Or use Monorail (or ProMesh.NET) which runs on mono out-of-the-box. They are all MVC frameworks for .net...

Resources