I recently upgraded a project from Visual Studio 2010 / .NET4.0 to Visual Studio 2013 (update 4) / .NET 4.5.
Code that was working for weeks, didn’t work anymore (exceptions in Caliburn.Micro).
I reinstalled all my Nuget packages, verified the public key tokens of the libraries via the Strong Name Tool (SN.exe -T my.dll), did “Clean Solution”, “Rebuild Solution”, rewritten code, etc…
In a desperate action I manually cleaned every bin and obj folder in my Workspace.
After this action the code started to work again.
Then I was wondering: Does the “Clean Solution” in Visual Studio 2013 work different compared to Visual Studio 2010.
An internet stranger gave me a good hint:
“Sorry, but this is simply not true. It does not delete the contents of /obj which are the root of the problem. At least this is the situation with VS 2013 update 3.”
After searching some more, I was happy that I was not the only one who had problems with Visual Studio 2013 and the Clean Solution:
“However, once I’ve converted my projects to Visual Studio 2013 I star receiving error on build or deploy:”
Conclusion: if you upgrade to Visual Studio 2013 and receive strange exceptions, clean the obj directories manually or change your project file to remove the obj directory before each build via the BaseIntermediateOutputPath property/parameter.
By default the BeforeBuild and AfterBuild are not used. You can see this by unloading your project in Visual Studio and then right-mouse click it and select Edit:
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> -->
Uncomment the BeforeBuild.
Your project file should now contain this:
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. --> <Target Name="BeforeBuild"> <RemoveDir Directories="$(BaseIntermediateOutputPath)" /> </Target> <!--<Target Name="AfterBuild"> </Target>-->
Information on the BaseIntermediateOutputPath property/parameter:
“The top-level folder where all configuration-specific intermediate output folders are created. The default value is obj\. The following code is an example: <BaseIntermediateOutputPath>c:\xyz\obj\</BaseIntermediateOutputPath>”
If you receive the Error after changing the project:
Unable to remove directory “obj\”. The directory is not empty
Go have a look at this url: http://forums.asp.net/t/1976253.aspx
It might also be related to Visual Studio 2013…