Releasing software with project files included. Not happening

Posted on 2004-10-29
Last Modified: 2013-11-18
I have a C# application that I'm writing that has a Directory, including some XML documents, that doesn't get published to the release folder.

When I compile the project in release mode,the directory does not get coppied over. Is there something I'm not setting?

The project is 3 tiered, and my main (presentation) has the directory included in the project.
Question by:icompass
    LVL 9

    Expert Comment

    Do the xml files get published to the debug folder when you build it in debug mode?

    Author Comment

    No they don't. I have to copy it there manually.

    I only have the one exe, and 3 dll's when i build it.

    Is there a way of setting it up so I get :

    RootFolder/Bin/All Dll's
    RootFolder/Data/XML Files

    That would be ideal, but it's a small project so building an install is pointless. I mainly develope in ASP.NET and hardly touch the client side, but we need this small app to run on our servers to Support the ASP site.
    LVL 9

    Accepted Solution

    I don't know how you could set up the project to build in that way, the way I would do it is use the post-build-event to run a batch/cmd file to copy the files after the build.

    The following code will create the directories in the location you specify (%1 in the code) and copy the files to that location, it will first delete *everything* in the directories first though, to avoid overwriting...

    Hope it helps, sorry I don't know any other way around this...

    -----------Code Follows---------------

    @echo off
    ::Usage, PostBuild.cmd <RootFolder>

    ::This is true if you enter no command line argument.
    if "%1" == "" goto NoArgs

    @echo -------- Creating Directories (And clearing existing.)
    ::Assuming that the command line argument %1 is the 'RootFolder'
    ::!!!The /Q setting for delete means that it won't ask you if you want to delete the files!!!
    title Setting up MyProgram in %1
    md %1
    cd %1
    del /Q *.*
    md bin
    md data
    cd bin
    del /Q *.*
    cd data
    del /Q *.*

    ::Like this so you can extend it to as many files as you want.
    @echo -------- Beginning to copy exe files to %1
    for %%i in (
    ) do @copy %%i %1

    @echo -------- Beginning to copy dll files to %1/Bin.
    for %%i in (
    ) do @copy %%i %1/Bin

    @echo -------- Beginning to copy xml files to %1/Data.
    for %%i in (
    ) do @copy %%i %1/Data


    @echo You need to supply a command line argument to use this file:
    @echo PostBuild.bat rootfolder
    @echo "Where 'rootfolder' is the folder you want to copy to."

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
    Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    856 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now