How to test apps on older builds of Windows 10? - c#

I have an app that targets Windows 10 build 10240, but my local machine has the latest update.
for phone I see there are various emulators in Visual Studio. Is there a way to test an app on older versions of Windows 10 desktop?
(I know one way is to actually find an older windows and run it on a virtual machine, but I want an easier way)

Thought I should write an answer just to make it clearer.
Currently, if your target version is 15063 and min version is 10240, you do get some benefits like what's shown in the following picture -
Properties like FocusVisualMargin will be highlighted as
The property ‘FocusVisualMargin’ on type ‘ListViewItem’ is not
available in the target platform minimum version (10.0.10240.0)
supported by this project.
However, resources like ListViewItemForeground are also not available in 10240 but they are not highlighted. Same as in the following picture -
This SetImplicitShowAnimation API is also not available in 10240 but it's not highlighted.
This tells me Visual Studio doesn't not fully recognise everything in each version. This may change in the future, but for the time being, it's just a lot safer to either run it on a 10240 machine, or reduce the target version to 10240, then run and test.
If you want to create Version Adaptive Code, see here.

Related

Languages disappearing in VS 2019

I am brand new to asking questions in SO and I do not really know if this question is meant to be asked here but here i am asking anyways.
I will cut to the chase now.
I am using VS 2019 Community and whenever I install for example .NET for C# development , my C++ disappears and I need to reinstall the whole Desktop Development with C++ package and when that gets done , the .NET development package disappears and needs to be reinstalled to be used again.
Does anyone have an idea on why that happens and how it can be fixed?
Hi and welcome to Stack Overflow. RUn your installer and select modify if you've already got it installed.
You'll arrive at a screen like this (this uses my VS 2019 Preview installation which doesn't have a lot selected.)
When you have arrived at this page, select the workload you want, in this case "Desktop Development with C++". It will show you how much space will be required. On the right, you'll see it show you the details of what it will install, and you can add/remove any specific SDK versions that you may want right there.
The space required will update to reflect your changes and then once you're done. In this case, I selected Windows SDK version 17763 (I only had one other selected on this device).
After this you'll have everything you had before, and the new workload that you have just installed.

Cross-compilation with Visual Studio 2019

I'm using VS2019 under Windows 10 and I'm trying to figure out how to compile for the non-Windows platforms. I'm aware that only some languages support cross-compilation (C# being one of them). So I decided to start off with one of Microsoft's own examples (the Console App for .NET Core). When asking VS2019 to create the Console project, it shows me various image icons which suggest that it'll be buildable for Windows, Linux and macOS - but no matter what I do, I can only make it build the Windows target.
After a bit of research I realized that I need to add this line to my C# project file:-
<RuntimeIdentifiers>win10-x64;osx.10.11-x64;ubuntu.16.10-x64</RuntimeIdentifiers>
but even after adding that line (and re-loading / re-building the project) it staunchly refuses to build anything apart from the Windows target. Over on CodeGuru, one of the devs there tried it for me (under VS2017) and managed to make it work - but I've tried it in VS2019 and also VS2015 and I can't make it work in either of them. Any ideas what I might be doing wrong??
[Edit...]
Thanks Magnetron - if I press Build->Publish I see a totally different dialog from the one you're seeing (and it's the same in both VS2015 and VS2019):-
Even if I follow the Next or Finish buttons I never see the Create Profile option :(
Go to Build > Publish, select Folder and click on Create Profile
Then Click on Edit and change the Deployment Mode to Self-contained. At last, you can specify the target OS in Target Runtime
You can create multiple profiles for each OS, and publish each one individualy as needed.
Edit:
The posted publish dialog is for a .Net Framework Console app, not an .Net Core one. The .Net framework is Windows only, you have to create your project as a .Net Core
Woohoo!! I just ran the VS2019 installer to remind myself how to uninstall (in preparation for tomorrow) and it told me there's already a 16.3.5 available. 16.3.4 only got installed a few hours ago but for the hell of it, I figured I might as well try the newer version - and it's now working !!!

Setting UWP Target System

I'm building an UWP application using Visual Studio 2017 Community Edition.
Everytime I create a new UWP project, I cannot select Target version lower than version 1809. See below pic.
My problem is, my current windows 10 version is 1803, and when I want to update my windows 10 to 1809, I found that 1809 is somehow not available according to this post in windows forum below:
Link to forum
What happen then, when ever I want to design and preview my UWP app, I cannot render all controllers within the page. Like below pic.
My question are:
How can I resolve this besides waiting for update 1809 avail?
Is there anyway I can change the TARGET VERSION of my app? so I can have better experience in coding my app?
Thanks
If I understand correctly, you have to install older SDK for Min version before you start work.
You can find all versions of it on this page and download them Windows SDK and emulator archive .
for example If you want it to be at least compatible with the Windows 10 Anniversary Update then you should download and install SDK (ver. 10.0.14393.795)

Windows Mobile & other Extensions for the UWP - which version should I use

I have already got to know that in order to obtain DeviceId I should add reference to my project - "Windows Mobile Extensions for the UWP" this SDK comes with Visual Studio and is available in References Manager under Windows Universal/Extensions position.
However there are two positions like that on the list, they come with different versions - 10.0.10240.0 and 10.0.10586.0.
Which one of them should I use? Are there any differences that I should be aware of, or should I just keep using newer one? Are they related to the windows build number on the machine I want to run my app?
A Universal Windows Platform project can use feature detection to take advantage of APIs available on a platform version "2" and still run on platform version "1", the same way it can run on desktop, mobile or IoT with specific user experience for each platform.
This is how to deal with feature detection (and not version detection)
https://blogs.windows.com/buildingapps/2015/09/15/dynamically-detecting-features-with-api-contracts-10-by-10/
Check how to setup your project properties
https://msdn.microsoft.com/en-us/library/8x480de8.aspx
In the Solution Explorer, right click on References and add the Windows Mobile Extensions for the UWP.
You may still need to remove the older SDK reference and do a clean build, but this resolved that error for me on the samples.

Broken Reference in WDK 8.1 Printer Extension Sample

I've installed Visual Studio 2013 Premium and the WDK 8.1 Update, unfortunately though, when I open the Printer Extension Sample ([https://code.msdn.microsoft.com/windowshardware/Printer-extension-sample-0e3e1562][1]) from the WDK samples pack, the reference to PrinterExtensionLib is broken.
I'm sure there must be a prerequisite I'm missing somewhere, but I've got the latest .Net, latest updates to Visual Studio and the latest WDK 8.1, so I'm not sure what I'm missing.
I've placed the sample project in c:\apps as the sample tells you to do, but still not joy.
Does any body know what I'm missing / haven't installed?
Well, I've just spun up a Windows 8 VM and the reference seems to be satisfied, so I guess you can only build some of these samples on a Windows 8 Machine. The sample states that it should be run on Windows 8, but I didn't see build machine requirements.
So, I guess the answer is, I was missing Windows 8 (Yuk).

Categories

Resources