Visual Studio 2013 remote debugging, auto deploy? - c#

When I tried remote debugging with Windows Store applications (Metro applications), it was very easy. In the Start drop down I could choose one of the remote computer. Then VS built the project and automatically deployed the executable to the remote computer and ran it. It felt as if it were local debugging.
Now that I want to try remote debugging with an Windows application (simple C# Windows Forms), it was not that easy. I read the following page: http://msdn.microsoft.com/en-us/library/vstudio/8x6by8d2(v=vs.110).aspx
Does this mean I have to copy the built exe to the remote computer manually every single time when I build the project? Is there any way to make it work easily just like the Windows Store apps? Possibly a third-party extension or something?

I recently set this up for a work project, and encountered your post after experiencing similar issues. I detailed my solution on my blog.
Remote Debugging with VS2015
I changed the output folder to be a network share that my debugging account has access to, and the project build just creates output at that location, making it available to the debugger. I simply press the play (Debug) button on my toolbar with the 'Remote Debug' profile selected.
Open Configuration Manager for the solution
Add a new configuration and name it appropriately. Select the box to automatically do so for all projects.
Open the project properties of the executable project you wish to remotely debug.
Ensure that the remote debugging profile is selected.
Set the build output to the network share on the remote debugging computer.
Set the remote debugging host address and port.

Does this mean I have to copy the built exe to the remote computer
manually every single time when I build the project?
Yes.
Is there any way to make it work easily just like the Windows Store
apps?
You can create a post-build event in which you can do practically everything. In this case you can set up a xcopy/robocopy command which would copy the stuff to a network location.
Possibly a third-party extension or something?
Don't think so.

Related

Remote debugging a Windows Service VS2010

I have developed a windows service on my system and have deployed the service on a target machine which does not have visual studio. Therefore, I need to debug the application from my PC. I already know how to debug a windows service on a local machine.
MY STEPS:
Copied the complete bin folder (containing .exe as well as .pdb files) to the target machine.
Installed the service on the target machine using InstallUtil.exe (i.e installUtil.exe "pathToMyServiceEXE/myService.Exe")
Started the service
Installed Visual Studio Remote Debugging application (started in "No Authentication mode" with Debugging option checked)
Attached to the service in Visual Studio (which is running on my PC)
PROBLEM: I am able to successfully attached to the windows service of the target machine. But it cannot find the symbols.
I have checked other SO questions about the same problem but could not find the correct solution so far. I have tried the following things to solve the problem:
Opened Tools->Options->Debugging->Symbols and then put the path of .pdb files on my local PC. (Didn't work)
Opened Tools->Options->Debugging->General and unchecked "Enable just my code".
In addition to above two, I have already made sure that I am running the x64 version of the Remote debugging tool, Debug/x64 version of windows service and debug/x64 on my local PC.
The best advice that I can give you - which is not the easiest now, but will pay off in the long run - is to use WinDBG debugger on the target machine. This is next to zero setup on the target machine but will require you to learn the basics of WinDBG. This is not trivial but will pay off in the long run.
Regarding why you cannot load symbols:
Maybe PDBs do not match binaries?
Maybe path is not accesible to the current logged-in user? (such as mapped drive, etc)
Maybe permission issue?
Other then that I think it should work

How to setup remote debugging with a different directory

I have a c# visual studio 2013 project.
I want to use remote debugging.
When setting a directory on the remote machine which is identical to the local machine (ie c:\project) it works great, but I have a special directory structure dictated by my TFS and even located on another drive which is not present on the remote machine (e:). I want to know how to define a different working directory on the remote machine from the local one.
How I got around this in Visual Studio 2015 (which is probably still relevant) is by making another build configuration for remote debugging, with the output folder set to a Windows Share on the remote machine. You can secure it with Windows Authentication, and hide the share with the 'hiddenShare$' notation.
I detail it on my blog and reference the corresponding MSDN articles here:
Remote Debugging with VS2105
I also offered a similar answer to a similar question, here:
Visual Studio 2013 remote debugging, auto deploy?
Open Configuration Manager for the solution
Add a new configuration and name it appropriately. Select the box to automatically do so for all projects.
Open the project properties of the executable project you wish to remotely debug.
Ensure that the remote debugging profile is selected.
Set the build output to the network share on the remote debugging computer.
Set the remote debugging host address and port.
Found another workaround:
Create a small virtual disk how to.
Create a batch for copying
xcopy [source] [destination] /s /e /y
Just execute batch before debugging.
It should work.

How to run the c# exe application without having VS open

I am working with visual studio 2013 in c#. My application contains three project in the same folder: client side, database side and web service side.
When I run the application from within visual studio, it runs very well and all the features of the application are functioning. When I run the exe file located in the bin/debug folder, it runs only when VS is open. If VS is closed it runs only the client side and a message is shown
impossible to connect to the server.
How can I solve this?
When VS is open, it runs the server/web service, and your client. Running it from the commandline will require starting your server and web service side manually, and then starting the client.
If you don't have IIS manager installed you can launch IIS directly from iisexpress.exe.
It should be in C:\Program Files (x86)\IIS Express\iisexpress.exe, so just go ahead and run it.
Then you should be able to run your application.
To start IIS from the IIS manager go to Run (press Windows+R), and type in inetmgr.
This will open IIS manager, from there you can start it (forgive me for not being too specific, I don't have it currently installed. I believe you have a Start button at the side-panel. I hope someone in the comments could chime in or just edit this answer. If not I will install & update later).
After it is on you should be then able to run your executable successfully.
If your command-line can't find inetmgr, see my other answer here.
However if you do want to have the IIS manager you can install it + other IIS features easily:
Go to Computer → Uninstall or change a program.
At the side click on "Turn WIndows features on or off".
Inside "Internet Information Services" have your pick of whatever you want.
When you run in Visual Studio 2013, by default it uses its IIS Express as a webserver. You can set it to use IIS instead. (If you don't already have IIS installed, you'll need to install it using add/remove Windows components etc--google for more info on that if needed. Make sure you drill down to include ASP.NET under the IIS bits and pieces.)
To use IIS instead of the Visual Studio development webserver, right-click the project in Solution Explorer, and click the Web tab:
Select External Host in the dropdown, and enter a URL such as http://localhost/WebApp1. This is the virtual name by which IIS will access the files in your project folder. Earlier versions of Visual Studio included a button to create the virtual directory, but in 2013 you must create it yourself by running IIS Manager:
Enter the same virtual name you use in the project settings, and the physical path of your project:
Finally, right-click the newly created virtual directory and choose Convert to Application.
The website/webservice will now run under IIS, so will be available independently of Visual Studio.

Deploying the Windows Form Application by Click Once

I knew nothing about ClickOnce and I tried to find more. I have an Windows Forms Application and I want to use a web server (http) to deploy it by click once for testing by customer.
I have Apache in my system to use my system as a web server (which is in XAMPP software)
I have several questions:
When I want to publish the application, must I copy it in specific directory?
Is there any free web server that I can use?
If there is, must I copy my application on web server? How?
BTW, If you know a detailed instruction about that ,may you introduced?
PS: I read this reference completely.
You specify the location of your ClickOnce Application in Properties -> Publish. The Publishing Folder is the Location, where Visual Studio tries to save the published Location. If you are using a WebServer where you have to log in, Choose here a local path on your computer. The Installation Folder URL is the URL, where the ClickOnce Application is looking for Updates. This is the Url on the Server where you have to copy all the Files from the Publish Folder to, if its not the same.
I dont think that there is a free web server you can use. There are a few Services which are quit cheap but as you mentioned, you can use your own Server with XAMPP. I never used XAMPP so i cant help you their
Yes you have to copy your application to the Web Server. Im using WinSCP for that. Be sure to copy the files to the location you have set in the properties. If you are using XAMPP, you may copy the files locally to the XAMPP folder
There are no specific instructions i can mention. You will find everything in the Web. There are some useful articels at CodeProject

How to attach a debugger to an application running on Windows Azure VM?

I have minimal experience with Windows Azure.
I got a VM running, connected to it using remote desktop, pasted my C# executable there.
Then, I installed the Visual Studio remote debugging tools, started it, configured it to allow on authenticated connections from any user, and configured an endpoint to the port it mentioned (4018).
But I can't seem to be able to hook visual studio to the instance. I tried entering the VM address:port but that didn't seem to work.
Is that even possible to do, or must the remote machine be on the same network and not over the internet? Is there any guide explaining the process? Most of what I found were relating to debugging an azure application, but nothing seemed to be about an arbitrary program.
Remote debugging with Visual Studio Remote Debugging tools is not supported through internet - http://msdn.microsoft.com/en-us/library/vstudio/bt727f1t.aspx
So you may have to switch to good old style of writing logs and analysing them.
You can do it. See 'How to debug an Azure Virtual Machine'.
http://msdn.microsoft.com/en-us/library/azure/ff683670.aspx#BK_Debugging_Cloud_Azure
That page also explains how to debug cloud services.
Also with the newer Azure tools versions, if you are running a cloud service, and you enabled the cloud service for debugging, you can actually first debug the cloud service, then you can easily switch to debugging your application by using the 'Debug -> Attach Process' menu item. (You have to set the 'Qualifier' in the dialog to that of the azure VM that you are debugging, then you should see all processes on the Azure VM show up in the attachable process list.)
Have you created a new cloud services for this VM so as to open that port to external? If not, any external clients won't be able to connect.
http://www.windowsazure.com/en-us/manage/windows/how-to-guides/setup-endpoints/
But you might consider install VS in another VM in Azure, as that can make things faster.

Categories