4

In version 4.2.27 of postsharp publishing a web project works correct.

When the postsharp nuget package is upgraded to > 4.2.28 the publish fails. It fails when trying to run TransformWebConfigCore in Microsoft.Web.Publishing.targets. The error

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

sowjanya attaluri
  • 903
  • 2
  • 9
  • 27
  • Do you use webconfig transforms? Also you couldcheck in the csproj file if The upgrade went successfull by checking if there are any references to 4.2.27 – Batavia Jul 12 '16 at 05:50

1 Answers1

10

PostSharp 4.2.28 adds Web.config to Content MSBuild ItemGroup automatically. It is the reason why you see web.config twice in the error message:

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

If your csproj contains this element:

<Content Include="Web.config" />

Change Content to None:

<None Include="Web.config" />

Make sure that the web.config file is included after publishing your web project.

Jakub Linhart
  • 4,062
  • 1
  • 26
  • 42
  • is there any reference to the PostSharp Documentation regarding your comment "PostSharp 4.2.28 ..."? The solution works but I am not confident that I fully understand the rationale. IMO, it seems rather hackish (I almost reinstalled my build server because of this error) – Gonzalo Contento Aug 26 '16 at 13:26
  • Thank you so much for this answer. It was driving me crazy trying to find out the solution. I also noticed my SlowCheetah configs weren't working in VS, wonder if Postsharp is responsible for it. – arviman Feb 28 '17 at 10:38