Build .NET Core 3.1.1 from git repository - coreclr

I would like to build from source the .NET Core 3.1 CLR and libraries. I checked out the latest from https://github.com/dotnet/runtime. Running the build scripts will produce the next version of .net and not 3.1.1. Can you tell me how to get the .NET Core 3.1.1 source and build it? I want to be able to produce a debug version of the core so that I can add tracing and logging.

Go to 3.1.1 tag in dotnet/coreclr repo (https://github.com/dotnet/coreclr/tree/v3.1.1)
The entire coreclr repo has merged (along with corefx, corert and the installer) to dotnet/runtime.
The dotnet/coreclr repo is an archive currently, which still holds all the old tags.

Related

Issue with code generation in .NET 5.0 with Entity Framework Core

I'm having issues when creating an API Controller in .NET 5.0 with Entity Framework Core.
Here's what I'm doing:
I'm using .NET 5.0
Installed the Entity Framework Core packages and all 3 have the version 5.0
The model and DataContext classes have already been created and using them had already created a table in the database earlier
However when I right-click on the API project, click on Controller > Select "API Controller with actions, using Entity Framework" > Select "Model Class" & "DataContext class" > Enter the name of the controller
I keep getting the error
There was an error running the selected code generator: Package restore failed. Rolling back the changes for API
Troubleshooting done:
Cleared the NuGet Cache in Tools > Options > NuGet Package Manager > Clear All NuGet Cache(s)
Made sure that the Entity Framework Core packages and the .net version are the same in the .csproj
What am I missing here that is causing the issue?
If you have installed the latest version of Microsoft.VisualStudio.Web.CodeGeneration.Design package, you probably got version 5.0.2. That package cannot generate code based on Entity Framework Core packages of version 5.0.0.
From my experience - to generate EF Core based code, the version of your Design package should be equal to or less than the version of your EF Core packages. So, you need to either upgrade the EF Core packages, or install the version 5.0.0 of the Design package.
EDIT:
I faced the same issue and it was resolved after upgrading the EF Core packages, which is 5.0.4 currently, and installing the latest Design package, which is 5.0.2 currently.
In my case to generate EF core based code, i need to installed version 5.0.13 of Microsoft.EntityFrameworkCore and version 5.0.12 of Microsoft.EntityFrameworkCore.SqlServer and Microsoft.EntityFrameworkCore.Tools
and version 5.0.2 of Microsoft.VisualStudio.Web.CodeGeneration.Design
Note:- Make sure to clear Nuget Cache

NuGet package not installing in .NET Framework

I have created .net standard library project and I have created nuget package for this library, Now I need to install this package in both application .Net Core and .Net Framework4.5. Working fine in .Net Core but while installing .Net framework project it was showing below exception.
You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Please let me know the right approach to resolve this.
The library that you have created targets .NET Standard 2.0, as stated in your tags. .NET Framework 4.5.2 does only implement .NET Standard up to version 1.2, that is why the assemblies are not compatible.
You should change your library to a .NET Standard version that is implemented by both .NET Core and .NET Framework or upgrade your .NET Framework version accordingly.
You can find the version mappings here, credits to #Matt Ward for providing the source.

Are xdt transforms not supported in nuget packages installed in a netstandard 2.0 project?

I have a nuget package that has .xdt transforms for a app.config file. The xdt files are included in the netstandard 2.0 project that builds the nuget package. Their build action is set to content/do not copy. When I install the package in a .net framework project, the xdt transforms work corectly, but when I install the package in a netstandard 2.0 project, the xdt files do not transform the config file, but instead are added to the project with a build action of C# Compiler. Does nuget not support xdt transforms on netstandard projects?
You are right, xdt transforms aren't supported in PackageReference environment. This includes both sdk-based projects as well as classic .net framework projects using PackageReference instead of packages.config. You can follow this GitHub issue for more details. There is also a sample package that shows how to use build-time logic to apply transforms instead to work in all environments.
Also note that .NET Standard and .NET Core projects don't have an app.config file that a transform could apply to. This is only relevant for .NET Framework / classic Web Applications. (with maybe an exception for IIS settings for ASP.NET Core apps but they don't affect the app itself, only IIS hosting environment).

Support .net Core for a nuget package

I have created a nuget package implementing TinyEncryptionAlgorithm but it supports only .Net 4.6.1
Now I want to use this nuget into a .net core application NETStandard.Library and I don't know what I have to do.
Do I have to implement a completely new nuget package or I can include both assemplies in the same nuget package?
I have tried to create a NetStandard library and reference it from a .Net 4.6.1 but this is not working.
To support multiple version of .Net you must create portable libs.
Here is a tutorial of how to publish nuget for portable libs.
https://docs.nuget.org/ndocs/guides/create-net-standard-packages-vs2015

Which lib folder should I use for my portable library targeting net45, asp.net core 5.0 and windows 8?

I am currently developing a portable library in C# that I want to publish on the NuGet official feed. I have published assemblies as NuGet packages before, but they were written against a single framework (.NET 4.0).
Now I'm confused how I should organize my lib folder in my NuGet package - my portable library can be used with .NET 4.5, ASP.NET Core 5.0, Windows 8, Windows Phone 8.1 and Windows Phone Silverlight 8 projects.
I tried to look up the framework profiles and their corresponding NuGet abbreviations, but I couldn't find them in the official documentation. Stephen Cleary gathered up profiles a while ago, but his list does not contain the profile for ASP.NET Core 5.0.
My actual question is: how should I structure the lib folder of my NuGet package? What is the profile name for portable libraries that target the framework versions mentioned above? And if I get that very profile name, is the assembly properly referenced in a non-portable library project (e.g. .NET 4.5 or WinRT)? Or should I make subfolders for the different framework version and copy the exact same assembly in all of them (which would largely increase the size of the package)? I habe seen some packages (like xunit.assert) doing it this way in NuGet Package Explorer.
The actual folder name that one has to use in this case is the following one:
portable-net45+wp80+win8+wpa81+dnxcore50