简体   繁体   中英

Debugging multiple projects in a single solution

Is there any way around the issue of a debugger being raised for each project in a solution when debugging with PostSharp? Currently I have 14 projects in my solution and trying to debug just one of them with PostSharp seems to be very difficult because a debugger attach window pops up for each project in the solution. If I choose to attach to the wrong debugger process the breakpoint I have set does not get hit and then, when it starts building the next project it pops up another window which does not have my active VS instance in it. Is there a flag on msbuild I can use to say "use the same debugger process for all requirements of a debugger process" or something to that effect?

As I understand, you're debugging the compile-time logic of your aspect following the steps from the PostSharp documentation .

When you set the "attach debugger" property on the command-line, as shown below, the property will be set for all the projects involved in the build. And so the attaching to the debugger is invoked for each of those projects.

msbuild MyAspects.Test.csproj /T:Rebuild /P:PostSharpAttachDebugger=True

What you can do instead, is to set the property only for one project where you need it, by temporarily editing the *.csproj file:

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PostSharpAttachDebugger>True</PostSharpAttachDebugger>
    <!-- ... -->
  </PropertyGroup>

If you don't want to edit the *.csproj directly, then you can put PostSharp.Custom.targets file in the project's directory, and define the property in that file.

<? xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PostSharpAttachDebugger>True</PostSharpAttachDebugger>
  </PropertyGroup>
</Project>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM