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

I tried Entity Framework Core 3 (netstandard2.1) with Azure Functions v3 (netcoreapp3.0), an error occurred in Metadata Generator. #351

Closed
elksson opened this issue Nov 16, 2019 · 6 comments

Comments

@elksson
Copy link

elksson commented Nov 16, 2019

It appears that issues #349 is also affecting publishing using visual studio 2019 16.4.0 Preview 5.0

1>------ Build started: Project: PCFL.NiceInContact.WebHooks, Configuration: Release Any CPU ------
1>You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
1>PCFL.NiceInContact.WebHooks -> C:\Users\ialastairhunter\source\repos\PCFL.NiceInContact.WebHooks\PCFL.NiceInContact.WebHooks\bin\Release\netcoreapp3.0\bin\PCFL.NiceInContact.WebHooks.dll
2>------ Publish started: Project: PCFL.NiceInContact.WebHooks, Configuration: Release Any CPU ------
2>You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
2>PCFL.NiceInContact.WebHooks -> C:\Users\ialastairhunter\source\repos\PCFL.NiceInContact.WebHooks\PCFL.NiceInContact.WebHooks\bin\Release\netcoreapp3.0\bin\PCFL.NiceInContact.WebHooks.dll
2>System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
2>File name: 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
2> at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
2> at System.Reflection.RuntimeAssembly.GetExportedTypes()
2> at MakeFunctionJson.FunctionJsonConverter.TryGenerateFunctionJsons()
2> at MakeFunctionJson.FunctionJsonConverter.TryRun()
2>
2>
2>Error generating functions metadata
2>
2>Metadata generation failed.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

@elksson
Copy link
Author

elksson commented Nov 16, 2019

Updating to 3.0.0-preview1 fixed compilation when trying to debug or run the application from visual studio but when trying to publish to azure the metadata fails to generate.

@brettsam
Copy link
Member

Can you share what your project file looks like? We shouldn't be calling GetExportedTypes() anymore, so it's curious that I see it in that stack. It seems like this is somehow using the old version of the Sdk.

@elksson
Copy link
Author

elksson commented Nov 16, 2019

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <AzureFunctionsVersion>v3-preview</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.10" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="3.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.0-preview1" />
    <PackageReference Include="PCFL.EntityFramework.DataContext" Version="1.0.0.135" />
    <PackageReference Include="PCFL.PestRoutes.Client" Version="1.0.0.129" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

@elksson
Copy link
Author

elksson commented Nov 16, 2019

Here is my pubxml as well

<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <UserName>.....</UserName>
    <WebPublishMethod>ZipDeploy</WebPublishMethod>
    <PublishProvider>AzureWebSite</PublishProvider>
    <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish>.....</SiteUrlToLaunchAfterPublish>
    <LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
    <ResourceId>.......</ResourceId>
    <_SavePWD>True</_SavePWD>
    <PublishUrl>.....</PublishUrl>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
    <SelfContained>false</SelfContained>
    <_IsPortable>true</_IsPortable>
  </PropertyGroup>
</Project>

@elksson
Copy link
Author

elksson commented Nov 16, 2019

I believe that I found the issue I removed an unused package from the PCFL.PestRotues.Client.

This package dependency seams to have caused the issue. Now I am able to publish but I get a SqlClient Not supported Exception when I try to use Entity Framework.

I have tried with both EF Core 2.2.6 and EF Core 3.0.0 and EF Core 3.1 Preview.

Azure/azure-functions-host#5257

@brettsam
Copy link
Member

If you're able to reproduce the error above, please let me know. It certainly looks like the build is using the old version of the FunctionGenerator as we no longer make those API calls in 3.0.0-preview1. If we can figure out how that happened, it'd be very helpful.

I'm going to close this for now (please re-open if you see it again with more details) -- I'm going to look at the SqlClient issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants