Is it possible to change from .NET Framework 4.8 to 4.7.2 - asp.net

Is it possible to change from .NET Framework 4.8 to 4.7.2? In my "Turn Windows features on or off", I have ASP.NET 4.8 listed. I wish to change this to 4.7.2 I tried downloading and installing the developer pack from here (https://dotnet.microsoft.com/download/dotnet-framework/net472), but no luck on changing it inside "Windows features on or off".

I don't see any real particular issue by going back on the projects .net version.
The only requirement is that you have the correct version of .net installed on your computer. I suppose you "can" go into windows settings - and if the .net framework is not selected, then fine.
I would NOT suggest that you bother to disable say some given .net framework in the windows settings.
if you need a particular .net framework - then make sure it is installed on your development computer. once done, then in project settings you can select the framework - say like this:
So no, don't disable any .net framework. Sure, you can enable as such, but I would not mess or bother to remove existing frameworks.
About the ONLY real issues are:
If any library or referenced assemblies are LATER then the framework you select, then you can't use such tools, and external libraries.
And of course the target computer then has to have AT LEAST that level of .net installed.
In fact, in some cases, especially some web hosting providers - they are often VERY MUCH behind on what versions of .net are avaible.
And then of course often your have a 4-5 year old production server. They often don't allow updates to such servers to later versions of .net, so you are in your case - can you roll back, or choose a lower .net framework.
I certainly suggest that you adjust, pick, and get your development cycle working on the lowest min target framework. That way you not only avoid (even by accident) using some libraries and tools that can't run on that target web server.
Another FYI? If you select/change that framework in the VS project settings (as per above screen shot), I suggest that after doing so, you exit VS, and re-enter. I experienced some issues when not doing this exit of VS when downgrading the project.
You then want to do a clean project, and then do a re-build all. If that re-build all don't spit out any errors, then you are in rather good shape and should be ok.

Open the Project in Visual Studio >>> Go to Project Tab on Top >>> Select Project Properties >>> Change the Target Frameworkenter image description here from the Dropdown >>> Click Yes to Save the Same

Related

Framework upgrade from .net 3.5 to .net 4.8

I'm working with one of my clients wherein they are having a few application still written on .net framework 3.5. Though we still have support for .net 3.5, client wishes to upgrade the framework to 4.8. There are no plans to migrate to core/.net 6 as of now but to upgrade to framework's latest version 4.8.
I'm looking for some pointers to migrate an application from 3.5 to 4.8, what could be the runtime changes/retargeting changes/breaking changes. It would be of great help if someone could give me a roadmap to address the problem - where to start from, what details to look into etc. I searched a lot and could not get any specific pointer for my use case. Please help.
Thanks in advance!
Well, in most cases, you should be able to simple set the project up to say .net 4.8 (or 4x). But, you might as well go all the way.
You WILL however has to download and install .net 4.8 on the web server. So, on your developer computer, you most likly do have .net 4.8. But, don't forget to download + install .net 4.8 on the web server (or if it is a hosted plan, find out what is the level of .net they support).
So, for the most part, you should be able to simple in your project, set it as 4.8, and see if it compiles. You have a VERY good chance it will.
That would be this setting project->"my project name properties"
So, the above for the most part should make things work.
Also, once you done the above, (then re-build all). You want to check web.config, and this setting:
<httpRuntime targetFramework="4.8" maxRequestLength="2000000"/>
As noted, you also have to check/ensure that the web hosted server (if this is not a on-site server) also needs the .net frameworks to be downloaded and installed. Often they already are but you want to check that.
It also possible that you are using a asp.net web site as opposed to a asp.net web site application, and thus the above steps do change somewhat.

Project not compatible with netcoreapp2.0

I'm trying to add a full framework class library as a project reference to asp.net core 2.0 MVC project and getting the below error.
Project XYZ is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0).
Project XYZ supports: net462 (.NETFramework,Version=v4.6.2)
I have updated to the most recent version of Visual studio i.e, 15.3.5.
Is it even possible to reference 4.6.2 libraries in core 2.0 projects?
The first thing that you can try is to compile the library you want to consume as netstandard2.0.
Theoretically (according to the .net standard documentation), this will make it compatible with projects using net461 and later as well as netcoreapp2.0 and later.
In practice, sometimes you will end up with a problem with one of your dependencies that don't provide the same library version across different compilation targets.
In such cases you may simply need to add the .net core 2.0 as a target framework for the XYZ library.
The xml tag listing the targets is <TargetFrameworks> in the XYZ.csproj file and is not handled by the Gui of the project's properties.
So I would give a try at editing the XYZ.csproj by hand and add or replace what's listed as <TargetFrameworks> with netcoreapp2.0.
If you are adding it as additional target you need to separate them with ';' as in
<TargetFrameworks>net462;netstandard2.0;netcoreapp2.0</TargetFrameworks>
More details about this in this Microsoft doc.
Please keep in mind that this will trigger multiple compilations and will slow your build consequently...
It should be. Microsoft announced a ".NET Framework Compatibility Mode" with the release of .NET Standard 2.0. However, they didn't go into great detail about how it works exactly, or what to troubleshoot if it doesn't. Additionally, they only specific talk about it in relationship to Nuget packages, so it's possible there's some role Nuget is playing in the process, as well. Unfortunately, I've been unable to find any additional information about this feature outside of the announcement post.
That said, Microsoft's explicit recommendation is to not rely on the fact that your .NET Framework library may just happen to work in .NET Core; instead, you should be actively porting .NET Framework libraries you control to .NET Standard. I'd say you're likely going to spend more time trying to figure out why it doesn't "just work" than you would porting your code, so that it will definitely work, and be future-proof to boot.
The following solution worked for me.
Deleted bin and obj folders from all the projects in the solution, rebuild and if it still doesn't work try changing browser from debug options. for eg. If you already have chrome as default browser in Visual studio, switch to Edge or Firefox.

