Sdk: Could not load file or assembly 'System.Runtime, Version=4.2.0.0 on empty project

Created on 16 Feb 2019  路  11Comments  路  Source: dotnet/sdk

Hi,

I read other post about this error but I m not sure that the other have this issue only when the project is deployed to azure.

Here is my cs projet:
<PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp2.2</TargetFramework> <LangVersion>latest</LangVersion> <UseNETCoreGenerator>true</UseNETCoreGenerator> </PropertyGroup> <ItemGroup> <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" /> <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.3" /> <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.3.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.6.1" /> <PackageReference Include="Microsoft.Azure.WebJobs.Logging.ApplicationInsights" Version="3.0.4" /> <PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.4" /> <PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="3.0.1" /> <PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.2.0" /> <PackageReference Include="NetEscapades.Extensions.Logging.RollingFile" Version="1.0.1" /> </ItemGroup>

My thinking is maybe, .net core 2.2.1 is not yet available on Azure. What do you think? How to fix this issue?

Most helpful comment

I finally found the solution, in run.cmd use :

dotnet AzureWebJobPOC.dll

instead of

AzureWebJobPOC.dll

All 11 comments

Can you share the rest of your project? Can you also share the full stack trace for the error?

Hi,

I extracted the project from the solution to commit a code sample.
https://github.com/ranouf/issue10813

The project is not compilable.

Here is the log from Azure Portal for my webjob:

[02/18/2019 17:24:00 > 541f8f: SYS INFO] Run script 'run.cmd' with script host - 'WindowsScriptHost'
[02/18/2019 17:24:00 > 541f8f: SYS INFO] Status changed to Running
[02/18/2019 17:24:01 > 541f8f: ERR ]
[02/18/2019 17:24:01 > 541f8f: ERR ] Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
[02/18/2019 17:24:01 > 541f8f: SYS ERR ] Job failed due to exit code -532462766
[02/18/2019 17:24:01 > 541f8f: SYS INFO] Process went down, waiting for 60 seconds
[02/18/2019 17:24:01 > 541f8f: SYS INFO] Status changed to PendingRestart

Let me know if it s ok for you?

You need to target Microsoft.NET.Sdk.Web as your SDK on the SDK attribute on the Project element. That's required if you are a web app.

Hi,

Thanks for helping me :)
It s not a webapp, it s a webjob. In all Webjobs I used in the past, I used Microsoft.NET.Sdk. It seems to be the things to do as you can see in the sample proposed by Azure team:
https://github.com/Azure/azure-webjobs-sdk/blob/dev/sample/SampleHost/SampleHost.csproj

I don't know how azure webjobs work, so I don't know if there has been any changes there that might be causing this. I don't know if they publish the app and if they do that as a framework dependent app, that would require the framework in the box or a self-contained app, that would ship with the framework.

Also, if the framework is missing, it should fail with a different error message.

Does your app work locally? Are you doing dotnet run or doing dotnet publish and dotnet app.dll afterwards to try it out?

@natemcmaster @muratg any idea who could help out with this issue?

Yes every things works perfectly on local, no problem to publish on local or with devops

I'm not very familiar with webjobs either. @shirhatti @bradygaster, do you know how this is supposed to work?

Hi,

I still have the problem and no solution. Do you have an idea?

I am going to move this issue to aspnet so see if we can get an answer faster over there. If this turns out to be an issue on the sdk then we can move it back or re-activate.

This issue was moved to aspnet/AspNetCore#8078

I finally found the solution, in run.cmd use :

dotnet AzureWebJobPOC.dll

instead of

AzureWebJobPOC.dll

Was this page helpful?
0 / 5 - 0 ratings