Git Product home page Git Product logo

Comments (15)

folbrecht avatar folbrecht commented on July 21, 2024 1

from refitter.

manuel-fernandez-rodriguez avatar manuel-fernandez-rodriguez commented on July 21, 2024 1

REFITTER000 System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Systém nemůže nalézt uvedený soubor.

I tried to install package Microsoft.Bcl.AsyncInterfaces, but it did not help. VS 2022, MAUI app project. Thanks for help

I have run into exactly the same problem on compiling, but it seems not be MAUI related (or, at least, not exclusively), because my project was a Web API and the build error occurred when building a class library, which was the project the nuget package was added to.

from refitter.

manuel-fernandez-rodriguez avatar manuel-fernandez-rodriguez commented on July 21, 2024 1

REFITTER000 System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Systém nemůže nalézt uvedený soubor.
I tried to install package Microsoft.Bcl.AsyncInterfaces, but it did not help. VS 2022, MAUI app project. Thanks for help

I have run into exactly the same problem on compiling, but it seems not be MAUI related (or, at least, not exclusively), because my project was a Web API and the build error occurred when building a class library, which was the project the nuget package was added to.

@manuel-fernandez-rodriguez Interesting... I primarily use this myself on Web API (Minimal API) projects. What version of .NET do you target and what version of Refitter do you use?

I just put this little Minimal API project together to test it out: MinimalApi.zip

I could build and run it without any issues

I have downloaded the zip, and the openapi definition for the PetStore was missing, so I downloaded it from https://petstore3.swagger.io/api/v3/openapi.json.

The Refit interface was successfully generated, but I get exactly the same error that we have been mentioning from the start:

Build started at 20:44...
1>------ Build started: Project: MinimalApi, Configuration: Debug Any CPU ------
1>CSC : error REFITTER000: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
1>Done building project "MinimalApi.csproj" -- FAILED.

Surprisingly, if I build it from the command line:

> dotnet build
MSBuild version 17.8.3+195e7f5a3 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
  MinimalApi -> C:\Users\mfernandezr\Downloads\MinimalApi\bin\Debug\net8.0\MinimalApi.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:08.75

So I have to presume the problem is not the code itself, but something related to Visual Studio or its interaction with the code generation.

My Visual Studio version is:

Microsoft Visual Studio Enterprise 2022 (64-bit) - Current
Version 17.8.3

And I have the following SDK and runtimes installed:

> dotnet --list-sdks && dotnet --list-runtimes

8.0.100 [C:\Program Files\dotnet\sdk]
Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]```

from refitter.

christianhelle avatar christianhelle commented on July 21, 2024 1

I released a preview version to NuGet

<PackageReference Include="Refitter.SourceGenerator" Version="0.8.6.38-preview" />

It works for me in my Visual Studio setup. Can you also try it on your machines @manuel-fernandez-rodriguez @folbrecht ?

from refitter.

manuel-fernandez-rodriguez avatar manuel-fernandez-rodriguez commented on July 21, 2024 1

@christianhelle
Checked and, apparently it works flawlessly when building :)

Thank you SO much for the quick workaround.

from refitter.

christianhelle avatar christianhelle commented on July 21, 2024

@folbrecht thanks for taking the time to report this.

I haven't tried using Refitter with a MAUI project, but I'll try that myself over the weekend and see if I can reproduce it, and even better, see what could be wrong...

As a workaround, have you tried using the Refitter CLI tool?

from refitter.

christianhelle avatar christianhelle commented on July 21, 2024

@all-contributors please add @folbrecht for bugs

from refitter.

allcontributors avatar allcontributors commented on July 21, 2024

@christianhelle

I've put up a pull request to add @folbrecht! 🎉

from refitter.

christianhelle avatar christianhelle commented on July 21, 2024

@folbrecht I could easily reproduce your problem, but I haven't figured out why this happens with MAUI projects.

One good thing is that Refit itself works fine with MAUI but the Refitter.SourceGenerator package reference is causing the problems.

As a workaround, you can remove the Refitter.SourceGenerator package reference and add the Refit package reference. Then you can keep the generated file as it is or re-generate it using the Refitter CLI tool

My schedule is a bit packed these days leading up to the holidays. I'll eventually, and hopefully, figure out what's wrong when working with MAUI, and work on a fix for the problem. Until then, I apologize for the inconvenience and the delays

from refitter.

christianhelle avatar christianhelle commented on July 21, 2024

REFITTER000 System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Systém nemůže nalézt uvedený soubor.
I tried to install package Microsoft.Bcl.AsyncInterfaces, but it did not help. VS 2022, MAUI app project. Thanks for help

I have run into exactly the same problem on compiling, but it seems not be MAUI related (or, at least, not exclusively), because my project was a Web API and the build error occurred when building a class library, which was the project the nuget package was added to.

@manuel-fernandez-rodriguez Interesting... I primarily use this myself on Web API (Minimal API) projects. What version of .NET do you target and what version of Refitter do you use?

I just put this little Minimal API project together to test it out:
MinimalApi.zip

I could build and run it without any issues

from refitter.

christianhelle avatar christianhelle commented on July 21, 2024

@manuel-fernandez-rodriguez Thanks for all the input! This will be very helpful.

My excuse for not running into this - I spend most of my day in JetBrains Rider and the CLI 😞

I'll see what I can do

from refitter.

christianhelle avatar christianhelle commented on July 21, 2024

@manuel-fernandez-rodriguez Good news is that I found the line of code that throws an exception. The bad news is that I don't understand why it does, and why it doesn't...

For now, I think I'll add a try/catch around the deserialization code in the source generator project and just jump out if anything unexpected happens

from refitter.

christianhelle avatar christianhelle commented on July 21, 2024

@all-contributors please add @manuel-fernandez-rodriguez for bugs

from refitter.

allcontributors avatar allcontributors commented on July 21, 2024

@christianhelle

I've put up a pull request to add @manuel-fernandez-rodriguez! 🎉

from refitter.

christianhelle avatar christianhelle commented on July 21, 2024

@folbrecht I tested the latest release preview on a new MAUI app and it seems to work fine.

I'm closing this

from refitter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.