Search code examples
c#.netazuresignalr

SignalR.Core Reference inside csproj fails in Azure Pipline


I am probably being a bit stupid ;) but I have a Problem in my Azure Pipline. I used the the SignalR Library from AspNetCore to build a Hub. Since .NetCore3.0, the SignalR is automatically devliverd with AspNetCore.

That my Hub Class public class UrgentAcknowledgedHub : Hub {} did know where the Library (dll) is, i had to add following code to my .csproj File.

<ItemGroup>
        <Reference Include="Microsoft.AspNetCore.SignalR.Core">
            <HintPath>..\..\..\..\..\Program Files\dotnet\shared\Microsoft.AspNetCore.App\6.0.8\Microsoft.AspNetCore.SignalR.Core.dll</HintPath>
        </Reference>
</ItemGroup>

I can run this code local without any problem, but when the Azure pipline run this code, I got following Error and it crashes:

Warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNetCore.SignalR.Core". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

I totally understanding that it can't find the SignalR Referenc anymore because it is hardcoded. Is there any way to not hardcode it?


Solution

  • I think i got the Answer. To use the SignalR from the .Net6 Framework, I have to add the following FrameworkReference in my .csproj File.

    <ItemGroup>
        <FrameworkReference Include="Microsoft.AspNetCore.App"/>
    </ItemGroup>