How do I set a different API contract to be used in Visual Studio for a Universal App? - visual-studio

I've retargeted my C++/CX UWP project to the latest Windows version (10.0.10586) available to me. However, under references, the Windows.Foundation.UniversalApiContract version shows 2.0.0.0, the latest is 3.0.0.0 introduced in 10.0.14393.0. I need to use the features in 3.0.0.0, but I can't figure out for the life of me how to use it. I've looked through the .vcxproj, and the appxmanifest and I can't find anything relevant. There's nothing I can find in the GUI either. How do I change the version?

You can set the target version in the project properties.
In the Project Properties editor it's in the config tab's Target Platform Version:
In the vcproj it's the WindowsTargetPlatformVersion:
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10586.0</WindowsTargetPlatformMinVersion>
You'll need to have the 14393 SDK installed from https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk . If Visual Studio thinks 10586 is the latest then you probably don't have the updated SDK. You should also make sure you have the latest update to Visual Studio (2015 Update 3 or 2017 RC)

Related

OmniSharp Error: Found dotnet version 5.0.201. Minimum required version is 6.0.100

I use VS Code as my IDE. Today I saw in my C# files that I could no longer use things like "Go To Definition/Implementations" or hover over anything to get the path/type etc.
I found my Omnisharp console and saw they updated last night and there is an error:
Error: Found dotnet version 5.0.201. Minimum required version is 6.0.100.
I can't upgrade my dotnet because 6.0 is not compatible with the runtime in my project and on Mac M1, there are a lot of issues running multiple dotnet instances..
I guess its a bit of a rock and a hard place, anyone know how I can get around this issue?
This is a recent update to Omnisharp, which is used by the VS Code C# extension. Add this to your settings and restart the editor.
"omnisharp.useModernNet": false,
"omnisharp.path": "",
Also if you don't have Visual Studio installed you will likely need to install the Build Tools to get MSBuild:
My understanding of the rationale behind this change is an optimization for modern vanilla c# projects over those using older versions (ie Unity). More info in this issue.
Revert your Omnisharp to previous version
Update 1.25.0 introduces newer OmniSharp build for .NET 6 which does not support non SDK style .NET projects but results in performance improvements.
Fortunately you can disable this in the settings:
C# Extension Settings
Also, the C# extension no longer ships with an included Mono & MSBuild Tools. Download them here: Build Tools
Worst case, you can revert to an older extension version.
Go to extensions in VS Code and search for C# Extension
VS Code Extensions
Go to C# Extension settings
C# Extension Settings
Disable "Use Modern Net" option.
Modern Net Option
Restart VS Code
I haved similar problem and i fixed like this:
Im using win7 and i have VS 2019 IDE which not supporting dotnet 6 cuz of that vs_installer not installing dotnet6 sdk, in result i cant use c# extension v1.25.0 in vs code, because omnisharp needs net6. I installed net 6 sdk to my win7 and problem is solved, now i can use c# extension v1.25.0 in vs code.

.Net 6 Not show in Visual studio TFM,

It's weird.
If I create a new project and choose DotNet 6 framework by Visual Studio 2022. I will get the NETSDK1045 error code.
But create a new project from the console, everything is Ok.
Run dotnet --list-sdks and see if the expected .NET6 version is installed.
My guess is that you might have x86 issue. If you have installed x64 version, install x86 version and vice versa and test if the issue is gone.
You can also try to repair your VS 2022 instance and/or upgrade to latest official version.
There is also a small probability that you select a project type that does not supports .NET 6 (for example .NET Framework Web App project type).
Also you may check your path contains the dotnet folders in the correct order for your architecture.
References:
https://learn.microsoft.com/en-us/dotnet/core/tools/sdk-errors/netsdk1045
VS2017 : Target framework drop down does not show .NET Core 2.1 option

VisualStudio XAML designer tell me i need build 19041 but it's already installed

