Visual State Manager in WPF not supported - c#

I am creating an app which needs to use the Visual State Manager, but when I want to use it, I get the following error:
Visual State Manager is not supported in a WPF application.
I tried to use the code snippet from this question: VisualStateManager is not supported in a WPF project, but then it says, that the Visual State Manager is not in the namespace of System.Windows.
I am using .NET Framework 3.5 to use the app on Windows 7 as well...
Does somebody have an idea how to solve this?
Thanks!

If you want to use the VisualStateManager class in your WPF application, you must target the .NET Framework 4.0 or later.
Since the .NET Framework versions 4.5.2, 4.6, and 4.6.1 will reach end of support on April 26, 2022 and versions between 4.0 and 4.5.1 are already out of official support, any new application that you develop should target .NET Framework 4.6.2 or later.
.NET Framework 4.6.2 and later versions are fully compatible with Windows 7 SP1.

Related

WPF - Using Windows Media Import

I am trying to use the Windows Media Import API in a WPF Application I have added a reference to the Windows Runtime but still failing to get it to run. Any ideas what the missing references may be?
Your .csproj is targeting an ancient and unsupported version of .NET Framework, specifically: .NET Framework 4.0 which dates back to 2010, which is before the IReadOnly...<T> collection interface types were added to .NET in .NET Framework 4.5 in 2012.
As it's 2021, you should now be targeting either .NET Framework 4.8 - or .NET 5. As porting to .NET 5 is a large undertaking, just update to .NET 4.8:
So change this:
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
to this:
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>

.Net Framework Debug window is not working

I have a problem of debugging. I have the window created with the buttons, labels and everything, but when i try to debug it, the UI/GUI doesn't show up.
I am on windows 10 Visual studio 2019, with Developers mode on (since Visual Studio is asking for it when creating WFA or Windows Forms App). I have .Net Framework 3.5 Installed and i dont see the reason why it shouldn't work. I see it every time i create a project.
The Application i am trying to create is a .Net Framework WPF
The Reason why the Debugging doesn't show the UI is because of the .Net Framework you are using is not compatible with the .Net Framework version your project is set to work on
you can set the normal .Net Framework version you want your Project to work on in the Section when the Visual Studio is asking for the Name of the Project, the Solution Name and the path. At the very bottom, you will see something along the lines of ".Net Framework". Click on that and choose any Version you want your project to work on. (Warning Note: .Net framework 4.5 and .Net Framework 4.8 may have compatibility issues. This info is in th link below)
You would need .Net Framework 4.5 or above
I highly recommend getting .Net Framework 4.8 since it is a .Net Framework version that supports .Net Framework 4.7.2
I had this issue and when i installed .Net 4.8, the Debugging instantly started working.
For More Information, Check out this Link:
https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/runtime/4.5-4.8
[18th April 2022] - Edit: .Net 6 is a thing. You can use that instead of .Net Framework 4.8

VS 2012/2013 and .NET 4.5 Query

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.

visual studio 2012 .net frame work compatability

Can you please help me with this. Am I able to run .net 2.0 in visual studio 2012? Can you direct me to the diagrams that show the framework compatibility?
Yes. You are able to build .Net v2.0 projects in the Visual Studio 2012.
Here goes the list of all available versions of .Net Framework:
http://pasteboard.s3.amazonaws.com/images/uWRTNBl.png
Framework targeting does not guarantee that your application will run correctly. You must test your application to make sure it runs against the targeted version. You cannot target framework versions that are earlier than the .NET Framework 2.0.
http://msdn.microsoft.com/en-us/library/bb398197(v=vs.110).aspx
In short, yes, you can target .NET 2.0 - and no, there's no master list of compatibility issues.

should i use Microsoft Visual C# 2010 Express to create a .Net 3.5 targeted, WPF Application?

i want to use Visual C# 2010 Express to create a .Net Framework 3.5 using WPF Application- this is due to the comfort that 2010 version gives to its user... (me)
So should I use version 2010 to create a WPF Application in .Net Framework 3.5? if yes, than how do i do that?
Thanks,
Din
You can target a previous version of the .NET Framework in Visual Studio 2010 (and 2008), for more info, see the MSDN How To article.
Creating your assembly like this is just fine, if you are not yet comfortable working the the new .Net revision. You can always retarget to .Net 4.0 later if you want to, and rewrite any code that could benefit from new additions to the Framework or language.
In corporate environments, it's not uncommon for older versions of .Net to be the desktop standard, and in that case you would have to target the specific version of the framework.

Categories