check assembly

i need to Check Whether the assembly is already running in the process when i start the same assembly ( to avoid duplication in assemblies running currently)

i need one copy of assembly to run at a time.. is there any property to set or how to check




Answer this question

check assembly

  • shiraz.inam

    Where is the suitable place for inserting the code.. in new or.. when

    Thnks.



  • Ovidiu Burlacu

    just in the Form_Load perhaps or the better solution would be what Alex suggested

  • Sergio.Rykov

    THANKS it works in form_load event , actually i am using .net 2003 i can't see any option/tab for application as alex told..

  • armansiu

    As stated, that the Setting given by Alex is only for VS2005, not VS2003

  • dakota367

    if its an executable assembly, your app, you can get the list of processes by name and if it already exists then you know that another instance is running:

    Dim theProcesses() as Process = System.Diagnostics.Process.GetProcessByName("yourAppName")

    if theProcesses.Length > 1 then

    'another process running

    end if



  • Kartit

    In Visual studio 2005, in the project settings, under the application tab there is a check box, "Make single instance application" that ensures that at any time there is only one instance of that application running on your machine. You can then also click on the "View application events", select "My application events" and select "StartupNextInstance" if you want to do any special processing if another instance tries to start (it won't, but it will notify the original one that it tried through this event.)

    Was that what you needed

    Alex



  • Mike Hadlow

    THanks ahmed and alex

  • check assembly