Trying to get a custom CoreLib in .NET Core project to load in VS 2017. This was super easy in .NET Framework as all you needed was "NoStdLib" but with .NET Core seems like a lot more parts are needed. I keep getting: "Project file is incomplete. Expected imports are missing."
<?xml version="1.0" encoding="utf-8"?>
<!--<Project Sdk="Microsoft.NET.Sdk">-->
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{3DA06C3A-2E7B-4CB7-80ED-9B12916013F9}</ProjectGuid>
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!--<TargetFramework>netcoreapp2.2</TargetFramework>-->
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
<ExcludeMscorlibFacade>true</ExcludeMscorlibFacade>
<NoStdLib>true</NoStdLib>
<NoCompilerStandardLib>true</NoCompilerStandardLib>
<LangVersion>latest</LangVersion>
<RootNamespace>System</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<AssemblyName>System.Private.CoreLib</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<MajorVersion>4</MajorVersion>
<MinorVersion>6</MinorVersion>
<ExcludeAssemblyInfoPartialFile>true</ExcludeAssemblyInfoPartialFile>
</PropertyGroup>
</Project>
Going off what System.Private.CoreLib.csproj is doing and not sure what the missing part is? Removing "Sdk="Microsoft.NET.Sdk"" causes part of the issue as I don't think I can have that for a custom corelib
What I'm basing this off of: https://github.com/dotnet/coreclr/blob/master/src/System.Private.CoreLib/System.Private.CoreLib.csproj
Does anyone know what the csproj settings are to get this working? I can't seem to find any good info on this.
Thanks to @PetSerAl: This does just what I needed. .NET Core fails to boot the lib (probably because my primitives, etc aren't implemented fully) but compiles all the IL I need for my project without errors.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<LangVersion>latest</LangVersion>
<!-- Prevent .NET Core 3+ from generating exe -->
<UseAppHost>false</UseAppHost>
<!--Disable .NET Core SDK libs-->
<NoStdLib>true</NoStdLib>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>
</Project>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With