Search code examples
c#.netresharpernservicebus

ReSharper not linked in EndpointConfig.cs for NServiceBus host


Apparently

Alt+Enter does not work when viewing the EndpointConfig.cs file, generated by NServiceBus host.

Neither does Ctrl+;, by the way ...

What I'm trying to do

I need a reference to a class and interface that exist in different namespaces, not yet referenced previously. I would like to be able to use ReSharper.

Symptoms

Both the class and interface names are underlined with the red wavey line, but are not written in red:

enter image description here

That should be:

enter image description here

In any other file, that's not EndpointConfig.cs, ReSharper works as normal, just not in this particular file.

If I rename EndpointConfig.cs to something else, everything works as expected.

It's like ReSharper is hardwired to not touch EndpointConfig.cs.

What's going on?

PS: EndpointConfig.cs is auto-generated when adding NServiceBus host.


Solution

  • ReSharper does not scan files that are shipped as part of a nuget. When you rename the file ReSharper no longer detects that it was shipped from the nuget hence it starts properly scanning that file. I do not know if it possible to change this behavior.

    The best alternative I can suggest is self hosting NServiceBus in a windows service. Here is a runnable sample.