VStudio 2008: How to create simple console tool?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Axel Dahmen

    VStudio 2008: How to create simple console tool?

    Hi,

    I've created a few simple console tools. No .NET used at all, just STL.

    Now I want to just XCOPY them to another machine. But running them there yields a couple of errors in the application log telling me that some ..NET DLL could not be found:


    "The application has failed to start because its side-by-side configuration is incorrect.
    Please see the application event log for more details."

    The application log says:

    "Activation context generation failed for "D:\Documents\M yTools\SomeTool .exe". Dependent Assembly Microsoft.VC90. CRT,processorAr chitecture="x86 ",publicKeyToke n="1fc8b3b9a1e1 8e3b",type="win 32",version="9. 0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis."


    I learned that this error occurs because of missing .NET runtime files on the target machine. But I DON'T want to install .NET on the target machine. I'm *intentionally* just using common API and STL functions.

    Can someone please enlighten me on how to set up a VC++ project to don't use .NET at all?

    I just want to create some simple DOS tools that I can put on my USB stick to help me with my daily work.

    TIA,
    Axel Dahmen
  • Giovanni Dicanio

    #2
    Re: VStudio 2008: How to create simple console tool?

    Try static linking CRT.

    Giovanni

    "Axel Dahmen" <KeenToKnow@new sgroup.nospamha scritto nel messaggio
    news:AAC32CE3-5343-4685-8246-567E61BE3B89@mi crosoft.com...
    Hi,

    I've created a few simple console tools. No .NET used at all, just STL.

    Now I want to just XCOPY them to another machine. But running them there
    yields a couple of errors in the application log telling me that some .NET
    DLL could not be found:


    "The application has failed to start because its side-by-side configuration
    is incorrect.
    Please see the application event log for more details."

    The application log says:

    "Activation context generation failed for
    "D:\Documents\M yTools\SomeTool .exe". Dependent Assembly
    Microsoft.VC90. CRT,processorAr chitecture="x86 ",publicKeyToke n="1fc8b3b9a1e1 8e3b",type="win 32",version="9. 0.21022.8"
    could not be found. Please use sxstrace.exe for detailed diagnosis."


    I learned that this error occurs because of missing .NET runtime files on
    the target machine. But I DON'T want to install .NET on the target machine.
    I'm *intentionally* just using common API and STL functions.

    Can someone please enlighten me on how to set up a VC++ project to don't use
    ..NET at all?

    I just want to create some simple DOS tools that I can put on my USB stick
    to help me with my daily work.

    TIA,
    Axel Dahmen


    Comment

    • Giovanni Dicanio

      #3
      Re: VStudio 2008: How to create simple console tool?


      "Giovanni Dicanio" <gdicanio@_NOSP AM_email_DOT_it ha scritto nel messaggio
      news:uqLbh8s%23 IHA.4788@TK2MSF TNGP02.phx.gbl. ..
      Try static linking CRT.
      i.e. :

      Select project properties, then navigate here:

      Configuration Properties | C/C++ | Code Generation

      and select:

      Runtime library = Multi-threaded (/MT)

      (or use /MT option from command line).

      In this way, you will have just a simple .exe that you can distribute.

      Giovanni


      Comment

      • SvenC

        #4
        Re: VStudio 2008: How to create simple console tool?

        Hi Axel,
        I've created a few simple console tools. No .NET used at all, just
        STL.
        Now I want to just XCOPY them to another machine. But running them
        there yields a couple of errors in the application log telling me
        that some .NET DLL could not be found:
        ....
        "Activation context generation failed for
        "D:\Documents\M yTools\SomeTool .exe". Dependent Assembly
        Microsoft.VC90. CRT,processorAr chitecture="x86 ",publicKeyToke n="1fc8b3b9a1e1 8e3b",type="win 32",version="9. 0.21022.8"
        could not be found. Please use sxstrace.exe for detailed diagnosis."
        Where does the error talk about .Net?
        I learned that this error occurs because of missing .NET runtime
        files on the target machine.
        Where did you learn that? You have been taught wrong!
        The above microsoft.vc90. crt is the C++ runtime, a native dll which
        is needed when you link to the CRT dll instead of static linkage
        Please learn the differences of native and managed VC++ more
        carefully and you will have much less trouble ;-)
        But I DON'T want to install .NET on the
        target machine. I'm *intentionally* just using common API and STL
        functions.
        Can someone please enlighten me on how to set up a VC++ project to
        don't use .NET at all?
        Change your VC++ project settings to use static linkage:

        General settings:
        - Use of MFC "Standard Windows" or "Static Library"
        - Use of ATL "Not using ATL" or "Static Link"
        - Common Language Runtime (this is .Net!) "No Common Language Runtime"

        C/C++/Code Generation:
        - Runtime Library (this causes your above error!) "Multi-threaded" or
        "Multi-threaded Debug" depending on the Build Configuration you are
        configuring "Release" or "Debug"

        --
        SvenC

        Comment

        • Axel Dahmen

          #5
          Re: VStudio 2008: How to create simple console tool?

          Thanks, Giovanni and Sven, a lot for enlightening me and helping me out with the appropriate settings!!

          Sven,
          yes you're perfectly right. My mistake. I apologize for having been ignorant on the details of SxS... I must have got something wrong when reading about "assemblies " and the syntax of how the CRT file is referenced in the event log.

          I've now found a very helpful blog on SxS on MSDN which I'm just reading into:



          Thanks again to both of you for being a valuable help on my problem.

          Best regards,
          Axel Dahmen



          PS: I've posted this reply once before, but there seems to be a problem with Windows Mail on Vista. It sometimes doesn't download my own replies from the newsgroup. So it's impossible for me to see if my reply actually reached the newsgroup at all. That's why I'm re-posting now...






          -----------------
          "SvenC" <SvenC@nospam.n ospamschrieb im Newsbeitrag news:31734675-DA96-424A-BF21-24A99E711FFE@mi crosoft.com...
          Hi Axel,
          >I've created a few simple console tools. No .NET used at all, just
          >STL.
          >Now I want to just XCOPY them to another machine. But running them
          >there yields a couple of errors in the application log telling me
          >that some .NET DLL could not be found:
          ...
          >"Activation context generation failed for
          >"D:\Documents\ MyTools\SomeToo l.exe". Dependent Assembly
          >Microsoft.VC90 .CRT,processorA rchitecture="x8 6",publicKeyTok en="1fc8b3b9a1e 18e3b",type="wi n32",version="9 .0.21022.8"
          >could not be found. Please use sxstrace.exe for detailed diagnosis."
          Where does the error talk about .Net?
          >I learned that this error occurs because of missing .NET runtime
          >files on the target machine.
          Where did you learn that? You have been taught wrong!
          The above microsoft.vc90. crt is the C++ runtime, a native dll which
          is needed when you link to the CRT dll instead of static linkage
          Please learn the differences of native and managed VC++ more
          carefully and you will have much less trouble ;-)
          >But I DON'T want to install .NET on the
          >target machine. I'm *intentionally* just using common API and STL
          >functions.
          >Can someone please enlighten me on how to set up a VC++ project to
          >don't use .NET at all?
          Change your VC++ project settings to use static linkage:

          General settings:
          - Use of MFC "Standard Windows" or "Static Library"
          - Use of ATL "Not using ATL" or "Static Link"
          - Common Language Runtime (this is .Net!) "No Common Language Runtime"

          C/C++/Code Generation:
          - Runtime Library (this causes your above error!) "Multi-threaded" or
          "Multi-threaded Debug" depending on the Build Configuration you are
          configuring "Release" or "Debug"

          --
          SvenC
          >

          Comment

          Working...