Jump to content

Visual Basic 2010 Express - Compile Using .NET 3.5?


BlackBox

Recommended Posts

I am a Visual Studio noob, and have just began to dabble with VB.NET development.

 

I am running Visual Basic 2010 Express (sans VBCAD Template), AutoCAD Civil 3D 2011, Windows XP 32-Bit.

 

Going through the 'HelloWorld' tutorial, when I NETLOAD my .DLL, I get the following error:

 

Command: netload
Cannot load assembly. Error details: System.BadImageFormatException: Could not 
load file or assembly 'file:///C:\Documents and Settings\%UserName%\My 
Documents\Visual Studio 
2010\Projects\HelloWorld\HelloWorld\bin\Release\HelloWorld.dll' or one of its 
dependencies. This assembly is built by a runtime newer than the currently 
loaded runtime and cannot be loaded.
File name: 'file:///C:\Documents and Settings\\%UserName%\My Documents\Visual 
Studio 2010\Projects\HelloWorld\HelloWorld\bin\Release\HelloWorld.dll'
  at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, 
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, 
Boolean throwOnFileNotFound, Boolean forIntrospection)
  at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, 
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, 
Boolean throwOnFileNotFound, Boolean forIntrospection)
  at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, 
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
  at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence 
securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, 
Boolean forIntrospection, StackCrawlMark& stackMark)
  at System.Reflection.Assembly.LoadFrom(String assemblyFile)
  at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
  at loadmgd()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value 
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure 
logging.
To turn this feature off, remove the registry value 
[HKLM\Software\Microsoft\Fusion!EnableLog].

Command: helloworld
Unknown command "HELLOWORLD".  Press F1 for help.

 

Here is my code:

 

[font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff]Imports[/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2][color=#000000] Autodesk.AutoCAD.Runtime[/color][/size][/font]
[/size][/font][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff]Imports[/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2][color=#000000] Autodesk.AutoCAD.ApplicationServices[/color][/size][/font]
[/size][/font][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff]Imports[/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2][color=#000000] Autodesk.AutoCAD.DatabaseServices[/color][/size][/font]
[/size][/font][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff]Imports[/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2][color=#000000] Autodesk.Civil.Land[/color][/size][/font]
[/size][/font][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff]Imports[/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2][color=#000000] Autodesk.Civil.Land.DatabaseServices[/color][/size][/font][/size][/font]
[color=#000000][/color] 
[font=Consolas][size=2]
[/size][/font][/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff]Public [/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff]Class [/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][color=#2b91af][font=Consolas][size=2][color=#2b91af][font=Consolas][size=2][color=#2b91af]HelloWorld[/color][/size][/font]
[/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2] <[/size][/font][/size][/font][font=Consolas][size=2][color=#2b91af][font=Consolas][size=2][color=#2b91af][font=Consolas][size=2][color=#2b91af]CommandMethod[/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2]([/size][/font][/size][/font][font=Consolas][size=2][color=#a31515][font=Consolas][size=2][color=#a31515][font=Consolas][size=2][color=#a31515]"HelloWorld"[/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2])> _[/size][/font]
[/size][/font][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff] Public [/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff]Sub[/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2] HellowWorld()[/size][/font]
[/size][/font][font=Consolas][size=2][color=#008000][font=Consolas][size=2][color=#008000][font=Consolas][size=2][color=#008000]   'Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("Hello World!")[/color][/size][/font]
[/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2]   MsgBox([/size][/font][/size][/font][font=Consolas][size=2][color=#a31515][font=Consolas][size=2][color=#a31515][font=Consolas][size=2][color=#a31515]"Hello World!"[/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][font=Consolas][size=2])[/size][/font]
[/size][/font][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff] End [/color][/size][/font][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff]Sub[/color][/size][/font]
[size=2][font=Consolas][color=#0000ff]End [/color][/font][/size][/color][/size][/font][/color][/size][/font][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff][font=Consolas][size=2][color=#0000ff]Class[/color][/size][/font]
[/color][/size][/font][/color][/size][/font]

 

Is this an issue of compiling using .NET 4.0 instead of 3.5? If so, how do I fix this?

 

Cheers!

Link to comment
Share on other sites

Have you got .NET Framework 4.0 installed on your computer?

 

You could always try compiling for .NET Framework 3.5, it sounds awfully like a .NET Framework mismatch.

 

Good luck :wink:

Link to comment
Share on other sites

it sounds awfully like a .NET Framework mismatch.

 

...Looks like one too:

(Snapshot from Registry Editor)

 

dotNET_Framework.JPG

 

You could always try compiling for .NET Framework 3.5

 

 

How would one go about do that? :?

Link to comment
Share on other sites

Open the Project Explorer

Right click on the project name and select properties

Go to the Compile Tab

Click on the button bottom left "Further compilation options" (I think, I only have a German version at work)

In the window that opens in the bottom drop down list you can select the .NET Framework version you want to compile to.

Rebuild your project and "Bob's your uncle"

Link to comment
Share on other sites

Open the Project Explorer

Right click on the project name and select properties

Go to the Compile Tab

Click on the button bottom left "Further compilation options" (I think, I only have a German version at work)

In the window that opens in the bottom drop down list you can select the .NET Framework version you want to compile to.

Rebuild your project and "Bob's your uncle"

 

Bob *IS* my uncle, and You are the Man. :wink:

 

If I ever make it to Saxony, the first yard of Erdinger Hefeweizen is my treat.

 

Prost! :stein:

Link to comment
Share on other sites

Thanks, you're welcome.

 

Erdinger is Bavarian, here we drink Radeburger :roll: But Erdinger is a good substitute.

 

I'm done for today and off home to sink a couple of those Radeburgers.

Link to comment
Share on other sites

Thanks, you're welcome.

 

Erdinger is Bavarian, here we drink Radeburger :roll: But Erdinger is a good substitute.

 

I'm done for today and off home to sink a couple of those Radeburgers.

 

 

The Privatbrauerei Erdinger Weißbräu Werner Brombach GmbH (also known as Erdinger Weißbräu) is a brewery in Erding, Germany. Its best-known products are its namesake Weißbiers (white beer).

 

 

Well, what can this American say, other than bring on the Radeburgers! o:)

 

I'll have to see if I can get Radeburger here... Hmmm.

 

Many thanks! :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...