supabase-community / supabase-csharp

A C# Client library for Supabase
https://github.com/supabase-community/supabase-csharp/wiki
MIT License
499 stars 50 forks source link

Error thrown when running project on .Net 8 webapi project #133

Closed wgrs closed 10 months ago

wgrs commented 10 months ago

I am testing supabase but the project wont run in a .net 8 webapi project.

ERROR: Could not load type 'Supabase.Client' from assembly 'Supabase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

  <Project Sdk="Microsoft.NET.Sdk.Web">

     <PropertyGroup>
      <TargetFramework>net8.0</TargetFramework>
      <Nullable>enable</Nullable>
      <ImplicitUsings>enable</ImplicitUsings>
      <InvariantGlobalization>true</InvariantGlobalization>
 </PropertyGroup>

  <ItemGroup>
     <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0" />
     <PackageReference Include="supabase-csharp" Version="0.14.0" />
     <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
 </ItemGroup>

program.cs

var url = builder.Configuration["SupabaseUrl"]; var key = builder.Configuration["SupabaseKey"]; var options = new SupabaseOptions { AutoRefreshToken = true, AutoConnectRealtime = true, // SessionHandler = new SupabaseSessionHandler() <-- This must be implemented by the developer };

// Note the creation as a singleton. builder.Services.AddSingleton(provider => new Supabase.Client(url, key, options));

wgrs commented 10 months ago

Recreated the project and it works now.