After years and years of developing C#.NET I still run into new questions.
We have a legacy project and for some dark reason a colleague of mine no longer was able to open solutions in VS2017. Long story short: the solution was finally found in uninstalling all .NET frameworks and installing 4.7.1 again.
The question that struck me then is as follows. After installing ONLY the latest .NET framework, I always thought that this install would also contain all supported target frameworks up and until this version. This is not the case, as I can only choose from the following target frameworks:
...
...
4.5
4.5.1
4.5.2
4.6
4.6.2
4.7.1
This is what I have installed (targeting packs/.NET framework SDKs).
Why is 4.6.1 missing?
Why is 4.7 missing? Or the other way around looking at what I have installed. Why is there a bunch of targeting packs available while I did not install them?
Which framework versions you can target depends on which targeting packs/SDKs you have installed on the machine, not which .NET Framework versions are installed.
You can download additional packs from .NET SDKs for Visual Studio.
Frequently when a new .NET framework version becomes available, different releases are available, some of which just include the runtime and some of which include the targeting pack. So it's possible that you've been installing the latter forms generally in the past and so not aware that they're also bundled separately.
Related
I'm working on a C# Code that has as Targeted Framework .NET 4.6, and I'm trying to troubleshoot some issues that occurs during the execution.
That code is running on some clients, that has a .NET 3.5 Version.
My question is, does .NET 4.6 supports retro-compatibility, and if so, should it be wiser to have an aligned Framework versions (Target Version same as Client Version)??
TL;DR: Basically, you can run old on new, but not new on old.
DotNet 4.6+ is backwards compatible in the sense, that you can run an App built with DotNet 3.5 etc. But you cannot run an app built with DotNet 4.6+ while using an older installed framework eg. 3.5 or others. Take it this way:
Imagine you have a windows 10 computer and you want to install an app built for windows 8 or even XP and older. Modern windows has the compatibility layers, necessary to run or install the program.
Now what you/your clients are doing is basically taking an app specifically designed for windows 10, and trying to run it on Windows XP or 95 etc. That won't work as the compatibility layers are not in place to support the "future". No one can foresee the new features and API's that they might add, so the app is incompatible with older Windows.
If you are targeting .NET 4.6, then target .NET 4.6.
Do not expect your code/app to be compatible with anything lower, and if you do need it to be, you have to target that specific version. Which has its own draw-backs as the newer methods / ways of doing things and many libraries you could be using do not apply/are not compatible.
You can either update everything to use 4.6 or higher, or switch your codebase to target 3.5 and live with the drawbacks.
From Backward Compatibility
The .NET Framework 4.5 and later versions are backward-compatible with
apps that were built with earlier versions of the .NET Framework. In
other words, apps and components built with previous versions will
work without modification on the .NET Framework 4.5 and later
versions.
In your case app is built on .Net Framework 4.6 and the platform on client machine is 3.5 version. There might be some issues because app requires newer version than platform it runs.
.NET Framework version 4.6 was included with Windows 10 from version 1507 and .NET Framework version 4.6.2 was included with Windows Server 2016. If your clients are running either of these versions of Windows or newer, you won't have to install anything to run your .NET Framework 4.6 app, and it won't be running on .NET Framework 3.5 even if you do have it installed.
If you're using an older version of Windows than that and don't have .NET Framework 4.6 or newer installed, I wouldn't expect it to run at all.
I can not create a class library (or anything) above the .NET Framework versions of 2.0, 3.0, and 3.5 for some odd reason. I've tried a fresh install (also running InstallCleanup.exe and cleanup up the cache's), reinstalling my workloads, packages, and SDK's, installing the target frameworks from the website and the VS19 Installer. Nothing seems to work at all!
Thank you in advance.
Available frameworks:
Installed frameworks:
I'm not sure if you have installed the .NET Framework correctly. We have to install the SDK file, but not just the targeting pack. This page shows you how to determine which .NET Framework version is installed.
https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
If you didn't install the .NET Framework correctly, you can install the version you want manually.
https://dotnet.microsoft.com/download/dotnet-framework
im building an app using c# (not my first. other projects i dont have this problem). this one i included nuget package json
the problem that VS generates too many .dll files in my bin/debug folder (with exe). i don't want these dll files but it seems like the exe doesn't run without them (i coppied the exe to another path and run it)
when i search on the internet all the details about merging using some merge tool but my problem is related VisualStudio in the setting i believe?
This happens when you include a library which targets .NET Standard 1.5 or higher, from a project which targets .NET Framework 4.7.1 or lower.
The .NET Platform Standard table hints at this: it claims that .NET Framework 4.6.1 supports .NET Standard 1.5 or higher, but there's a footnote:
The versions listed here represent the rules that NuGet uses to determine whether a given .NET Standard library is applicable. While NuGet considers .NET Framework 4.6.1 as supporting .NET Standard 1.5 through 2.0, there are several issues with consuming .NET Standard libraries that were built for those versions from .NET Framework 4.6.1 projects. For .NET Framework projects that need to use such libraries, we recommend that you upgrade the project to target .NET Framework 4.7.2 or higher.
One of these issues is that you'll get a lot of extra DLLs, apparently because .NET Framework 4.6.1 only has partial support for .NET Standard 1.5.
The solution is for your project to target .NET Framework 4.7.2, or .NET Core.
I am planning to install VS 2012 or 2013 and I was wondering if .NET 4.5 will get installed with it? I think it will but then what will happen to all my apps with target platform 4.0?
So my question is when I install VS, will my old apps which have target platform 4 contain elements of .NET 4.5?
Let say as example type string in 4.5 it has some improvements or something which 4.0 doesnt have. Will I get them even though I build against 4.0 according to target platform?
I would like to avoid some strange behavior in already existing projects just because I am running now visual studio 2013.
Any experience on this one guys?
Sorry in case of a duplicate question
In Visual Studio 2013 you can still build against .NET 4.0. The (highest) framework version installed on your development machine has no influence on the end result of your build process.
When installing .NET 4.5 in place of .NET 4 will change something on your PC: It gives you the ability to compile against the 4.5 version of the framework. As long as your compile your code against the NET 4.0 version, it has no need of .NET 4.5 to be installed.
If you target .NET 4.0, your code will not be able to access types which are specific to .NET 4.5 or .NET 4.5.1. However, your code will be running against .NET 4.5. That is only a problem if you do not test against .NET 4.0. In that case, you could find that bugs are fixed in .NET 4.5, but your users may still be using .NET 4.0, which may still have the bugs.
I have a C# Winforms application I'm looking to deploy on an XP Laptop with the .NET Framework 1.1 installed.
The solution contains three projects, all with a target framework of .NET Framework 2.0
The setup project has the preqrequisite of .NET Framework 2.0 checked. No other prerequisites are checked.
Why, when I try to run the setup on the laptop, does it require me to install the .NET Framework 3.5 SP1?
(FYI I am developing in VS2008 on a machine with .NET Framework 3.5 SP1)
Thanks in advance,
Jim
I don't know if it applies to you, but see the answer from PhilWilson here: http://social.msdn.microsoft.com/Forums/en-US/netfxsetup/thread/ca822298-8371-4e04-8763-cccd4615ab84
Do any of your projects depend on anything else other than the .NET framework? If you have a reference to something that does, then that will require its prerequisites are installed too.
I'd also triple check that you've not got one of your projects still pointing at 3.5.