title: Cannot debug a unit testing project in Visual Studio 2012
body: <p>I couldn't find a post similar to this, so I hope this isn't a duplicate.</p>
  <p>I have a c# class library that I'm trying to run unit tests on in Visual Studio 2012. I've added a new Unit Test Project to my solution, and added my main project as a reference there. I've set my unit test project as the Startup Project. When I try to debug, I get an error message</p>
  <blockquote>
  <p>A project with an Output Type of Class Library cannot be started directly.</p>
  <p>In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project.</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/BiiLZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BiiLZ.png" alt="enter image description here" /></a></p>
  <p>According to the walkthrough at <a href="http://msdn.microsoft.com/en-us/library/ms182532.aspx" rel="noreferrer">msdn</a>, it should be running the tests when I hit debug. Any thoughts? Here is my unit test code:</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  using Microsoft.VisualStudio.TestTools.UnitTesting;
  using Common;
  using Messages;
  
  namespace MessageUnitTests
  {
      [TestClass]
      class RegistrationTester
      {
          [TestMethod]
          public void RegistrationRequest_TestConstructorsAndFactories()
          {
              RegistrationRequest rr1 = new RegistrationRequest(&quot;myhandle&quot;);
              Assert.AreEqual(&quot;myhandle&quot;, rr1.Handle);
  
              rr1 = new RegistrationRequest(&quot;longHandle-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789'|;:',.=-_+!@#$%^&amp;*()&quot;);
              Assert.AreEqual(&quot;longHandle-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789'|;:',.=-_+!@#$%^&amp;*()&quot;, rr1.Handle);
  
              rr1 = new RegistrationRequest(&quot;&quot;);
              Assert.AreEqual(&quot;&quot;, rr1.Handle);
  
              rr1 = new RegistrationRequest(null);
              Assert.AreEqual(null, rr1.Handle);
  
              rr1 = new RegistrationRequest(&quot;myhandle&quot;);
              ByteList bytes = new ByteList();
              rr1.Encode(bytes);
  
              RegistrationRequest rr2 = RegistrationRequest.Create(bytes);
              Assert.IsNotNull(rr2);
              Assert.AreEqual(rr1.IsARequest, rr2.IsARequest);
              Assert.AreEqual(rr1.MessageNr.ProcessId, rr2.MessageNr.ProcessId);
              Assert.AreEqual(rr1.MessageNr.SeqNumber, rr2.MessageNr.SeqNumber);
              Assert.AreEqual(rr1.ConversationId.ProcessId, rr2.ConversationId.ProcessId);
              Assert.AreEqual(rr1.ConversationId.SeqNumber, rr2.ConversationId.SeqNumber);
              Assert.AreEqual(rr1.RequestType, rr2.RequestType);
              Assert.AreEqual(rr1.SessionId, rr1.SessionId);
              Assert.AreEqual(rr1.Handle, rr2.Handle);
          }
  
          //[TestMethod]
          //public void RegistrationRequest_EncodingDecoding()
          //{
          //    Message m1 = new RegistrationRequest(&quot;myhandle&quot;);
          //    m1.MessageNr = MessageNumber.Create(10, 14);
          //    m1.ConversationId = MessageNumber.Create(10, 12);
          //    ByteList bytes = new ByteList
          //}
      }
  }
  </code></pre>