Question

I'm building ccproj project directly by MSBuild (within TeamCity):

msbuild Project.Azure.ccproj /p:Configuration=Debug /t:Publish

How to enable remote debugger? Like in the UI:

enter image description here

Was it helpful?

Solution 2

This is explained in the Azure documentation.

Basically you should get the remote tools for visual studio 2013 and then add the following properties to the msbuild command:

msbuild /TARGET:PUBLISH /PROPERTY:Configuration=Debug;EnableRemoteDebugger=true;VSX64RemoteDebuggerPath="<path-to-remote-tools>";RemoteDebuggerConnectorCertificateThumbprint="<thumbprint-of-ceritificate-that-is-added-to-the-cloud-service>";RemoteDebuggerConnectorVersion="2.4" "<path-to-solution-file>"

where VSX64RemoteDebuggerPath is a path to the folder that contains `msvsmon.exe in the remote tools for visual studio

OTHER TIPS

I don't think it is available as a command line switch. I did some searching and only found your question here.

If I do a publish, enabling debugging, in VS 2013 Update 1, it creates a temporary .cscfg file in the output directory along with the package to upload (now almost twice as big). The .cscfg file contains some extra settings:

<Setting name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Connector.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Connector.Version" value="2.3" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.ClientThumbprint" value="XXXX" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.ServerThumbprint" value="XXXX" />

Where XXXX is a thumbprint for a certificate created by VS and installed in the certificate store (My local) with a friendly name of RemoteDebuggerZZZZZ.

An updated .csdef file contains the following section under for my webrole:

<Endpoints>
  <InputEndpoint name="HttpIn" protocol="http" port="80" localPort="80" />
  <InputEndpoint name="HttpsIn" protocol="https" port="443" certificate="https" localPort="443" />
  <InstanceInputEndpoint name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Connector" localPort="30398" protocol="tcp">
    <AllocatePublicPortFrom>
      <FixedPortRange min="30400" max="30424" />
    </AllocatePublicPortFrom>
  </InstanceInputEndpoint>
  <InstanceInputEndpoint name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Forwarder" localPort="31398" protocol="tcp">
    <AllocatePublicPortFrom>
      <FixedPortRange min="31400" max="31424" />
    </AllocatePublicPortFrom>
  </InstanceInputEndpoint>
</Endpoints>

And for my worker role:

<Endpoints>
  <InstanceInputEndpoint name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Connector" localPort="30398" protocol="tcp">
    <AllocatePublicPortFrom>
      <FixedPortRange min="30425" max="30449" />
    </AllocatePublicPortFrom>
  </InstanceInputEndpoint>
  <InstanceInputEndpoint name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.Forwarder" localPort="31398" protocol="tcp">
    <AllocatePublicPortFrom>
      <FixedPortRange min="31425" max="31449" />
    </AllocatePublicPortFrom>
  </InstanceInputEndpoint>
</Endpoints>

It also added a certificate section for my worker role:

<Certificates>
  <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.TransportValidation" storeLocation="LocalMachine" storeName="My" />
</Certificates>

.. and added the same certificate for my web role:

<Certificates>
  <Certificate name="https" storeLocation="LocalMachine" storeName="My" />
  <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteDebugger.TransportValidation" storeLocation="LocalMachine" storeName="My" />
</Certificates>

I have manually added the "https" certificate, so that was there before.

It seems the tooling in VS creates a range of ports to access the ports 30398 and 31398 used by the remote debugging tools and adding the "TransportValidation" certificate to the list of certificates.

There are no extra settings or imports added for either role type.

I have yet to find some documentation on this, so if anybody can shed some light, please do!

Hope this helps anyone else trying this out.

We've been able to create different profiles for Azure projects per environment. Then we pass in this:

/p:TargetProfile=Dev 

That way it gets built with the correct Cloud Service profile.

Beyond that, I know I would end up just writing some one-off C# or even a Powershell script to modify the config after build.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top