Solved

Releasing software with project files included. Not happening

Posted on 2004-10-29
215 Views
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.
0
Question by:icompass
    3 Comments
     
    LVL 9

    Expert Comment

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

    Author Comment

    by:icompass
    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/MyExe.exe
    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.
    0
     
    LVL 9

    Accepted Solution

    by:
    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..
    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 (
    c:\Project_1\Bin\Debug\MyExe.exe
    ) do @copy %%i %1

    @echo -------- Beginning to copy dll files to %1/Bin.
    for %%i in (
    c:\Project_2\Bin\Debug\File1.dll
    c:\Project_2\Bin\Debug\File2.dll
    c:\Project_2\Bin\Debug\File3.dll
    ) do @copy %%i %1/Bin

    @echo -------- Beginning to copy xml files to %1/Data.
    for %%i in (
    c:\Project_2\xml1.xml
    c:\Project_2\xml2.xml
    c:\Project_2\xml3.xml
    ) do @copy %%i %1/Data

    exit

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

    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