How do I create and distribute a new .NET Core project template? - macos

I've got a custom project template for a .NET Core project that I'd like to make available via dotnet new <templatename>. It was developed using Visual Studio Code on Mac OS X.
This document discusses creating new projects, specifically for ASP.NET Core, but I want to create and distribute a new .NET Core project template that doesn't include ASP.NET. It's just a class library project with some key modifications.
Question: How would I create a package for this purpose and distribute it both privately internally and/or publicly? Is it possible to simply package this up as a NuGet or Yeoman package, or is there some other mechanism I need to use?

UPDATE: Here is the official team blog: https://blogs.msdn.microsoft.com/dotnet/2017/04/02/how-to-create-your-own-templates-for-dotnet-new/
We currently have the documentation on a gist, but are working on turning it into a team blog soon. I will update here when the blog is posted and public.
For now, you can refer to the gist: https://gist.github.com/sayedihashimi/05741c31ca559f1960bef159a5684988

Related

EF Core with UWP - Visual Studio 19

I am using Visual Studio 19 and all of the questions I found on so and other places, or were older and for another version.
I am using Entity Framework Core with SQLite and UWP.
How will I do this?
I have a c# console app that targets .net standard 2.0.
This is the project with my DB context and tables. Also, I cannot use the migrations because it is a .net standard and not a .net core or .net framework.
Thanks!
P.S. If you need more info, please let me know. I can also provide error details if needed!
Since both EF Core and uwp app rely on and support .NET Standard 2.0, so that EF Core can be used in UWP. You could refer to the official document to know how to use migration in uwp app.
Generally, you need to create .net standard class library and add some model for it. Then you could add reference to this library for uwp app.
Please set the library as startup item, then you could input the following command in Package Manager Console.
Add-Migration Init
Init is the name of this migration. After that, you can see that a Migrations folder is generated in the project, which includes class files representing each Migration, which are inherited from the Migration class.
To use Migration in uwp app:
using (var db = new BloggingContext())
{
db.Database.Migrate();
}
Note that: To execute the Migration command, the library project must be the startup item, because the current version of EF Core Tools does not support UWP projects.

In Visual Studio 2019, .net Core 2.1, how do I add .net Framework assembly to the project

I am working in Visual Studio 2019, and .net Core 2.1.1.
I am currently working on trying to get Identity Server 4's WsFederation integrated. In the latest instructions I could find, he mentions adding System.IdentityModel to the app through the project.json. Project.json seems to be deprecated now in .net core projects, and I am having a hell of a time figuring out how to add a freaking .net assembly to my project. Do I really need to just copy the file into the project and reference, cause that just seems wrong.
Instructions I am using:
https://www.scottbrady91.com/Identity-Server/IdentityServer-4-SharePoint-Integration-using-WS-Federation
Seems to all come back to the project type. I had created the project with AspnetCore and so I couldn't reference any .net framework assemblies, because you can't go back once you have made that choice. However, if you create the project specifically under the .net framework, you can move forward into the core frameworks, and hosting libraries of core. Which then allowed me to pull in the System.IdentityModel assemblies I needed to continue forward.

How to convert NetFramwork 4 code to NetCore 2?

I have a C# project which was created using NetFramework 4.6. I want to convert it to using the NetCore 2.1.
I checked the network, and people say I can just change the Target Framework value in the project's properties page. But on my computer, I cannot see options for NetCore.
I already have the NetCore 2.1 SDK installed.
Is there another way to convert the project? Is there something wrong with my project that prevents it getting converted?
People are wrong, there is no such "one step" approach.
Remember that .NET Core is not a higher version of .NET Framework, it is rather a rewrite from scratch. So it does not work like retargeting .NET Framework version form 4.0 to 4.5.
Porting to .NET Core from .NET Framework is a good place to get started.
Edit: This page lists some differences between .NET Core and .NET Framework.
You can't do this simply like this; because of their totally different frameworks, not different versions of same framework. You have to port your project to .net core; there is one of the nice extension for visual studio that generate a report for you about how portable your code is between .NET Framework and .NET Core.
This is also one of the article about the issue that may be useful for you.

ABP 3.0 differences between Full and Cross Net Framework template

Related to "Free Startup Templates" for the last ABP 3.0 version, what are the differences between the Full .NET Framework and .Net Core (Cross Platform) versions?
I presume you are talking about the ASP.NET Core 2.0 target framework, either Full .NET Framework and .NET Core (Cross Platform)?
I think the code is more-or-less the same (as mentioned by #Alper Ebicoglu the .NET Core project is missing the SignalR implementation) but the output from the build will be for .NET Framework 4.6.1 as supposed to for .NET Core.
Basically they're building a .NET Framework project using .NET Core tools which you can do.
For example:
Create a temp folder and open Command Prompt or PowerShell in that directory. Then run dotnet new console, then dotnet restore and finally dotnet build. You should get a message like temp -> C:\Source\temp\bin\Debug\netcoreapp2.0\temp.dll
Edit the .csproj file and change the TargetFramework property to net461. Run dotnet build and you'll see a different message temp -> C:\Source\temp\bin\Debug\net461\temp.exe.
In the first instance you created a .dll to run cross platform using dotnet run and in the second instance you created a .exe which will only run on the Windows platform.
I hope I'm answering what you're asking and this helps.
if we talk about only aspnetboilerplate framework; the only main difference is, currently in .NET Core platform SignalR implementation is missing.

What is the aspnet50 target framework, and can I reference it from VS2013?

The packages at https://www.myget.org/gallery/aspnetrelease target aspnet50, and when I try to install them I get:
You are trying to install this package into a project that targets
'.NETFramework,Version=v4.5', but the package does not contain any
assembly references or content files that are compatible with that
framework.
Is there a way?
You can't do that (currently). If you insist on working with ASP.NET vNext in VS2013, you can use it as an editor and run everything from the commandline with the tools from the aspnet Home repository.
You should install the newest CTP of VS14 if you want to work with asp.net vNext, which you can download the newest version of from here and learn how to use it in this guide. ASP.NET vNext is in alpha currently, so documentation and information can be a bit sparse. aspnet50 is the (current) name for the new .Net framework introduced with ASP.NET vNext.
I was able to manually download the nuget packages and had no problem referencing from VS 2013.

Resources