4

I have a console app on a network location \\desktop1\C$\Code. But when I open the solution in Visual Studio from my machine desktop2, its is running in context of my desktop2 and not in context of desktop1.

How do I run the exe in context of desktop1 ?

For example, when I print the name of the machine using below code, I get the output as desktop2 even though the code is located in desktop1

private static void Main(string[] args)
{
    Console.WriteLine(System.Environment.MachineName);
    Console.ReadLine();
}

EDIT: desktop1 does not have Visual Studio installed.

Karthik
  • 1,447
  • 1
  • 18
  • 26
  • check this links: https://www.idautomation.com/kb/label_software_from_server.html – Siavash Sep 24 '18 at 08:32
  • 1
    What are you actually trying to achieve? The behaviour you describe is _exactly_ what one would expect (you're running the application from a folder, that happens to be on another machine but you launch in the context of the machine you're on) – Murph Sep 24 '18 at 13:06

2 Answers2

0

Login to Desktop1 using RDC? Otherwise, if your console app is a windows service ( this is a workaround for windows services to enable debugging) you can attach your local VS to the service hosted on a remote machine

Pawlinski
  • 46
  • 2
0

This is nothing which can be achieved by changing the project itself. You need some external tool to start the application on the remote computer.

There are several possible ways to do that. However, which ones to use depend on your concrete use case and the question better fits on https://superuser.com/ unless your only use case is for debugging purposes.

NineBerry
  • 26,306
  • 3
  • 62
  • 93