3

i am using postsharp in my project. when i am trying to build the solution i am getting following error . "The "PostSharp.MSBuild.PostSharp30DetectNativeFrameworkVersion" task could not be loaded from the assembly C:\ProgramData\PostSharp\3.1.49\bin.Release\PostSharp.MSBuild.v3.1.49.Release.dll. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask."

How to resolve this?

thank you

user3883423
  • 247
  • 5
  • 19
  • It's possible that PostSharp has not been added correctly to the project. You can try to re-install the PostSharp NuGet package. Also check in the *.csproj file that the assembly reference and "import" element refer to the same version of PostSharp. – AlexD Mar 04 '16 at 17:55

1 Answers1

0

I had that exact problem just now. The last thing I changed was adding a post-build event (copy of .dll and .pdb to another directory).

I didn't 'connect' those two events at first, I'm still not sure if there ever was a connection, and instead checked if the PostSharp.MSBuild.v{version}.Release.dll existed - which it didn't in my case. I removed the PostSharp NuGet package from all projects, deleted the package directory and re-installed the package. After that the PostSharp.MSBuild.v{version}.Release.dll did exist but that didn't fix the problem.

I remebered that I had added a postbuild copy event and removed and I restarted my IDE. Only after doing both of those things did I try to build the solution again - which worked.

I added the postbuild event again and hit rebuild which worked as well. So I'm not entirely sure if the problem could've been solved by re-installing the NuGet package and restarting Visual Studio or if there was a problem with the postbuild copy command.

Steffen Winkler
  • 2,805
  • 2
  • 35
  • 58