question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compile error when using MQTTnet.AspNetCore v3.0.3 (and 3.0.7).

See original GitHub issue

I get the following compile error when trying to build a sample project with MQTTnet.AspNetCore v3.0.3 from NuGet. I have tried adding MQTTnet v3.0.3 to the project, but with no effect.

The code compile and executes when v3.0.2 is used, but v3.0.3 does not.

1>------ Build started: Project: MqttServerApp, Configuration: Debug Any CPU ------
1>Program.cs(22,13,22,38): error CS0012: The type 'IMqttServer' is defined in an assembly that is not referenced. You must add a reference to assembly 'MQTTnet, Version=3.0.3.0, Culture=neutral, PublicKeyToken=b69712f52770c0a7'.
1>Program.cs(27,13,27,41): error CS0012: The type 'IMqttServerOptions' is defined in an assembly that is not referenced. You must add a reference to assembly 'MQTTnet, Version=3.0.3.0, Culture=neutral, PublicKeyToken=b69712f52770c0a7'.
1>Program.cs(27,13,27,41): error CS0012: The type 'MqttServerOptionsBuilder' is defined in an assembly that is not referenced. You must add a reference to assembly 'MQTTnet, Version=3.0.3.0, Culture=neutral, PublicKeyToken=b69712f52770c0a7'.
1>Done building project "MqttServerApp.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

MqttServerApp.csproj

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.2</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="MqttNet.AspNetCore" Version="3.0.3" />
  </ItemGroup>

</Project>

Program.cs

using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using MQTTnet.AspNetCore;

namespace MqttServerApp
{
    class Program
    {
        static void Main(string[] args)
        {
            WebHost.CreateDefaultBuilder(args).UseStartup<Startup>().Build().Run();
        }
    }

    public class Startup
    {
        public void Configure(IApplicationBuilder application)
        {
            application.UseStaticFiles();
            application.UseMqttServer(c => { });
        }

        public void ConfigureServices(IServiceCollection services)
        {
            services.AddHostedMqttServer(c => { });
        }
    }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
chkr1011commented, Jun 27, 2019

I released 3.0.4 which works again.

0reactions
SeppPennercommented, Aug 20, 2019

3.0.8 fixes this for me 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compile error when using MQTTnet.AspNetCore v3.0.3 ...
I get the following compile error when trying to build a sample project with MQTTnet.AspNetCore v3.0.3 from NuGet.
Read more >
MQTTnet.AspNetCore.AttributeRouting 0.3.16
Your primary use case is validating/processing the MQTT messages on your server; Your server is not primarily sending data to clients via MQTT ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found