Refit: Could not load file or assembly when using refit

Created on 27 Apr 2020  路  4Comments  路  Source: reactiveui/refit

<##[error].nuget\packages\refit\5.1.67\build\netstandard2.0\refit.targets(33,5): Error : Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified>>

Working properly in local machine, the error comes when building the app in azure devops.
Tried adding nuget package for System.Runtime.CompilerServices.Unsafe expilicitly but not working.

bug

Most helpful comment

@cotyhamilton @jdevincework @AnjaliSahu51 ran into this on a project where it would build locally fine, but not on devops. Tried all sorts of binding redirect variations to no avail. Finally, thought to check the task group on DevOps and noticed the build task was still using VS2017. Locally, we're working with VS2019. Updated the task in DevOps to use VS2019 and problem solved!

image

Hope that helps someone!

All 4 comments

@AnjaliSahu51 any resolution details? we're having the same issue, both in azure devops and building locally

@cotyhamilton My team just ran into this same issue when using Refit. Not a definitive fix, but here's what worked for us: Delete entire .nuget folder to clear package cache, commented out code from refit.target file, re-downloaded packages and run it... it gave me a different error, then I un-comment same code from refit.target file and it worked.

@jdevincework when I was working with this I discovered some ways to get it to build, similar to yours, but it would never build from a clean state so our cicd efforts were blown. I think we ended up downgrading the version of this one

@cotyhamilton @jdevincework @AnjaliSahu51 ran into this on a project where it would build locally fine, but not on devops. Tried all sorts of binding redirect variations to no avail. Finally, thought to check the task group on DevOps and noticed the build task was still using VS2017. Locally, we're working with VS2019. Updated the task in DevOps to use VS2019 and problem solved!

image

Hope that helps someone!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ColKrumpler picture ColKrumpler  路  3Comments

martincostello picture martincostello  路  4Comments

fonix232 picture fonix232  路  4Comments

Mike-E-angelo picture Mike-E-angelo  路  6Comments

tstivers1990 picture tstivers1990  路  5Comments