title: How to get the application path at design time in winforms, .net?
body: <p>If you use Application.StartupPath in a referenced dll, the path points to the path of the IDE.</p>
  
  <p>Is there anyway to get the path of the actual application?</p>
  
  <p>Just to be clear, this is at design time.</p>
  
  <p>ETA: I've posted the solution below:</p>
  
  <p>ETA2: </p>
  
  <p>Because it's related, I thought i'd post a snippet of another useful design-time service. Like the solution below, this example is for a UITypeEditor:</p>
  
  <pre><code>Public Overrides Function EditValue(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal provider As System.IServiceProvider, ByVal value As Object) As Object
  
      Dim typeDiscovery As ITypeDiscoveryService = TryCast(provider.GetService(GetType(ITypeDiscoveryService)), ITypeDiscoveryService)
      Dim types As ICollection = typeDiscovery.GetTypes(GetType(MyType), False)
  
  End Function
  </code></pre>
  
  <p>types will contain all types derived from MyType. Change the second parameter to True to exclude searching the GAC.
  Pass Nothing as the first parameter to get a list of all types.</p>