Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | jahu00 |
I had this brilliant idea to use SignalR in my multiplayer co-op game. I had a prototype with no networking where a dummy client would return data without sending any requests to a server and I figured, my next step would be to try implementing the server (as it would help me figure out how the client should actually look like, because of server imposed constraints).
After partially implementing my server as a WebApplication
and successfully testing it in a console app, I moved everything back to the godot project and that’s when thing fell apart.
I can make an instance of my SignalR client in the game (it comes from a nuget package), but I cannot make an instance of my SignalR server (it’s part of .NET Core).
Initially there was no error, _Ready
, would simply not run in my main node (like at all, but _Process
would run fine). After a little tinkering, I did manage to get a more concrete error, by calling the offending code from “Immediate Window” while debugging. I’ve got this error:
error CS0012: The type ‘WebApplication’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘Microsoft.AspNetCore, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’.
There is no obvious way to add a reference to Microsoft.AspNetCore
assembly in my Godot project. It’s one of the framework references in a project and is dictated by the sdk attribute in the csproj file. I did try adding it by adding another section inside the csproj file:
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>```
But I only managed to deceive Visual Studio into believing that the assembly is referenced and I still get the same error.
**Is there is some way to start my WebApplication SignalR server from my Godot game or did I just lose a lot of time?**
---
For WPF and WinFroms there are special XML elements that can be added to the csproj file that make it possible to use them in a class library or ASP app, but I don't see anything like that for AspNetCore.
---
I might still be able to make this work somehow, by using an ancient version of AspNetCore that is still available on nuget, but that will probably introduce tons of extra references (MS moved everything into .NET in the newer versions)