Can I use many DNX versions?

I've created a new ASP.NET 5 project and I faced with something that I didn't understand well about how the new ASP.NET works.
In my references there are DNX 4.5.1 and DNX Core 5.0. When I install a new package from Nu-Get, some packages install successfully in both and some tell me they aren't supported by DNX Core 5.0.
Can I use many versions of DNX for supporting my packages or I must bound the things with DNX Core 5.0 to enjoy the advantages of ASP.NET 5, like cross-platform and others?
ASP.NET 5 projects are multi-targeted, which means you can compile for multiple platforms simultaneously. In your case .NET 4.5.1 targets ASP.NET 5 on the full .NET runtime (4.5.1) and .NET Core (5.0). When you compile your project, ASP.NET 5 actually creates output for both of these targets so - assuming you get the code to compile for both platforms - the application can run on either of them. It's possible to run additional targets to your projects.
When you actually run your application though, you have to pick a specific version of the .NET runtime you want to run under. In Visual Studio there's a drop down in the project settings where you can select that runtime that actually executes. When you use command line publish you also specify which platform to publish to with a parameter (if omitted it uses the active DNX runtime I believe).
As to the differences - .NET Core is a trimmed down version of the full .NET runtime, that is cross-platform and can run on Windows and other platforms like Linux and OSX. Because it has to run on other platforms a lot of the platform specific Windows features are not supported in this runtime, and as the platform is still evolving some APIs are simply not implemented yet in .NET Core. This is the reason you are likely to see many compile errors when you target .NET Core with existing code/libraries. In order to run on .NET core existing .NET code typically needs at least some minor adjustments to account for the smaller API footprint and potentially serious redesign to work around missing functionality.
If you need to use existing code and depend on assemblies/NuGet packages that are based on previous versions of .NET you have to stick with the full .NET version. You can still take advantage of the new ASP.NET 5 features and eco-system, as well as getting the benefit of the full .NET runtime and full API surface you are used to from previous .NET versions. The downside is that the runtime is Windows only and has a bigger resource footprint.
.NET Core is a new runtime and you should treat it as such. Migrating to this platform is likely not a trivial task. The benefits of this platform is a much leaner footprint and that it can run across multiple OS platforms.
It's likely that it'll take some time for the full potential of .NET Core to come to fruition as Microsoft expands the feature set and cross-platform compatibility but we won't really know what this will look like since it is still in Beta (well RC but it's really a beta with major changes still coming in RC2).

.Net 1.1 upgrade to .Net 2 - Does it still use the .Net 1.1 framework

