How to create .NET Platform Standard project - c#

I read up on the new .NET Platform Standard concept replacing the old Portable Class Libraries, which seems nice. However, I can't seem to figure out how to create such a library, yet.
Is there a Project Template for Visual Studio where I could choose the target generation / netstandard? Or do I have to manually change a PCL project.json file for this?
(Got VS15, Update 3 installed)

If you create a PCL project and then double click properties, you should see an option to change your target platform. That will let you choose a .net standard version. Same thing as doing it yourself in the project.json but is the closest thing I have found so far to having a VS template do it for you

You can follow this Create .NET Standard Packages with Visual Studio 2015
From the article:
This guide will walk you through creating a nuget package targeting
.NET Standard Library 1.4. This will work across .NET Framework 4.6.1,
Universal Windows Platform 10, .NET Core, and Mono/Xamarin.

On Visual Studio 2019 it is possible to create projects that target .NET standard, just as you create another type of project. To do so, you just need to add new project, and then if you search for .net standard it will show several types of projects in which you can target .NET standard, as shown below.

You can also create new .NET Platform Standard projects from a template by using Visual Studio 2017 RC.

Related

Is there a Visual Studio 2022 .Net 6.0 compatible version of Microsoft.Express.Drawing?

I would like to create a WPF custom control circular progressbar.
Earlier versions of .Net would support the Microsoft.Expression.Drawing nuget package download which made Arc creation really simple.
I am developing with Visual Studio 2022 and .Net 6.0 .
If I try to download the Microsoft.Expression.Drawing nuget package, an error message is produced saying that some parts of the package are not compatible.
Is there a viable substitution?
It looks like it's baked in now if you take a look at the WPF to .NET6 migration guide.
At least some of the blend namespaces are included.
NetCore5.0.Microsoft.Expression.Drawing nuget package

Is it possible to use .NET 4.6.1 for Xamarin on Mac?

I want to use .NET PCL library from a NuGet that target .Net 4.6.1 in Xamarin PLC project.
I can add it to the project, it will build fine. But, I cannot reference it in the project itself, it just doesn't allow because of .NET versions differences. The maximum version that I can set for my PCL projects is 4.5.
I can select 4.5.1 for example but it will jump back to 4.5 due to missing profiles for that version.
I was not able to find those profiles or update .NET Framework.
If I'm doing something completely dumb, please, tell me :)
If you are using visual studio 2017, you need to go to the visual studio installer, and select a few more checkboxes:

Targeting .NET Core 2.0

I just create a simple ClassLibrary project with VS2017 preview 2.1.
I create using .NET Core project template. When I check in project details, I see it targets .NET standard 2.0. How I may target .NET Core 2.0 (that implement a larger number of API according to a test made with API-Port tool)
Update: The templates have been fixed in a recent update to VS 2017 15.3 Preview.
This really looks like an issue with the templates, I also created a project from the "Class Library (.NET Core)" template and it targeted .NET Standard 2.0.
However, this can easily be fixed by editing the csproj file manually from
<TargetFramework>netstandard2.0</TargetFramework>
to
<TargetFramework>netcoreapp2.0</TargetFramework>
This project type allows editing the csproj file while the project is loaded by right-clicking on the project and selecting "Edit {project}.csproj".
It looks you may create a .NET Core app with VS2017 targeting .NET Core 2.0, but as soon you create a .NET Core project library, it targets .NET standard, it might be a limitation of this preview of VS2017.
The issue is gone with VS2017 15.3.0 Preview 3!
I'm on Visual Studio 2017: Community.
I installed the SDK found here: https://www.microsoft.com/net/download/thank-you/dotnet-sdk-2.1.3-windows-x64-installer
You should be able to see the NET Core 2.0 as the target framework when creating your project.

.NET Framework 2.0 and 4.0 Visual Studio Toolbox item

I want to install two different version of my WinForms custom control in the Visual Studio Toolbox: the .NET Framework 2.0 version and the .NET Framework 4.0 one. I found this professional solution http://vstudiotoolbox.codeplex.com/ but selecting the proper .NET Framework is not covered.
Where can I learn more?
Thanks.
http://www.lextm.com/2012/08/how-to-install-custom-controls-to-visual-studio-part-i/
This covers what is required to install a .NET 2 control. If you want to install .NET 4's, you can follow
http://www.lextm.com/2012/08/how-to-install-custom-controls-to-visual-studio-part-ii/
My open source project is a sample for you to review how to perform the needed steps,
https://github.com/lextm/actionlistwinforms
Inno Setup is used to author the installer, but the tricks should apply to other installer techniques.

How to create .NET2 compatible app in VS2010?

I'm using Microsoft Visual Studio 2010 and .NET4, but I would like to create application(Windows Form Application) that can be also run in .NET2. The reason is that I want it to be very easy to use and portable across many machines and not everybody has .NET4 installed.
Can I do it or do I need to install older version of Visual Studio? Is so what version is the best for most portable .NET app.
You can modify the target framework in the properties of the project:
You can select which .NET Framework version you want to target when you create a new project. If you want to change the framework of an existing project, do what Darin has illustrated.
Just modify the target framework by looking at the propeties of the solution you are working on.
I would highly advise you to target .NET 3.5 just based on the age of .NET 2.0.
.NET Framework 2.0 was attached to Visual Studio 2005.
By modifying the target framework is the way, but if you are thinking of portable maybe what you need is some kind of native code that works in every and/or most windows version.
Don't forget to delete redundant namespaces from your namespace list. For example LINQ...

Categories