Adding C#-Code to VB-Project in VS 2005 without using DLL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sven Rutten

    #1

    Adding C#-Code to VB-Project in VS 2005 without using DLL

    Hello

    Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
    Normally I creating a DLL and importing that from the VB-Project.

    But as I am coding something for a Smart Device (PocketPC), I dont want to
    distribute multiple files, I'd like to distribute a single EXE file.

    I've learned that I can, since VS 2005, add C#-Code to a VB Project.
    I can add it, but not use it. What am I doing wrong?

    Thanks

    Sven


  • Stephany Young

    #2
    Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

    Seeing as how you have learned that you can, since VS 2005, add C#-Code to a
    VB Project, would you please be so kind as to enlighten us. We would be most
    interested.


    "Sven Rutten" <sven (at) ruttensoft.comw rote in message
    news:eSoT%23kBV HHA.4260@TK2MSF TNGP06.phx.gbl. ..
    Hello
    >
    Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
    Normally I creating a DLL and importing that from the VB-Project.
    >
    But as I am coding something for a Smart Device (PocketPC), I dont want to
    distribute multiple files, I'd like to distribute a single EXE file.
    >
    I've learned that I can, since VS 2005, add C#-Code to a VB Project.
    I can add it, but not use it. What am I doing wrong?
    >
    Thanks
    >
    Sven
    >

    Comment

    • Sven Rutten

      #3
      Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

      Hi Stephany

      An Expert from experts-exchange.com told me so, but I cannot get it to
      work...

      Sven


      "Stephany Young" <noone@localhos tschrieb im Newsbeitrag
      news:OkUvRnBVHH A.1000@TK2MSFTN GP05.phx.gbl...
      Seeing as how you have learned that you can, since VS 2005, add C#-Code to
      a VB Project, would you please be so kind as to enlighten us. We would be
      most interested.
      >
      >
      "Sven Rutten" <sven (at) ruttensoft.comw rote in message
      news:eSoT%23kBV HHA.4260@TK2MSF TNGP06.phx.gbl. ..
      >Hello
      >>
      >Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
      >Normally I creating a DLL and importing that from the VB-Project.
      >>
      >But as I am coding something for a Smart Device (PocketPC), I dont want
      >to distribute multiple files, I'd like to distribute a single EXE file.
      >>
      >I've learned that I can, since VS 2005, add C#-Code to a VB Project.
      >I can add it, but not use it. What am I doing wrong?
      >>
      >Thanks
      >>
      >Sven
      >>
      >

      Comment

      • Stephany Young

        #4
        Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

        Now why does that not surprise me.

        Not much of an expert was he?


        "Sven Rutten" <sven (at) ruttensoft.comw rote in message
        news:O%23rQXrBV HHA.600@TK2MSFT NGP05.phx.gbl.. .
        Hi Stephany
        >
        An Expert from experts-exchange.com told me so, but I cannot get it to
        work...
        >
        Sven
        >
        >
        "Stephany Young" <noone@localhos tschrieb im Newsbeitrag
        news:OkUvRnBVHH A.1000@TK2MSFTN GP05.phx.gbl...
        >Seeing as how you have learned that you can, since VS 2005, add C#-Code
        >to a VB Project, would you please be so kind as to enlighten us. We would
        >be most interested.
        >>
        >>
        >"Sven Rutten" <sven (at) ruttensoft.comw rote in message
        >news:eSoT%23kB VHHA.4260@TK2MS FTNGP06.phx.gbl ...
        >>Hello
        >>>
        >>Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
        >>Normally I creating a DLL and importing that from the VB-Project.
        >>>
        >>But as I am coding something for a Smart Device (PocketPC), I dont want
        >>to distribute multiple files, I'd like to distribute a single EXE file.
        >>>
        >>I've learned that I can, since VS 2005, add C#-Code to a VB Project.
        >>I can add it, but not use it. What am I doing wrong?
        >>>
        >>Thanks
        >>>
        >>Sven
        >>>
        >>
        >
        >

        Comment

        • Stephany Young

          #5
          Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

          So, what did he ACTUALLY tell you?


          "Sven Rutten" <sven (at) ruttensoft.comw rote in message
          news:u0SZICCVHH A.4260@TK2MSFTN GP06.phx.gbl...
          Actually he's the #1 ranked there :-)
          But it's possible that I have misunderstood his answer...
          >
          >
          "Stephany Young" <noone@localhos tschrieb im Newsbeitrag
          news:edm6LwBVHH A.1000@TK2MSFTN GP05.phx.gbl...
          >Now why does that not surprise me.
          >>
          >Not much of an expert was he?
          >>
          >>
          >"Sven Rutten" <sven (at) ruttensoft.comw rote in message
          >news:O%23rQXrB VHHA.600@TK2MSF TNGP05.phx.gbl. ..
          >>Hi Stephany
          >>>
          >>An Expert from experts-exchange.com told me so, but I cannot get it to
          >>work...
          >>>
          >>Sven
          >>>
          >>>
          >>"Stephany Young" <noone@localhos tschrieb im Newsbeitrag
          >>news:OkUvRnBV HHA.1000@TK2MSF TNGP05.phx.gbl. ..
          >>>Seeing as how you have learned that you can, since VS 2005, add C#-Code
          >>>to a VB Project, would you please be so kind as to enlighten us. We
          >>>would be most interested.
          >>>>
          >>>>
          >>>"Sven Rutten" <sven (at) ruttensoft.comw rote in message
          >>>news:eSoT%23 kBVHHA.4260@TK2 MSFTNGP06.phx.g bl...
          >>>>Hello
          >>>>>
          >>>>Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
          >>>>Normally I creating a DLL and importing that from the VB-Project.
          >>>>>
          >>>>But as I am coding something for a Smart Device (PocketPC), I dont
          >>>>want to distribute multiple files, I'd like to distribute a single EXE
          >>>>file.
          >>>>>
          >>>>I've learned that I can, since VS 2005, add C#-Code to a VB Project.
          >>>>I can add it, but not use it. What am I doing wrong?
          >>>>>
          >>>>Thanks
          >>>>>
          >>>>Sven
          >>>>>
          >>>>
          >>>
          >>>
          >>
          >
          >

          Comment

          • Sven Rutten

            #6
            Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

            Actually he's the #1 ranked there :-)
            But it's possible that I have misunderstood his answer...


            "Stephany Young" <noone@localhos tschrieb im Newsbeitrag
            news:edm6LwBVHH A.1000@TK2MSFTN GP05.phx.gbl...
            Now why does that not surprise me.
            >
            Not much of an expert was he?
            >
            >
            "Sven Rutten" <sven (at) ruttensoft.comw rote in message
            news:O%23rQXrBV HHA.600@TK2MSFT NGP05.phx.gbl.. .
            >Hi Stephany
            >>
            >An Expert from experts-exchange.com told me so, but I cannot get it to
            >work...
            >>
            >Sven
            >>
            >>
            >"Stephany Young" <noone@localhos tschrieb im Newsbeitrag
            >news:OkUvRnBVH HA.1000@TK2MSFT NGP05.phx.gbl.. .
            >>Seeing as how you have learned that you can, since VS 2005, add C#-Code
            >>to a VB Project, would you please be so kind as to enlighten us. We
            >>would be most interested.
            >>>
            >>>
            >>"Sven Rutten" <sven (at) ruttensoft.comw rote in message
            >>news:eSoT%23k BVHHA.4260@TK2M SFTNGP06.phx.gb l...
            >>>Hello
            >>>>
            >>>Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
            >>>Normally I creating a DLL and importing that from the VB-Project.
            >>>>
            >>>But as I am coding something for a Smart Device (PocketPC), I dont want
            >>>to distribute multiple files, I'd like to distribute a single EXE file.
            >>>>
            >>>I've learned that I can, since VS 2005, add C#-Code to a VB Project.
            >>>I can add it, but not use it. What am I doing wrong?
            >>>>
            >>>Thanks
            >>>>
            >>>Sven
            >>>>
            >>>
            >>
            >>
            >

            Comment

            • Herfried K. Wagner [MVP]

              #7
              Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

              "Stephany Young" <noone@localhos tschrieb:
              Seeing as how you have learned that you can, since VS 2005, add C#-Code to
              a VB Project, would you please be so kind as to enlighten us. We would be
              most interested.
              You actually cannot, except in Web projects in which you can use different
              languages in different script blocks and pages.

              --
              M S Herfried K. Wagner
              M V P <URL:http://dotnet.mvps.org/>
              V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

              Comment

              • Herfried K. Wagner [MVP]

                #8
                Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

                "Stephany Young" <noone@localhos tschrieb im Newsbeitrag
                news:u0VFOGCVHH A.4028@TK2MSFTN GP04.phx.gbl...
                So, what did he ACTUALLY tell you?
                Well, maybe he was told that "it's possible to add C# code to a VB 2005
                project", which is basically not wrong but on the other must not be
                generalized.

                --
                M S Herfried K. Wagner
                M V P <URL:http://dotnet.mvps.org/>
                V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

                Comment

                • RobinS

                  #9
                  Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

                  Can't you have a solution that has multiple projects, and the projects can
                  be in different languages?

                  Robin S.
                  ------------------------------------
                  "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.atwrot e in message
                  news:OcYgwsDVHH A.1364@TK2MSFTN GP06.phx.gbl...
                  "Stephany Young" <noone@localhos tschrieb:
                  >Seeing as how you have learned that you can, since VS 2005, add C#-Code
                  >to a VB Project, would you please be so kind as to enlighten us. We
                  >would be most interested.
                  >
                  You actually cannot, except in Web projects in which you can use
                  different languages in different script blocks and pages.
                  >
                  --
                  M S Herfried K. Wagner
                  M V P <URL:http://dotnet.mvps.org/>
                  V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

                  Comment

                  • Stephany Young

                    #10
                    Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

                    You're right it must not be generalised.

                    Until the OP tells us what he was told we cannot determine if it was right,
                    wrong or indifferent.


                    "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.atwrot e in message
                    news:%23D6jZtDV HHA.1036@TK2MSF TNGP03.phx.gbl. ..
                    "Stephany Young" <noone@localhos tschrieb im Newsbeitrag
                    news:u0VFOGCVHH A.4028@TK2MSFTN GP04.phx.gbl...
                    >So, what did he ACTUALLY tell you?
                    >
                    Well, maybe he was told that "it's possible to add C# code to a VB 2005
                    project", which is basically not wrong but on the other must not be
                    generalized.
                    >
                    --
                    M S Herfried K. Wagner
                    M V P <URL:http://dotnet.mvps.org/>
                    V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

                    Comment

                    • Stephany Young

                      #11
                      Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

                      Yes, of course you can. But references to the projects at design-time are
                      really 'smart' references to the compiled assemblies of those projects, in
                      that they know what and where the assenblies will be when thay are compiled.


                      "RobinS" <RobinS@NoSpam. yah.nonewrote in message
                      news:y9mdnUHAcL qGVkTYnZ2dnUVZ_ hSdnZ2d@comcast .com...
                      Can't you have a solution that has multiple projects, and the projects can
                      be in different languages?
                      >
                      Robin S.
                      ------------------------------------
                      "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.atwrot e in message
                      news:OcYgwsDVHH A.1364@TK2MSFTN GP06.phx.gbl...
                      >"Stephany Young" <noone@localhos tschrieb:
                      >>Seeing as how you have learned that you can, since VS 2005, add C#-Code
                      >>to a VB Project, would you please be so kind as to enlighten us. We
                      >>would be most interested.
                      >>
                      >You actually cannot, except in Web projects in which you can use
                      >different languages in different script blocks and pages.
                      >>
                      >--
                      >M S Herfried K. Wagner
                      >M V P <URL:http://dotnet.mvps.org/>
                      >V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
                      >
                      >

                      Comment

                      • BK

                        #12
                        Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

                        Although I'm not an expert, I do have a simple solution for you. Add
                        the C# code to it's own assembly class, compile the dll as you stated
                        you were already familiar with, and then use ILMerger to merge the 2
                        assemblies (the VB and C# outputs) into one final assembly.



                        Comment

                        • rowe_newsgroups

                          #13
                          Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

                          I know this is slightly off topic, but I'm curious - since both vb and
                          c# compile to msil, why couldn't the ide use a preprocessor to support
                          different languages in the same file?

                          Something like:

                          #Visual Basic
                          Public Sub VBFoo()
                          ...
                          End Sub
                          #End Visual Basic

                          #CSharp
                          public void CSharpFoo( )
                          {
                          ...
                          }
                          #End CSharp

                          Thanks,

                          Seth Rowe


                          On Feb 19, 10:32 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
                          h...@gmx.atwrot e:
                          "Stephany Young" <noone@localhos tschrieb:
                          >
                          Seeing as how you have learned that you can, since VS 2005, add C#-Code to
                          a VB Project, would you please be so kind as to enlighten us. We would be
                          most interested.
                          >
                          You actually cannot, except in Web projects in which you can use different
                          languages in different script blocks and pages.
                          >
                          --
                          M S Herfried K. Wagner
                          M V P <URL:http://dotnet.mvps.org/>
                          V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

                          Comment

                          • aaron.kempf@gmail.com

                            #14
                            Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

                            C# was never invented.

                            that is the best strategy; make those C# dorks use a real language.




                            On Feb 19, 3:29 am, "Sven Rutten" <sven (at) ruttensoft.comw rote:
                            Hello
                            >
                            Actually I want to add some C#-Code to a VB.NET-Project in VS 2005.
                            Normally I creating a DLL and importing that from the VB-Project.
                            >
                            But as I am coding something for a Smart Device (PocketPC), I dont want to
                            distribute multiple files, I'd like to distribute a single EXE file.
                            >
                            I've learned that I can, since VS 2005, add C#-Code to a VB Project.
                            I can add it, but not use it. What am I doing wrong?
                            >
                            Thanks
                            >
                            Sven

                            Comment

                            • Michael D. Ober

                              #15
                              Re: Adding C#-Code to VB-Project in VS 2005 without using DLL

                              Seth,

                              Why don't you submit this to MS. This, at least on the surface, sounds like
                              a good idea.

                              Mike Ober.

                              "rowe_newsgroup s" <rowe_email@yah oo.comwrote in message
                              news:1171910112 .942649.72970@p 10g2000cwp.goog legroups.com...
                              >I know this is slightly off topic, but I'm curious - since both vb and
                              c# compile to msil, why couldn't the ide use a preprocessor to support
                              different languages in the same file?
                              >
                              Something like:
                              >
                              #Visual Basic
                              Public Sub VBFoo()
                              ...
                              End Sub
                              #End Visual Basic
                              >
                              #CSharp
                              public void CSharpFoo( )
                              {
                              ...
                              }
                              #End CSharp
                              >
                              Thanks,
                              >
                              Seth Rowe
                              >
                              >
                              On Feb 19, 10:32 am, "Herfried K. Wagner [MVP]" <hirf-spam-me-
                              h...@gmx.atwrot e:
                              >"Stephany Young" <noone@localhos tschrieb:
                              >>
                              Seeing as how you have learned that you can, since VS 2005, add C#-Code
                              to
                              a VB Project, would you please be so kind as to enlighten us. We would
                              be
                              most interested.
                              >>
                              >You actually cannot, except in Web projects in which you can use
                              >different
                              >languages in different script blocks and pages.
                              >>
                              >--
                              > M S Herfried K. Wagner
                              >M V P <URL:http://dotnet.mvps.org/>
                              > V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
                              >
                              >

                              Comment

                              Working...