Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assembly "foo.dll" does not contain an entrypoint #14370

Closed
jocco opened this issue Sep 24, 2019 · 8 comments
Closed

Assembly "foo.dll" does not contain an entrypoint #14370

jocco opened this issue Sep 24, 2019 · 8 comments
Labels
affected-medium This issue impacts approximately half of our customers area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI bug This issue describes a behavior which is not expected - a bug. severity-minor This label is used by an internal tool
Milestone

Comments

@jocco
Copy link

jocco commented Sep 24, 2019

Describe the bug

After upgrading to dotnet core 3 I get a build error
GenerateOpenApiDocuments: dotnet "C:\Users\joakim.lindqvist\.nuget\packages\microsoft.extensions.apidescription.server\0.3.0-preview7.19365.7\build\/../tools/dotnet-getdocument.dll" --assembly "foo.dll" --file-list "obj\foo.OpenApiFiles.cache" --framework ".NETCoreApp,Version=v3.0" --output "obj" --project "Foo" --assets-file "...\obj\project.assets.json" --platform "AnyCPU" 2>Assembly 'foo.dll' does not contain an entry point.

This assembly is a class library and as such can not define an entrypoint (and a error is produced if I try to ad it), but it contains code shared between multiple aspnet web api projects (all of whom generate swagger documentation).

While this GenerateOpenApiDocuments step fails, my assembly generates just fine so if I do another build the up to date check determine there is no work to do and my build succeeds.

I did not see this issue using dotnet core 3 preview 7.

To Reproduce

Steps to reproduce the behavior:

  1. Using Aspnet Core 3

  2. Add a class library that uses swagger (I use Swashbuckle.AspnetCore and Swashbuckle.Aspnet.Core.ReDoc). This class library should be set to use Web SDK:
    Project Sdk="Microsoft.NET.Sdk.Web">

  3. Build this class library

Expected behavior

No build errors.

@israellot
Copy link

I confirm this error occurs whenever you add Swashbuckle.AspnetCore to a class project.

@javiercn javiercn added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI and removed area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels Sep 24, 2019
@Dontrym3
Copy link

I had the same problem also. A quick fix for the build is to not generate the openApi documents. Add this to your project's propertyGroup (in the .csproj):

<OpenApiGenerateDocuments>false</OpenApiGenerateDocuments>

@mkArtakMSFT mkArtakMSFT added this to the Next sprint planning milestone Jul 15, 2020
@jkotalik jkotalik added affected-medium This issue impacts approximately half of our customers severity-minor This label is used by an internal tool bug This issue describes a behavior which is not expected - a bug. labels Nov 9, 2020 — with ASP.NET Core Issue Ranking
@mkArtakMSFT
Copy link
Member

@rafikiassumanimsft FYI

@adityamandaleeka
Copy link
Member

cc: @bradygaster

@bradygaster
Copy link
Member

what @Dontrym3 said - Swashbuckle in Class Library projects isn't a scenario with which we're quite familiar or that we support. The only scenario with which we have elaborate expertise is using Swashbuckle in a Web or Minimal API project. The package does offer quite a bit of customization, and has some good docs, so I'd encourage folks look there.

@adityamandaleeka
Copy link
Member

Sounds like this should be closed then?

@bormm
Copy link

bormm commented Sep 29, 2021

Had the same issue:

  • It works before with "<TargetFramework>net472</TargetFramework>"
  • but not with "<TargetFrameworks>net472</TargetFrameworks>"
  • and not with "<TargetFramework>net5.0</TargetFramework>"
  • and not with "<TargetFrameworks>net5.0</TargetFrameworks>"

And failed in "...\packages\microsoft.extensions.apidescription.server\3.0.0\build\Microsoft.Extensions.ApiDescription.Server.targets"

Having a class library seems a common use-case in a modular application. Did you expect all related stuff is just put in a single project?

I disabled build time generation by "OpenApiGenerateDocumentsOnBuild=false" I've found in the targets, but have not found any documentation about this parameter and what it exactly does. Also comparing to OpenApiGenerateDocuments=false.

Can someone give a link?

@adityamandaleeka
Copy link
Member

Closing this issue since as @bradygaster said this isn't a scenario we support.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affected-medium This issue impacts approximately half of our customers area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI bug This issue describes a behavior which is not expected - a bug. severity-minor This label is used by an internal tool
Projects
None yet
Development

No branches or pull requests

9 participants