I'm creating a windows desktop universal app (UWP) using Windows Template Studio on Visual Studio 2019 Community, on a Windows 10 Family Edition.
Windows and VS2019 were updated today (before creating this app).
After the project was created using WTS i have an error telling me (mine is in french so i'll try my best to translate) that : I need to upgrade to "windows 10, version 2004 (10.0.19041.0)" in order to display this content (aka : the XAML UI designer). However, the 19041 sdk is already installed. I can build and run the application just fine. It only a problem with the designer.
If i change the application property target to from 19041 to version 1903 (10.0 ; Build 18362) and reload the project, it works just fine.
I don't think i really need this 19041 (i hope so) but : what's happening and how to fix it ?
If you set the target version at 19041 (2004), this requires your development environment to be at least 19041. The SDK installed through Visual Studio contains some development tools corresponding to the platform, but UWP development usually requires some native resources (such as colors, control styles, etc.), and these resources will follow the system update.
So when you set the target version of the project to 19041, the target of some local resources referenced by the project is 19041. If your development environment is lower than this version, the designer will not be able to display.

How to install Xamarin.Android for Visual Studio Enterprise 2015 offline

I want to install Xamarin for Android Development in Visual Studio 2015 Enterprise.
While installing, Xamarin told me that I was missing a lot of features, so it would download and install them for me. The download size was around 2GB, and I have a really slow internet.
I wanted to know if there is a way to download Xamarin and all required components separately, using some download manager like IDM, and then be able to use it later to re-install/install on another PC.
Also, I was able to find offline setups for JRE and JDK, and also Android Studio and Android SDK/NDK, but still, the download size is around 1.5GB, which I presume is for the required Android SDK libraries, APIs and tools.
So, I am just asking for a guide on downloading all the components and store them for installing later.
According to the official docs (whose pictures are outdated, by the way) you should login to your account and then head to the download page where you could find links to different versions of Xamarin.
I did so, but all that's available there are older versions of Xamarin Studio and the universal installer. Similar searches on the Xamarin Forums yielded no results as well.
There's a way to find the direct URL for each installer by checking the XML used by the Platform Installer (located at \AppData\Local\Temp\Xamarin\downloads\InstallationManifest.xml). I haven't tested whether installing them separately will work or not, but it probably will. Just make sure to install them in the right order (and to install the Android SDK/NDK after installing Xamarin.Android)
Here are the links to the latest versions, as of today:
Xamarin.Android
Android SDK
Android NDK (x64)
GTK#
Xamarin Studio
Xamarin for Visual Studio
It'd be good if someone with a Mac could help me find the URL for Xamarin.iOS, but that's a start :P
You can download this XML file and find the link of latest version of all required components.I did this and the latest links are :
Java JDK 1.7
Android SDK 24.4.1
NDK 10 (32) or NDK 10 (64)
Xamarin for Visual Studio 2015 4.1.2.18
Intel HAXM 6.0.1
Microsoft MSBuild Tools 2015.0
You don't even need to login for download them.
After 1st web install, backup %tmp%\Xamarin\downloads\ , then on a new Windows:
Uninstall Java 1.8 if exists.
Manually install Java JDK 1.7u71 + GTK# + Android SDK (Install for anyone).
Extract NDK to "C:\Program Files (x86)\Android\android-ndk-r10e", or make NTFS junction to it (not to run out of C: space later).
Run XamarinInstaller having just *.zip files in %tmp%\Xamarin\downloads\, when you see that current download is "XamarinStudio", disconnect Internet (you can delete the NDK now).
When you see above the progress bar: "Downloading Xamarin Studio", you can close the web installer.
Manually install Xamarin.VisualStudio, and if you want, XamarinStudio.
Step 4 require Internet, but noting to download.
To make NTFS junction, from "C:\Program Files (x86)\Android" prompt:
mklink /j android-ndk-r10e T:\android-ndk-r10e
where T: can be USB drive, but not Network drive.
I know it's a link only answer (copyright!), but there are step-by-step instructions including screenshots of how to do that:
Installing Xamarin Made Easy with Offline Installation
I've not tried it, but it should help you.
Found this:
http://ionemind.com/content/get-direct-download-links-xamarin
Links to XML files with direct links to necessary components for Xamarin, including Xamarin for Visual Studio (version 4.5, for VS 2013 and 2015).
Another link I found:
https://dl.xamarin.com/XamarinforVisualStudio/Windows/Xamarin.VisualStudio_4.8.0.1289738.msi
I had installed Xamarin Studio 5 and then it autoupdated its components (to Xamarin Studio 6.3 and the mentioned VisualStudio Tools 4.8).
Then in the "AppData/Roaming/Xamarin X.X" I found a folder for temp downloads. There was the MSI file.
Then I just searched for this exact MSI name to get a direct link.
(on this site https://itblogdsi.blog.fc2.com/blog-entry-23.html)
There's actually some info about releases and MSI names and it has Xamarin.VisualStudio_4.9.0.1538920.msi so replace this part in the MSI link above.
It's for VS 2015 only.

VS2005 and Windows SDK 7.1

Running the WindowsSdkVer.exe shipped with Platform SDK 7.1 does not work.
None of the .BAT files in VS 2005 get updated.
can anyone please tell me how to correct this?
Also, how do I verify that VS2005 is using Platform SDK 7.1?
There are several articles for this in MSDN but none of them for above configuration.
Also, none of them describe the concrete way / definate way of verifying this
You could try to manually set the include and lib paths of the VS environment under
Tools->Options->VC++ Directories
or something like that (it's been a while).
For verification, you can add the /showIncludes parameter to the additional compiler options of the project, and /verbose:lib to the additional linker options to double check that the correct headers/libraries are being used when compiling/linking the project.
IIRC there was some kind of incompatibility between one of the newer versions of the SDK (could have been version 7) and using VS2005, but I can't recall off hand what that was.
You can use below method for using Windows SDK 7.1 with Visual Studio 2005.
Configuring Visual Studio for Visual C++ Development with the Windows SDK
In the link , you can find the contents with
"To use the Windows SDK Configuration Tool in Visual Studio 2008".
Even though it has such title, you can use the same procedure also for VS2005.
Start the Windows SDK Configuration Tool by clicking Start, then All Programs, then Microsoft Windows SDK v7.1, and then Visual Studio Registration.
Right-click Windows SDK Configuration Tool and then click Run as
administrator.
In the Windows SDK Configuration Tool, in the list, select v7.1.
Click Make Current.

Resources