none
Minimal deployment

    Question

  • I'm using VC++ 2008 Express. My app uses a few basic CLR forms, but isn't completely managed because it also accesses the old standard mmsystem.dll for MIDI. It compiles to a single .exe file. When I move it to the computer next to me, it won't run, providing the unhelpful message, "The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem." The app was targeted to .NET Framework 2.0, and .NET Framework 2.0 is indeed installed on the target machine.

    So I guess it's not enough to just give someone the .exe file, you have to "deploy" it somehow. I began looking up deployment, and wound up in a tangled hairball of interlinked help pages that list all the wonderful things you can do when deploying a .NET framework program, none of which actually said what to do. There was stuff about the different strategies for deployment, library dependencies, redistributing DLLs, Windows client applications, ATL server applications, versioning, side-by-side execution, Windows installer, ClickOnce, and on and on.

    My application is barely beyond the level of "Hello, world". Is it really necessary to wade through all that stuff in order to find out how to "deploy" what boils down to an 84 kilobyte .exe file? Or is there some instruction somewhere on the minimal amount of stuff that must be done in order to get a simple one-file .NET 2.0 application to run on another machine that already has .NET 2.0 on it?
    Wednesday, July 23, 2008 5:27 PM

Answers

  • If you use /clr then the appropriate version of the .NET framework must be present on the target system, and the CRT DLL must be installed. See the Sticky at the top of this forum for how to deploy the CRT DLL (you need the VC9 version, not VC8).

    If you had used only native code, then you could have used static linking of CRT, and your app would have just worked.


    David Wilkinson | Visual C++ MVP
    • Marked as answer by Yan-Fei Wei Monday, July 28, 2008 2:16 AM
    Wednesday, July 23, 2008 6:55 PM

All replies

  • If you use /clr then the appropriate version of the .NET framework must be present on the target system, and the CRT DLL must be installed. See the Sticky at the top of this forum for how to deploy the CRT DLL (you need the VC9 version, not VC8).

    If you had used only native code, then you could have used static linking of CRT, and your app would have just worked.


    David Wilkinson | Visual C++ MVP
    • Marked as answer by Yan-Fei Wei Monday, July 28, 2008 2:16 AM
    Wednesday, July 23, 2008 6:55 PM
  • For your simple application, take a look at the simplest solution. Use InstallAware installation toolfor setup and deployment and everything will be taken care of. It is a One-click pre-requisite installer that means , it will deploy .NET Framework 2.0 and all the nested dependencies with a single click. Absolutely no manual configuration or tweaking is required. You can even check for a named instance and install only if that named instance is not found - true to the spirit of pre-requisites. It offers excellent .NET support.
    Wednesday, July 23, 2008 9:00 PM
  • Thanks for the pointers, but still no joy.

    Option 1 was about MSMs and WinSXS, and said "Please refer to the Authoring tool documentation to determine how to merge the MSMs." I hope there's a way around this without learning about what MSMs are, and what the Authoring tool is.

    Option 3 spoke about using vcredist*.exe to apparently do automatically what option 1 is all about, and said they could be found in <VS install path>\sdk. My sdk subdirectory is empty.

    That leaves option 2. It saids the CRT libraries are in <VS install path>\vc redist, and indeed they are. It said to copy the appropriate subdirectories into my application directory. First I tried copying the entire x86 folder, so that I have:

        foobar.exe
        x86\
        x86\Microsoft.VC90.CRT\
        x86\Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest
        x86\Microsoft.VC90.CRT\msvcm90.dll
        x86\Microsoft.VC90.CRT\msvcp90.dll
        x86\Microsoft.VC90.CRT\msvcr90.dll

    I got the same error message. So I tried just putting the second level directory next to the executable, giving me:

        foobar.exe
        Microsoft.VC90.CRT\
        Microsoft.VC90.CRT\Microsoft.VC90.CRT.manifest
        Microsoft.VC90.CRT\msvcm90.dll
        Microsoft.VC90.CRT\msvcp90.dll
        Microsoft.VC90.CRT\msvcr90.dll

    I got the same error message. So I tried just putting the actual files next to the executable.

        foobar.exe
        Microsoft.VC90.CRT.manifest
        msvcm90.dll
        msvcp90.dll
        msvcr90.dll

    I got the same error message. Could my problem be elsewhere? Is there any way to find out what exactly it's complaining about when it says, "The application has failed to start because the application configuration is incorrect."?

    Thursday, July 24, 2008 1:20 AM
  • Actually, the second one, with Microsoft.VC90.CRT next to my executable, works. It didn't before because I had put the debug executable there. I'm not sure why the debug executable won't work with the regular libraries...I guess there are some debug-related function calls, or normally inlined stuff that isn't inlined in debug mode. Anyway, it's finally working, so thanks for the help.

     

    Thursday, July 24, 2008 3:45 PM
  •  

    This is probably trivial to you chaps, but grateful for any help:
    I have been using mageui to build manifests to deploy a VC++ program. The program's manifest (generated using cl/clr) refers to dependent assemblies microsoft.vc90.mfc and microsoft.vc90.crt.
    If I don't put msvcp90.dll, msvcr90.dll ... mfcm90u.dll etc in the distribution folder, the install fails because it can't find them.
    If I add them to the distribution directory but don't re-run mage to add them to the manifest, the install finds them but then objects that
    "The + Manifest XML signature is not valid.
      + No signature was present in the subject."
    If I add them to the distribution directory and re-run mage, including them in the distribution, the install fails because it says "The file \\...\\...msvcr90.dll already exists".
    This presumably is because it's trying to install the dll's once because it knows they are part of the  microsoft.vc90.crt or .mfc  assembly, and once again because they're in the list for deployment.



    Thursday, October 16, 2008 4:35 PM