We have recently taken on support of a web application that was written many years ago and targeted v1.1 of the .net framework. It runs on Windows Server 2003/IIS 6 environment.
After looking at the configuration of the site in IIS the target framework is set to 2.0.
Given that extended support for .net 1.1 will cease in October of this year (http://support.microsoft.com/lifecycle/?p1=1249) I am trying to ascertain whether the site will still use any of the .net 1.1 framework assemblies given that the application is built and compiled in Visual Studio 2003.
I am assuming this is the case because although ASP.net 2 is set as the target framework
in IIS (and therefore the aspet_isapi.dll invoked is the .net 2 one etc) the assembly is a .net 1.1 assembly and will therefore still use the 1.1 framework. However, is this assumption actually true?
The website only has another year or so to live before being replaced by a new solution entirely so I would prefer not to upgrade it if possible and run the risks such changes bring with them.
However, we obviously can't run something on an unsupported version of the framework if any element of if that framework is actually being used.
Any thoughts would be appreciated.
Update:
It would seem that .net 1.1 is a core component of WS2k3 so you can't just uninstall it. I could have attempted to remove the ASP.net component but I don't think that would fully uninstall everything and given that the dev environment is shared I can't risk causing any issues right now.
However I have previously set everything up on my local machine (Windows 7/IIS 7), so I changed the application pool to point at .net 2 (it was already running in classic pipeline mode), uninstalled .net frameworks 1 and 1.1 and cleaned up the files left behind afterwards.
The result was that the site ran absolutely fine, which would suggest in an IIS 7 environment at least that I don't need to worry about upgrading given we are running under .net 2 within IIS.
It's not an ideal test as it isn't a mimick of our live environment. I'm going to post a question on MSDN and asp.net to see if any Microsoft folks can add anything more definitive. I will post back here with any updates.
Just because official support will end doesn't mean Microsoft will pull the plug and force an uninstall of .NET 1.1 via Windows Update. It only means that:
if a gaping hole in the framework's security is ever found, they'll not fix it;
There won't be redistributables for the next versions of Windows, and the next version of IIS won't run it.
So the application will still run in a year. If you leave the server alone, the application might run until the machine breaks of old age.
So my suggestion is relax, and focus more on the new solution.
I got the answer to this questions after reading this link (provided as an answer to this question on the ASP.net forums)
http://msdn.microsoft.com/en-us/library/ms994381.aspx
Under "Application Load Mechanisms and Possible Issues" it states:
By default, an application built using the .NET Framework will run using the version of the Framework it was built against if that version is installed on the computer
It then goes on to detail (for .net 1.1 and 2.0 at least) when a particular version of the framework is used.
Essentially, because our server has both 1.1 and 2.0 installed the application will still be using version 1.1. If 1.1 was not installed then it would run by default under 2.0, which explains why the web application still worked after I uninstalled .net 1.0 and 1.1 from my local machine.
Given that the live server is W2K3 and I can't remove .net 1.1, I will be rebuilding my application to target .net 4.0.

Do a Windows application ifself contain the .NET framework?

I have a Windows application which contain a deployer.
Does the deployer itself contain a copy of the .NET framework?
Or do we have to explicitily install it?
When I check in the solution explorer, it shows the .NET framework under the deployer project under detected dependencies?
My Windows application connects to the Internet to validate for a registered user. Do I need to configure some port (or something like that) while I am installing it? Also how do I check which port my application uses to connect to the Internet?
Regarding #1, just as Xstahef said, you need to prerequisite the .NET framework.
You could put the .NET redistributable in your installer, and if you detect that the .NET runtime is not installed then prompt the user to run and install the .NET distributable contained in your installer (that's what we did some time ago, InstallShield provided this functionality for us). But this may not be recommendable: the .NET runtime has grown a lot in size (depending of the version you need to have in your client's machine), and many customers (at least the educated customers) won't trust installing the runtime from your installer. Besides, you may need to check with the legal department in your company before including a third-party component in your installation.
It depends on your deploy project (Visual Studio, InstallShield?). But commonly, you need to force the .NET installation (prerequisite option). By default, .NET is not contained in the deployment projects.
Here, it depends on the way you want to connect the Internet.
.NET runs in a VM, so you would need to require the framework be installed in order to actually run it. Much like you need to have Flash or Java for those respective mediums. Microsoft has redistributable packages for the .NET framework. So you could probably incorporate them into your installer. If you're targeting 1.1 or 2.0 most people probably won't need it.
So long as you are not trying to get in to the client machine then you shouldn't need anything special like UPnP to [attempt to] open a port if they are behind a NAT router.
Xenocode does allow to running such an application on an absolutely clean PC.

Resources