c# - 为什么 postsharp 导致 web 项目发布失败?

标签 c# postsharp

在 postsharp 版本 4.2.27 中,发布 web 项目工作正常。

当 postsharp nuget 包升级到 > 4.2.28 时,发布失败。尝试在 Microsoft.Web.Publishing.targets 中运行 TransformWebConfigCore 时失败。错误

Microsoft.Web.Publishing.targets(1483,5): Error : Could not open Source file: Could not find file '[Project Location]\Web.config;web.config'.

最佳答案

PostSharp 4.2.28 自动将 Web.config 添加到 Content MSBuild ItemGroup。这就是您在错误消息中看到两次 web.config 的原因:

Microsoft.Web.Publishing.targets(1483,5): Error : Could not open Source file: Could not find file '[Project Location]\Web.config;web.config'.

如果您的 csproj 包含此元素:

<Content Include="Web.config" />

Content更改为None:

<None Include="Web.config" />

确保在发布 Web 项目后包含 web.config 文件。

关于c# - 为什么 postsharp 导致 web 项目发布失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38303587/

相关文章:

c# - PostSharp 和 Visual Studio 代码覆盖率

c# - 多播 OnExceptionAspect 正在记录冒泡异常

PostSharp OnExceptionAspect 未按预期工作

c# - Tesseract ocr PDF 作为输入

c# - 尝试连接到远程地址数据库时出现超时错误

c# - 有些键盘比其他键盘更啰嗦吗?

c# - Postsharp OnException 方面未按预期工作

c# - 如何将 json 反序列化为属性名称开头为 "@"的 C# 对象?

c# Reflection - 查找集合的通用类型

c# - 安装 PostSharp 后如何打开带有控制点的常规弹出菜单