Compiling the VB samples from the command-line

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • N. P.

    Compiling the VB samples from the command-line

    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.res x,frmMain.resou rces
    /res:frmAbout.re sx,frmAbout.res ources /r:System.dll /r:System.Drawin g.dll
    /r:System.Window s.Forms /imports:System /imports:System. Windows.Forms
    /imports:Microso ft.VisualBasic /main:frmMain /out:myapp.exe
    When I run myapp.exe it throws an exception and says that:

    Unhandled Exception: System.Argument Exception: Stream is not a valid
    resource fi
    le.
    at System.Resource s.ResourceReade r.ReadResources ()
    at System.Resource s.ResourceReade r..ctor(Stream stream, Hashtable table)
    at System.Resource s.RuntimeResour ceSet..ctor(Str eam stream)
    at System.Resource s.ResourceManag er.CreateResour ceSet(Stream store)
    at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
    cultur
    e, Boolean createIfNotExis ts, Boolean tryParents)
    at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
    cultur
    e, Boolean createIfNotExis ts, Boolean tryParents)
    at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
    cultur
    e, Boolean createIfNotExis ts, Boolean tryParents)
    at System.Resource s.ResourceManag er.GetObject(St ring name, CultureInfo
    cultur
    e)
    at System.Resource s.ResourceManag er.GetObject(St ring name)
    at frmMain.Initial izeComponent()
    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.


  • Ken Tucker [MVP]

    #2
    Re: Compiling the VB samples from the command-line

    Hi,

    If you review 5 of the vb at movies episodes you will get a free
    copy of vb.net.


    Ken
    ----------------------
    "N. P." <Not available> wrote in message
    news:u7g5U%237R EHA.1644@TK2MSF TNGP09.phx.gbl. ..[color=blue]
    >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.res x,frmMain.resou rces
    > /res:frmAbout.re sx,frmAbout.res ources /r:System.dll /r:System.Drawin g.dll
    > /r:System.Window s.Forms /imports:System /imports:System. Windows.Forms
    > /imports:Microso ft.VisualBasic /main:frmMain /out:myapp.exe
    > When I run myapp.exe it throws an exception and says that:
    >
    > Unhandled Exception: System.Argument Exception: Stream is not a valid
    > resource fi
    > le.
    > at System.Resource s.ResourceReade r.ReadResources ()
    > at System.Resource s.ResourceReade r..ctor(Stream stream, Hashtable table)
    > at System.Resource s.RuntimeResour ceSet..ctor(Str eam stream)
    > at System.Resource s.ResourceManag er.CreateResour ceSet(Stream store)
    > at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
    > cultur
    > e, Boolean createIfNotExis ts, Boolean tryParents)
    > at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
    > cultur
    > e, Boolean createIfNotExis ts, Boolean tryParents)
    > at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
    > cultur
    > e, Boolean createIfNotExis ts, Boolean tryParents)
    > at System.Resource s.ResourceManag er.GetObject(St ring name, CultureInfo
    > cultur
    > e)
    > at System.Resource s.ResourceManag er.GetObject(St ring name)
    > at frmMain.Initial izeComponent()
    > 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.
    >
    >[/color]


    Comment

    • N. P.

      #3
      Re: Compiling the VB samples from the command-line

      No. It's only for USA and Canada, no other countries.
      "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
      news:OAa$VT8REH A.3140@tk2msftn gp13.phx.gbl...[color=blue]
      > 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/
      >
      > Ken
      > ----------------------
      > "N. P." <Not available> wrote in message
      > news:u7g5U%237R EHA.1644@TK2MSF TNGP09.phx.gbl. ..[color=green]
      > >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[/color][/color]
      that[color=blue][color=green]
      > > there must be a way to compile and successfully run these 101 samples[/color][/color]
      from[color=blue][color=green]
      > > the command-line but even though I tried hard there are problems with[/color][/color]
      the[color=blue][color=green]
      > > resources .resx files.
      > > Eg. I tried using the following command to compile one of the 101[/color][/color]
      samples:[color=blue][color=green]
      > > vbc *.vb /res:frmMain.res x,frmMain.resou rces
      > > /res:frmAbout.re sx,frmAbout.res ources /r:System.dll[/color][/color]
      /r:System.Drawin g.dll[color=blue][color=green]
      > > /r:System.Window s.Forms /imports:System /imports:System. Windows.Forms
      > > /imports:Microso ft.VisualBasic /main:frmMain /out:myapp.exe
      > > When I run myapp.exe it throws an exception and says that:
      > >
      > > Unhandled Exception: System.Argument Exception: Stream is not a valid
      > > resource fi
      > > le.
      > > at System.Resource s.ResourceReade r.ReadResources ()
      > > at System.Resource s.ResourceReade r..ctor(Stream stream, Hashtable[/color][/color]
      table)[color=blue][color=green]
      > > at System.Resource s.RuntimeResour ceSet..ctor(Str eam stream)
      > > at System.Resource s.ResourceManag er.CreateResour ceSet(Stream store)
      > > at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
      > > cultur
      > > e, Boolean createIfNotExis ts, Boolean tryParents)
      > > at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
      > > cultur
      > > e, Boolean createIfNotExis ts, Boolean tryParents)
      > > at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
      > > cultur
      > > e, Boolean createIfNotExis ts, Boolean tryParents)
      > > at System.Resource s.ResourceManag er.GetObject(St ring name, CultureInfo
      > > cultur
      > > e)
      > > at System.Resource s.ResourceManag er.GetObject(St ring name)
      > > at frmMain.Initial izeComponent()
      > > 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.
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Alexandre Moura

        #4
        RE: Compiling the VB samples from the command-line

        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

        --------------------[color=blue]
        >From: "N. P." <Not available>
        >Subject: Compiling the VB samples from the command-line
        >Date: Tue, 1 Jun 2004 13:02:31 +0300
        >Lines: 42
        >X-Priority: 3
        >X-MSMail-Priority: Normal
        >X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
        >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
        >Message-ID: <u7g5U#7REHA.16 44@TK2MSFTNGP09 .phx.gbl>
        >Newsgroups: microsoft.publi c.dotnet.langua ges.vb
        >NNTP-Posting-Host: adsl-187-41.cytanet.com. cy 213.149.187.41
        >Path:[/color]
        cpmsftngxa10.ph x.gbl!TK2MSFTNG XA01.phx.gbl!TK 2MSFTNGP08.phx. gbl!TK2MSFTNGP0 9
        .phx.gbl[color=blue]
        >Xref: cpmsftngxa10.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:206624
        >X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vb
        >
        >I do not have Visual Basic .NET Standard or higher but I have downloaded[/color]
        the[color=blue]
        >.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.res x,frmMain.resou rces
        >/res:frmAbout.re sx,frmAbout.res ources /r:System.dll /r:System.Drawin g.dll
        >/r:System.Window s.Forms /imports:System /imports:System. Windows.Forms
        >/imports:Microso ft.VisualBasic /main:frmMain /out:myapp.exe
        >When I run myapp.exe it throws an exception and says that:
        >
        >Unhandled Exception: System.Argument Exception: Stream is not a valid
        >resource fi
        >le.
        > at System.Resource s.ResourceReade r.ReadResources ()
        > at System.Resource s.ResourceReade r..ctor(Stream stream, Hashtable table)
        > at System.Resource s.RuntimeResour ceSet..ctor(Str eam stream)
        > at System.Resource s.ResourceManag er.CreateResour ceSet(Stream store)
        > at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
        >cultur
        >e, Boolean createIfNotExis ts, Boolean tryParents)
        > at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
        >cultur
        >e, Boolean createIfNotExis ts, Boolean tryParents)
        > at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
        >cultur
        >e, Boolean createIfNotExis ts, Boolean tryParents)
        > at System.Resource s.ResourceManag er.GetObject(St ring name, CultureInfo
        >cultur
        >e)
        > at System.Resource s.ResourceManag er.GetObject(St ring name)
        > at frmMain.Initial izeComponent()
        > 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.
        >
        >
        >[/color]

        Comment

        • HankG

          #5
          Re: Compiling the VB samples from the command-line


          "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
          news:OAa$VT8REH A.3140@tk2msftn gp13.phx.gbl...[color=blue]
          > 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/[/color]
          [color=blue]
          >
          > Ken[/color]

          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
          [color=blue]
          > ----------------------
          > "N. P." <Not available> wrote in message
          > news:u7g5U%237R EHA.1644@TK2MSF TNGP09.phx.gbl. ..[color=green]
          > >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[/color][/color]
          that[color=blue][color=green]
          > > there must be a way to compile and successfully run these 101 samples[/color][/color]
          from[color=blue][color=green]
          > > the command-line but even though I tried hard there are problems with[/color][/color]
          the[color=blue][color=green]
          > > resources .resx files.
          > > Eg. I tried using the following command to compile one of the 101[/color][/color]
          samples:[color=blue][color=green]
          > > vbc *.vb /res:frmMain.res x,frmMain.resou rces
          > > /res:frmAbout.re sx,frmAbout.res ources /r:System.dll[/color][/color]
          /r:System.Drawin g.dll[color=blue][color=green]
          > > /r:System.Window s.Forms /imports:System /imports:System. Windows.Forms
          > > /imports:Microso ft.VisualBasic /main:frmMain /out:myapp.exe
          > > When I run myapp.exe it throws an exception and says that:
          > >
          > > Unhandled Exception: System.Argument Exception: Stream is not a valid
          > > resource fi
          > > le.
          > > at System.Resource s.ResourceReade r.ReadResources ()
          > > at System.Resource s.ResourceReade r..ctor(Stream stream, Hashtable[/color][/color]
          table)[color=blue][color=green]
          > > at System.Resource s.RuntimeResour ceSet..ctor(Str eam stream)
          > > at System.Resource s.ResourceManag er.CreateResour ceSet(Stream store)
          > > at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
          > > cultur
          > > e, Boolean createIfNotExis ts, Boolean tryParents)
          > > at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
          > > cultur
          > > e, Boolean createIfNotExis ts, Boolean tryParents)
          > > at System.Resource s.ResourceManag er.InternalGetR esourceSet(Cult ureInfo
          > > cultur
          > > e, Boolean createIfNotExis ts, Boolean tryParents)
          > > at System.Resource s.ResourceManag er.GetObject(St ring name, CultureInfo
          > > cultur
          > > e)
          > > at System.Resource s.ResourceManag er.GetObject(St ring name)
          > > at frmMain.Initial izeComponent()
          > > 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.
          > >
          > >[/color]
          >
          >[/color]


          ---
          Outgoing mail is certified Virus Free.
          Checked by AVG anti-virus system (http://www.grisoft.com).
          Version: 6.0.693 / Virus Database: 454 - Release Date: 5/31/2004


          Comment

          Working...