0

Publishing a .Net Core Web Api project ,( Framework Depended Deployment)

  1. If I target Full Framework ie net456, this will publish all framework DLLs in net462 folder under bin\Release

    WebApp.csproj

      <PropertyGroup>
        <TargetFramework>net462</TargetFramework>
      </PropertyGroup>
    

enter image description here

2.If I target Core 1.1 ie netcoreapp1.1, this will publish only application DLLs in netcoreapp1.1 folder under bin\Release

WebApp.csproj
  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
  </PropertyGroup>

enter image description here

What is the reason for this behavior ?

1 Answer 1

1

You are probably looking into the wrong folder, the published output should be in bin\Release\netcoreapp1.1\publish.

The normal build output doesn't contain the dlls because .NET Core can look up referenced DLLs from the global NuGet packages cache. The .runtimeconfig.json will specify the location of this cache on your machine so the DLLs don't need to be copied for every build.

.NET Framework however does not have this logic so the DLLs need to be copied to the build output.

Additionally in .NET Core 2.0, most of the NuGet packages you'll use for ASP.NET Core application are part of the runtime package store included in .NET Core 2.0, so you'll only publish assemblies that are not part of this store. Since this store isn't available to .NET Framework, this mechanism can't be used for .NET Framework applications and all assemblies are part of the published output.

Sign up to request clarification or add additional context in comments.

2 Comments

Do you know any reason why it was designed like that, because in FDD I expected to have only project DLLs in the publish folder. BTW VS2017 does not generate a publish folder under Release\[framework]
yes vs 2017 uses some other PublishOutput folder or similar under Release . The publish result includes the full dependency closure of a project to be able to run. This means everything is included that is not part of the runtime and the runtime store.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.