Search code examples
c#visual-studio-2010sql-server-2008schedulingremote-debugging

How to run exe from another network


I have a dll and an exe both created in my machine. I am referring this dll in the exe.But when i specify build or debug path to a folder in another network directory, like \\ABC\App\ and then run this as a job in SQL server, I am getting errors which specifies paths to my C:\myname\My Documents\Visual Studio 2010\Projects\App\App\program.cs. I dont understand why the references are still not reflected. I changed the directories in Visual Studio properties for my project and running in the Active(Release) mode. I am not sure what is going wrong with the references.


Also, it is not a duplicate question plz :) it is kind of specific to SQL jobs and remote execution.I donot want links to some questions.


Solution

  • The exception will contain the path of the original location of the .cs file, because in the compiled program, there is no .cs file anymore.

    This has nothing to do with the fact that you run the program from the network path.

    In other words: When you compile your program, the compiler creates your dll and a file with the extension pdb that has the same name. For example yourdll.dll and yourdll.pdb. During compilation, the compiler writes the paths of the .cs files into the .pdb file. And these are the paths that you are later seeing in your exceptions.
    That means, they are fixed and will always be the same, no matter where you run your program.

    To be very explicit:
    This behavior is by design, not an error and can't be changed.