使用调试配置时 PostSharp 构建目标未运行
我已经设置了一个 Visual Studio 项目,我已对其进行编辑以引用 PostSharp 构建目标。我没有使用已安装的 MSI 在我的开发计算机上安装 PostSharp。
我遇到的问题是,仅当我将构建配置更改为“发布”时才执行 PostSharp 目标,而不是在“调试”中执行。
我可以通过查看构建输出来验证这一点,其中包括发布时的行:
PostSharp 1.5 [1.5.6.627] - Copyright (c) Gael Fraiteur, 2005-2009.
查看项目文件,我没有看到任何明显的迹象表明 PostSharp 将使用一种配置运行,而不是另一种配置。如何配置 PostSharp 在调试和发布配置期间运行?请记住,我宁愿避免使用安装程序。
Karl
编辑 csproj 片段,出现在文件底部
下方:
<PropertyGroup>
<DontImportPostSharp>True</DontImportPostSharp>
<PostSharpDirectory>..\..\tools\postsharp-1.5.6.629</PostSharpDirectory>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(PostSharpDirectory)\PostSharp-1.5.targets" />
I have setup a Visual Studio project that I have edited to reference the PostSharp build targets. I did not use the MSI installed to install PostSharp on my development machine.
The problem that I am having is that the PostSharp Targets are only executed when I change the build configuration to 'Release', but not in 'Debug'.
I can verify this by looking at the build output which includes the line when in Release:
PostSharp 1.5 [1.5.6.627] - Copyright (c) Gael Fraiteur, 2005-2009.
Looking at the project file, I do not see anything obvious that would suggest PostSharp would run with one configuration and not the other. How can I configure PostSharp to run during both Debug and Release configuration? Keeping in mind, I would rather avoid using the installer.
Karl
EDIT csproj snippent, appears at the bottom of file, below <ItemGroup>
:
<PropertyGroup>
<DontImportPostSharp>True</DontImportPostSharp>
<PostSharpDirectory>..\..\tools\postsharp-1.5.6.629</PostSharpDirectory>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(PostSharpDirectory)\PostSharp-1.5.targets" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看导入 PostSharp.targets 的项目文件中
元素的位置。项目文件中通常有三个
元素。一种用于常规设置,一种用于仅调试设置,一种用于仅发布设置。如果
元素位于 Release 组中,则移动它,它应该出现在 Microsoft.CSharp.targets 的 Import 元素之后。Look at the location of the
<Import>
element in the project file that imports PostSharp.targets. There are normally three<PropertyGroup>
elements in the project file. One for general settings, one for Debug only settings and one for Release only settings. Move the<Import>
element if it is in the Release group, it should appear after the Import element for Microsoft.CSharp.targets.