asp.net core 2.0 publish generating lots of DLL's
Asked Answered
M

3

10

A programming one application few months and everytime when i published my project, tis generated 19 items (without wwwroot files). And from today, its generating 202 files with lots of .dll (without wwwroot files). I have no idea what happend or what i did. My application using .NET Core 2.0. I dont know what information about my project is relevant. Aproximately 81/202 files are only Microsoft.AspNetCore libraries and 43/202 are only Microsoft.Extensions libraries. I tried deleted obj, bin, properties and node_modules and still same problem. After upload only files what its generated before from lots of files, everything worked. I think its not necessary .dll but i have no idea why asp.net still generating them. Thank you for any advice.

EDIT:

Here is one big screenshot of publish output, dependencies and output of publish added by request from one of users who commented this question: enter image description here

EDIT:

I got new error after change publish properties from Self-contained deployments to Framework-dependent deployments and i get new error from output:

C:\Program Files\dotnet\sdk\2.1.400-preview-009063\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(125,5): Error NETSDK1068: The framework-dependent application host requires a target framework of at least 'netcoreapp2.1'.

EDIT:

Now i tried create new project asp.net core 2.0 and tried published. Same problem. Something is wrong with my sdk or i dont know.

SOLUTION:

I created new project with target 2.1 and move all source files. After resolve few error everything working fine.

Mcmaster answered 24/7, 2018 at 15:20 Comment(8)
Can you show your references and possibly a screenshot of the output ?Maddeu
I added it in the original post. Thank you for request.Mcmaster
does @ph0en1x 's answer not help you with the issue?Maddeu
Doesnt help but i get new error.Mcmaster
your last error caused by incompatible project type. You install latest Microsoft sdk and runtime which expect you to have at least netcoreapp2.1, and in your case your initial project is on 2.0Bracy
Yeah i find it but i dont know how to resolve that problem. My csproj have 2.0 and in packages alsto but still nothing.Mcmaster
install 2.0 dotnet core sdk and cli, not latestBracy
I made it but still same problem. Since install sdk 2.1 every application still expecting netcoreapp2.1 with core, app with 2.1 version. I created new project with target 2.1 and move all source files. After resolve few error everything working fine. But thank you so much i know about new problem and solution. Thank you very much.Mcmaster
B
5

On Visual Studio 15.8.2 I too had this problem. Unfortunately I could not simply upgrade the application because we have runtime version restrictions on the internally managed deployed servers. So even though I can build on the latest SDK version (2.1.401), where the application is deployed has an older SDK version (2.1.100).

The SDK and Runtime version correlations for .NET Core 2.0 can be found here.

My problem manifested thusly: The Build and Rebuild succeeded, but the Publish failed with the error message Error NETSDK1068: The framework-dependent application host requires a target framework of at least 'netcoreapp2.1'. I learned from here that the default is to use the latest installed version.

Starting with .NET Core 2.0, the following rules apply when determining which version of the SDK to use:

  • If no global.json file is found or global.json doesn't specify an SDK version, the latest installed SDK version is used. Latest SDK version can be either release or pre-release - the highest version number wins. (emphasis added)

In this same article, I learned to make use of the global.json file to address this error. I used git-bash and cd'd to the local working directory for the web application I was trying to publish. The corresponding csproj file should be in this directory. From here I ran the following:

dotnet new globaljson --sdk-version 2.1.100

Now I can use the following publish configure settings: - Configuration: Release - Target Framework: netcoreapp2.0 - Deployment Mode: Framework-Dependent - Target Runtime: Portable

Balneology answered 30/8, 2018 at 16:10 Comment(0)
N
9

This is caused by a bug introduced in .NET Core SDK version 2.1.400. See Framework Dependent Publish doesn't work on 2.1.400 #9852

There is a workaround - publish via the command line and pass the arg --self-contained false.

Example:

dotnet publish -f netcoreapp2.0 -c Release --self-contained false

Nerta answered 10/1, 2019 at 15:36 Comment(0)
B
5

On Visual Studio 15.8.2 I too had this problem. Unfortunately I could not simply upgrade the application because we have runtime version restrictions on the internally managed deployed servers. So even though I can build on the latest SDK version (2.1.401), where the application is deployed has an older SDK version (2.1.100).

The SDK and Runtime version correlations for .NET Core 2.0 can be found here.

My problem manifested thusly: The Build and Rebuild succeeded, but the Publish failed with the error message Error NETSDK1068: The framework-dependent application host requires a target framework of at least 'netcoreapp2.1'. I learned from here that the default is to use the latest installed version.

Starting with .NET Core 2.0, the following rules apply when determining which version of the SDK to use:

  • If no global.json file is found or global.json doesn't specify an SDK version, the latest installed SDK version is used. Latest SDK version can be either release or pre-release - the highest version number wins. (emphasis added)

In this same article, I learned to make use of the global.json file to address this error. I used git-bash and cd'd to the local working directory for the web application I was trying to publish. The corresponding csproj file should be in this directory. From here I ran the following:

dotnet new globaljson --sdk-version 2.1.100

Now I can use the following publish configure settings: - Configuration: Release - Target Framework: netcoreapp2.0 - Deployment Mode: Framework-Dependent - Target Runtime: Portable

Balneology answered 30/8, 2018 at 16:10 Comment(0)
B
3

I'm pretty sure that you just select publish mode for a self-contained deployment so the majority of files is just libs required for running isolated runtime. To get back to a few files again just move forward with Framework-dependent deployments (described the same doc)

Bracy answered 24/7, 2018 at 15:33 Comment(1)
I found that doc before and i thought same think but after check of configuration of my publish properties it show that i had Framework-dependent deployments so i ignored that. But now for sure i click save and publish project again and i get this error: C:\Program Files\dotnet\sdk\2.1.400-preview-009063\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(125,5): Error NETSDK1068: The framework-dependent application host requires a target framework of at least 'netcoreapp2.1'.Mcmaster

© 2022 - 2024 — McMap. All rights reserved.