How to compile VB 2005 code containing "default instances" using nant

Posted in dotnet, vb, vb.net | No Comments »

I’ve got some VB code that’s using a default instance of a Form. It compiles fine within VS but when I try compiling using the nant vbc task it throws this error,

error BC30469: Reference to a
non-shared member requires an object
reference.

Here’s the relevant section of my nant script,

<vbc target="exe" output="${basename}.exe" rootnamespace="${basename}">
  <imports>
    <import namespace="Microsoft.VisualBasic"/>
     ....
  </imports>
  <sources>
    <include name="**/*.vb" />
  </sources>
  <references>
    .....
 </vbc>

The VB code looks like this,

m_PlanID = MDIParent.PlanDetails.PlanID

Any idea what I’m doing wrong?

Ideally I’d prefer not to be using default instances at all but that’s a job for another day.

Similar:

  1. Default properties in VB.Net? In the early days of .Net, I believe there was an attribute you could decorate a class with to specify a default property. According to...
  2. Using ELMAH with ASP.NET MVC in VB: Compiling: Elmah does not have a strong name I’ve read through the posts and code for passing ASP.NET MVC HandleError errors to ELMAH and converted the code to VB: Imports System Imports System.Web...
  3. aspx.vb – How to dynamically create and access RadioButtonLists from code-behind The answer I’m looking for could be simple, I’m pretty much a beginner in this. Problem is, I barely know the methods and parameters of...
  4. Problems adding a COM component reference to a VB.NET project I have a third party COM dll that I’m trying to add to a vb.net (2008 express) project. I put the dll in C:WINDOWSsystem32 and...
  5. How to Loop through LINQ results (VB.NET) I’ve got some code to try and loop through LINQ results, but it doesn’t seem to be working. HERE’S THE CODE Public Sub ProcessRequest(ByVal context...

Leave a Reply