philippgille / hello-netcoreapp

Basic .NET Core console application with additional scripts and files for building the app and creating release artifacts for a framework-dependent deployment, self-contained deployment, Docker image, Chocolatey package and AppImage
GNU General Public License v3.0
6 stars 5 forks source link

Make compiled DLL compatible with full .NET framework #32

Closed philippgille closed 6 years ago

philippgille commented 7 years ago

Currently the target framework is netcoreapp1.1. The compiled DLL probably doesn't run on the full .NET framework where .NET Core isn't installed.

That might be enabled by multi-targeting with: <TargetFrameworks>netcoreapp1.1;net462</TargetFrameworks>

When adding a target framework, one of the frameworks needs to be specified when building a SCD, otherwise errors occur when compiling:

C:\Program Files\dotnet\sdk\2.0.0\Sdks\Microsoft.NET.Sdk\buildCrossTargeting\Microsoft.NET.Sdk.targets(31,5): error :
The 'Publish' target is not supported without specifying a target framework.
The current project targets multiple frameworks, please specify the framework for the published application. [X:\path\to\hello-netcoreapp\src\hello-netcoreapp.csproj]

Just adding the target framework isn't enough - we also need to add this in our build scripts, to add another dotnet publish call.

So the tasks for this issue are:

  1. Add target framework
  2. Adapt build scripts:
    • Specify framework when building SCD
    • Add function call for building FDD for full .NET Framework
philippgille commented 7 years ago

P.S.: Probably won't compile on Linux, so make sure adding the framework in the *.csproj doesn't hurt when compiling for netcoreapp1.1 on Linux and only add compiling the full .NET framework FDD to the build.ps1 and AppVeyor.

philippgille commented 6 years ago

https://docs.microsoft.com/en-us/nuget/schema/target-frameworks