title: Build warnings for Obsolete C# events
body: <p>Does anyone know of a trick or workaround to get the Visual Studio C# compiler to issue build warnings when an Obsolete event is being used?</p>
  
  <p>If I create a simple assembly with a public event and apply the Obsolete attribute to the event, when I reference that assembly and subscribe to the event in another project, the compiler does not issue a warning when I build (even with the highest warning level or warnings set to errors).</p>
  
  <p>Declaration of event in Project 1:</p>
  
  <pre><code>    public class APIClass
      {
          [Obsolete("Obsolete in v2.0")]
          public event EventHandler ObsoleteEvent;
      }
  </code></pre>
  
  <p>Use of Obsolete event in Project 2 does not cause a build warning:</p>
  
  <pre><code>    private void SubscribeToEvent(APIClass apiClass)
      {
          apiClass.ObsoleteEvent += delegate { };
      }
  </code></pre>
  
  <p>When I open the source file, Visual Studio recognizes the event as Obsolete and adds the warning (or error) to the Error List:
  <img src="https://i.stack.imgur.com/X7NBB.jpg" alt="Background source processing recognizes the warning"></p>
  
  <p>However, as soon as I build, the warning disappears and does not appear in the build output:
  <img src="https://i.stack.imgur.com/VPWJe.jpg" alt="The warning is gone after compiling"></p>
  
  <p>The missing compiler warning seems to have been <a href="https://connect.microsoft.com/VisualStudio/feedback/details/750318/obsolete-attribute-ignored-on-events-used-in-another-project" rel="noreferrer">filed as a bug</a>, but until it is fixed, is there any possible way to force a warning when someone uses the event?  Otherwise there is no way to alert external consumers that they need to change their calling code.</p>