Octopack target seems to lock output file

Hello!
I have a problem with octopack.
For each project I’ve added to csproj file:

  <PropertyGroup>
    <RunOctoPack>true</RunOctoPack>
    <OctoPackPublishPackageToFileShare>..\..\octopus-packages</OctoPackPublishPackageToFileShare>
 </PropertyGroup>

Then I run build project first time - everything is ok. But when I run rebuild, I’ve got errors:

>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4604,5): warning MSB3061: Unable to delete file "C:\dev\Truedom\src\Migrator\bin\Debug\Migrator.exe". Access to the path 'C:\dev\Truedom\src\Migrator\bin\Debug\Migrator.exe' is denied.

>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(3813,5): warning MSB3026: Could not copy "obj\Debug\Migrator.exe" to "bin\Debug\Migrator.exe". Beginning retry 1 in 1000ms. The process cannot access the file 'bin\Debug\Migrator.exe' because it is being used by another process.
...
and so on

I’ve ran Process Explorer and It seems that this file by MSBuild (see picture).
When I run build without OctoPack target - everything is ok.

Could you help me to fix this issue?
Thank you.

PS I use VS 2015, Resharper 10

Hi Artem,

Thanks for getting in touch! I was able to reproduce your problem and a fix for it will be available soon. You can track the progress of it here: https://github.com/OctopusDeploy/Issues/issues/2556.

Please let me know if this doesn’t solve your problem.

Pawel