So I am trying to build a small interface for a side project. I have a private MongoDB instance and am trying to use UWP as my GUI. My goal was to use the MongoDB C# driver to provide the interface between my app and the server. The problem is the driver is only compatible with .NET Framework 4.5.2 or .NET standard 1.5.
I am having problems selecting a library type to use with my UWP app to interface the two. Any Ideas? If I have to I am even willing to spin off an additional library just to handle the interface of the driver and my model classes.
As you've known, MongoDB.Driver targets .NET Standard 1.5. However, for now, the highest version of .NET Standard that Universal Windows Platform supports is 1.4, which means this package is not compatible with UWP apps. So we can't use MongoDB C# Driver with a UWP app now. For more info, please see .NET Standard.
But a good news is that .NET Standard 2.0 has released and UWP will also support it in the upcoming version (expected to ship later this year). See Announcing .NET Standard 2.0. With .NET Standard 2.0, we should be able to MongoDB C# Driver in UWP apps. And if you want to do a test now, you can join Windows Insider Program and try with Visual Studio 2017 Version 15.4 Preview.
Visual Studio 2017 version 15.4 Preview brings first class support for developers targeting the Windows Fall Creators Update SDK preview. The Windows Fall Creators Update brings support for .NET Standard 2.0 to UWP development.
For more info, please see Visual Studio 2017 Version 15.4 Preview and UWP & .NET Standard 2.0: A preview is now available!
Related
I am very new to C# development. Like Youtube tutorial new. I am trying to build a console app to install services to our servers. Is there a way to pick which .Net version you want to use to build the application? So that I the writer can tell the user which .Net version they should have in their system for the console app to run?
I am using Visual Studio 2019
Thanks to #David Browne's comment under my original post all you need to do is make sure to select .Net Framework version of the Console Application template in Visual Studio project template. Not .Net Core. I wasn't aware there was a difference:
"You set the Target Framework in the Project Properties. But the Project Type determines whether you're targeting .NET Framework or .NET Core"
You have 2 options to get started
.NET Framework - Apps build using .NET framework can only run on Windows. This is an years old proven and secure stable, mature eco system
.NET Core - Apps build using .NET Core can run on Windows, Linux and Mac. It's cross platform and open source. Latest is v5.0.
I recommend you to use the latest .NET Core v5 for your new projects. It's stable and Microsoft is well supporting it. .NET Core much is powerful, faster and optimized.
You can create different kinds of apps using .NET Core. You can create simple console apps, libraries or asp.net core web apps. MVC and WebAPI are supported. As you mentioned, if you want to create a service, There is "Worker Service" project available for .NET Core.
If you create a Worker Service it can run as a Windows Service in Windows machines and a Linux Deamon in Linux machines.
Visual Studio 2019 got well with .NET Core and it's features.
If you need to run a .NET Core project in Windows, Linux or Mac machine, you also need to setup the deployment machine installed with .NET Core runtime. It's available free from Microsoft website. Download.. Install.. Run. That simple
Does anyone know if .NET Standard 2.0.0 is supported on Mono? I currently have a build that is working fine on windows 10. When I attempt to use in Mono in a Ubuntu Linux environment I get the following error:
Could not locate the assembly 'netstandard'. Check to make sure the assembly exists on disk.
Dotnet core 2 is added with no problems via the SDK, but I seem to not have any references to .NET Standard 2. I had a similar problem on windows 10 originally, which was resolved after I updated my version of visual studio.
Consult the release notes for details, but Mono 5.4.0 includes NuGet 4.3.0 and MSBuild 15.4.
Mono 4.8.0 Preliminary support
API additions for .NET Standard 2.0
We added APIs to comply with .NET Standard 2.0, which is still a work in progress at the time of this writing. Note that in some cases an implementation is still missing and will throw at runtime.
Mono 5.2.0 Runtime support (compiling is in "Preview Status")
.NET Standard 2.0 groundwork
We’ve done all the groundwork to support libraries that conform to .NET Standard 2.0. Loading and running a library compiled against the 2.0 standard should work fine, tooling support (i.e. creating a .NET Standard 2.0 library) is still in preview though.
.NET Core 2.0 SDK Installation needed
You’ll need to install the .NET Core 2.0 SDK for tooling support as we use the MSBuild tasks which are installed as part of the .NET Core 2.0 SDK, similar to how Visual Studio/MSBuild on Windows does it.
I want to use Selenium in my UWP app, but since UWP's runtime is WRC,
I can't install Selenium.WebDriver package (it targets .NET Framework 3.5 & 4.0) or CoreCompat.Selenium.WebDriver (it targets .NET Standard 1.5, and UWP does not support it right now).
The reasons mentioned above, are the same reasons why can't I use a .NET Standard 1.4 (as mentioned before, UWP supports up-to .NET Standard 1.4 class library).
I tried using a Portable Class Library, which targets .NET Framework and UWP, but after installing the Selenium.WebDriver package, I couldn't access it (I did reference it).
Am I doing some thing wrong? Can someone suggest a solution?
Selenium currently doesn't support UWP apps. And UWP .NET Native support will go from 1.4 to 2.0 (fall 2017).
I suggest using appium.io to test UWP apps, which also uses the WebDriver protocol you're using with Selenium.
We are writing an application that has to run on Windows 7... and we can't install a new version of the .NET framework on those client machines. As the developer, I want to use all the fancy new C# 6.0 language features, and if I understand correctly, the language and the framework have been decoupled.
I just need clarification: If I target C# 6.0 in my application, will the code still run correctly on a Win7 client with .NET 4.0 as the highest framework version?
Yes, you can use a C# 6 compiler while targeting an older version of .NET. The way this usually works is that you have a newer version of Visual Studio and target it at a specific .NET version. For C# 6, this means VS2015. You will be able to use any new C# features, as long as they don't rely on .NET libraries. In particular cases, such as if you want to use async stuff, there are backward compatibility libraries available.
You could also use csc.exe (C# compiler) directly, and bypass Visual Studio.
I am interested in C# windows application development. But now that I have shifted to Ubuntu I am no longer able to do it. Is there a way other than virtual box to develop a C# windows application in ubuntu??
Well there's the Mono Project but if you want the Microsoft .NET implementation you need Windows.
You might be interested in Mono Project.
It is an open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET. However Mono is not totally up-to-date with lates releases of .NET Framework. It is a mix of .NET 2.0 - .NET 4.0 features.
The Mono project focuses on compilers and runtime libraries and does not directly provide an IDE like Visual Studio. Check here to check available solutions.