Compiling the VB samples from the command-line

N

N. P.

I do not have Visual Basic .NET Standard or higher but I have downloaded the
..NET SDK and the 101 VB.NET samples from the MSDN website. I am sure that
there must be a way to compile and successfully run these 101 samples from
the command-line but even though I tried hard there are problems with the
resources .resx files.
Eg. I tried using the following command to compile one of the 101 samples:
vbc *.vb /res:frmMain.resx,frmMain.resources
/res:frmAbout.resx,frmAbout.resources /r:System.dll /r:System.Drawing.dll
/r:System.Windows.Forms /imports:System /imports:System.Windows.Forms
/imports:Microsoft.VisualBasic /main:frmMain /out:myapp.exe
When I run myapp.exe it throws an exception and says that:

Unhandled Exception: System.ArgumentException: Stream is not a valid
resource fi
le.
at System.Resources.ResourceReader.ReadResources()
at System.Resources.ResourceReader..ctor(Stream stream, Hashtable table)
at System.Resources.RuntimeResourceSet..ctor(Stream stream)
at System.Resources.ResourceManager.CreateResourceSet(Stream store)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
cultur
e, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
cultur
e, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
cultur
e, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.GetObject(String name, CultureInfo
cultur
e)
at System.Resources.ResourceManager.GetObject(String name)
at frmMain.InitializeComponent()
at frmMain..ctor()
at frmMain.Main()

There must be a problem with the way that resources files .resx are
interpreted by the application. What am I doing wrong?
Thanks,
N. P.
 
A

Alexandre Moura

I'm really not an expert on this, but it seems to me that you're using the
/res switch with both the .resx and the compiled version of the resource
file - you may want to try to specify just one or the other, not both.

Also, and again I'm not sure if this would affect your issue, but shouldn't
you compile your code with /t:winexe?

Hope that helps,
Alex

--------------------
 
H

HankG

Ken Tucker said:
Hi,

If you review 5 of the vb at movies episodes you will get a free
copy of vb.net.
http://msdn.microsoft.com/vbasic/atthemovies/

I did it. Not only did I get VB .NET, I got the Visual Studio and the MSDN.
Boy was I surprised and happy, until I tried to run it. I've been trying to
run a simple one-line program with no luck. See my post in this group
titled, "Re: very new to .NET". I'm not sure, but I think the offer is
over.

HankG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top