none
A simpler way to deploy console app? RRS feed

  • Question

  • I've written a website indexer which is a VS2008 console application. In order to deploy the app to the web server it runs on, I have to publish it, then copy the setup files to the server, run them, and then go digging into the file system to find the application folder so I can copy it to a predictable location where Task Scheduler can find it to run it at 2am every day. This seems unnecessarily complicated, especially when I have to repeat this process fairly often as changes to the website structure necessitate code alterations. Isn't there a simpler way to deploy a console app rather than all this ClickOnce jiggerypokery, which is great in the right place, but in this case is just getting in the way?
    class Religion { Explain (event) { try { ToExplain(event)} catch { throw("God moves in mysterious ways") } } }
    Tuesday, April 12, 2011 2:13 AM

Answers

All replies

  • Why not just copy the contents of the \bin\release folder to the server? If you're publishing it and updating it yourself, why would you need to use ClickOnce?

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by pedroponting Wednesday, April 13, 2011 2:25 AM
    Tuesday, April 12, 2011 2:24 AM
    Moderator
  • Hi pedroponting,

    http://social.msdn.microsoft.com/Forums/en-SG/winformssetup/thread/4b928bf5-3f2b-4e12-a15e-dfbf543608dc

    Since I have no idea about how to let the custom action create and add this scheduler, and I also think this is hard or there's no way at this moment. So I have the following idea, and it can work fine for you.

    I think you can use another application or let the application itself add the task to the task scheduler at the first run time after you install it through ClickOnce technical.

    You can use the Process.GetProcessesByName method from another application get the full name of this main application, then you can add it to the task scheduler directly. Or use the Application.ExecutePath at the application beginning retrieve the full name of the main application, and then add it to the task scheduler.

    You can use this wrapper library in your application or just p/invoke the Task Scheduler API yourself to create the task using the full name got above.

    http://taskscheduler.codeplex.com/

    http://www.codeproject.com/KB/system/taskschedulerlibrary.aspx

    http://msdn.microsoft.com/en-us/library/aa384006(v=VS.85).aspx

     

    Have a nice day!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, April 12, 2011 8:10 AM
    Moderator
  • Thank you both. Robin - that's it! I don't need ClickOnce and I guess what I was asking was how to avoid the complication of it. The answer is obvious now you say it. Thanks again.

    Mike, thanks for the suggestions. It's better to avoid ClickOnce altogether, since I also need to modify an XML settings file and have access to a log the app generates, so having it hidden away deep in the bowels of Users/etc etc is no good for me.


    class Religion { Explain (event) { try { ToExplain(event)} catch { throw("God moves in mysterious ways") } } }
    Wednesday, April 13, 2011 2:24 AM
  • Hi pedroponting,

    You're welcome.

    The direct and easy way to deploy it by copy. Robin's suggestion is good.

     

    Have a nice day!


    Mike [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 13, 2011 7:25 AM
    Moderator