Azure / azure-functions-vs-build-sdk

MSBuild task for Azure Functions
MIT License
96 stars 65 forks source link

Could not load file or assembly 'System.Text.Encoding.CodePages, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. #500

Open shibayan opened 3 years ago

shibayan commented 3 years ago

Repro steps

Provide the steps required to reproduce the problem:

  1. Create function app project
  2. Install System.Text.Encoding.CodePages nuget package
  3. Adding Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); to function
  4. Run function app

Expected behavior

Function app is executed without error

Actual behavior

The following error occurs and the function cannot be executed.

[2021-01-15T07:00:17.378Z] A host error has occurred during startup operation 'e356b46a-f0fb-44a1-8494-df0ad91f3d36'.
[2021-01-15T07:00:17.380Z] FunctionApp34: Could not load file or assembly 'System.Text.Encoding.CodePages, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. 指定されたファイルが見つかりません。.
Value cannot be null. (Parameter 'provider')

Known workarounds

milkyjoe90 commented 3 years ago

I have ta similar issue with System.Runtime.Caching, v5.0.0 works with Microsoft.NET.Sdk.Functions up to v3.0.2, anything higher breaks. Microsoft.NET.Sdk.Functions v3.0.11 work perfectly with System.Runtime.Caching v4.7.0

morrisonbrett commented 2 years ago

Similar issue with System.IO.Abstractions. The only version of MIcrosoft.NET.Sdk.Functions that works is v3.0.3. After that, it will not load `System.IO.Abstractions'.

morrisonbrett commented 2 years ago

I got past it! THIS fixed it for me. Add this to a <PropertyGroup> in your .csproj.

<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>

morrisonbrett commented 2 years ago

Cross-reference: https://github.com/TestableIO/System.IO.Abstractions/issues/761