Aspnetcore: Assembly "foo.dll" does not contain an entrypoint

Created on 24 Sep 2019  路  2Comments  路  Source: dotnet/aspnetcore

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">
  1. Build this class library

Expected behavior

No build errors.

affected-medium area-commandlinetools bug feature-code-generation investigate severity-minor

Most helpful comment

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>

All 2 comments

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

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>
Was this page helpful?
0 / 5 - 0 ratings