Skip to content

Commit b5debfb

Browse files
committed
通过复制输出文件快速调试项目
1 parent 8ec48ae commit b5debfb

4 files changed

Lines changed: 59 additions & 0 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project>
2+
<Target Name="CopyOutputLibToFastDebug" AfterTargets="AfterBuild"
3+
Condition="$(MainProjectPath)!=''">
4+
<ItemGroup>
5+
<OutputFileToCopy Include="$(OutputPath)$(AssemblyName).dll"></OutputFileToCopy>
6+
<OutputFileToCopy Include="$(OutputPath)$(AssemblyName).pdb"></OutputFileToCopy>
7+
</ItemGroup>
8+
<Copy SourceFiles="@(OutputFileToCopy)" DestinationFolder="$(MainProjectPath)"></Copy>
9+
</Target>
10+
</Project>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Project>
2+
<Import Project="..\build\dotnetCampus.UsingMSBuildCopyOutputFileToFastDebug" />
3+
</Project>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0"?>
2+
<package >
3+
<metadata>
4+
<id>dotnetCampus.UsingMSBuildCopyOutputFileToFastDebug</id>
5+
<title>Using MSBuild Copy Output File To Fast Debug</title>
6+
<version>1.0.0</version>
7+
<authors>dotnet-campus</authors>
8+
<owners>dotnet-campus</owners>
9+
<license type="expression">MIT</license>
10+
<projectUrl>https://github.com/dotnet-campus/UsingMSBuildCopyOutputFileToFastDebug</projectUrl>
11+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12+
<description>Using MSBuild Copy Output File To Fast Debug
13+
通过复制输出文件让 VisualStudio 外部启动快速调试底层库</description>
14+
<releaseNotes></releaseNotes>
15+
<copyright>Copyright 2019</copyright>
16+
<tags>msbuild debug</tags>
17+
<dependencies>
18+
<group targetFramework=".NETFramework4.0" />
19+
<group targetFramework=".NETCoreApp2.0">
20+
</group>
21+
</dependencies>
22+
</metadata>
23+
</package>

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Roslyn 让 VisualStudio 急速调试底层库方法
2+
3+
在一个大项目里面调试底层库经常需要重新编译整个项目,本项目提供了在底层库编译完成之后将输出文件复制到主项目的输出文件夹,通过外部项目调试的方式提高调试效率
4+
5+
[![](https://img.shields.io/nuget/v/dotnetCampus.UsingMSBuildCopyOutputFileToFastDebug.svg)](https://www.nuget.org/packages/dotnetCampus.UsingMSBuildCopyOutputFileToFastDebug)
6+
7+
使用方法
8+
9+
1. 在需要调试的底层库项目安装 NuGet 库 [dotnetCampus.UsingMSBuildCopyOutputFileToFastDebug](https://www.nuget.org/packages/dotnetCampus.UsingMSBuildCopyOutputFileToFastDebug)
10+
11+
1. 编辑底层库项目的 csproj 文件,添加下面代码
12+
13+
```csharp
14+
<PropertyGroup>
15+
<MainProjectPath>主项目的输出文件夹</MainProjectPath>
16+
</PropertyGroup>
17+
```
18+
19+
1. 通过右击底层库属性,点击调试,设置为可执行文件,路径修改为主项目的启动程序。就可以在底层库点击调试运行主项目调试,同时支持打断点和进行二进制兼容的更改
20+
21+
请注意 主项目的输出文件夹 的路径最后使用 `\` 结束,如 `C:\lindexi\doubi\` 如果是将底层库放在其他文件夹,请将 主项目的输出文件夹 修改为实际的文件夹
22+
23+
关于二进制兼容请看 [VisualStudio 通过外部调试方法快速调试库代码](https://blog.lindexi.com/post/visualstudio-%E9%80%9A%E8%BF%87%E5%A4%96%E9%83%A8%E8%B0%83%E8%AF%95%E6%96%B9%E6%B3%95%E5%BF%AB%E9%80%9F%E8%B0%83%E8%AF%95%E5%BA%93%E4%BB%A3%E7%A0%81 )

0 commit comments

Comments
 (0)