MSBuild EnsureOctoPackImported Target

I am looking at the msbuild target that is in my csproj file and it seems it is wrong. How can you have two conditions that negate each other. I always get one of the errors when I build.



The problem is with the Exists statements. One is !Exists and the other is Exists for the same file location.

This has only started to happen as I have upgraded to v3 of Octopack.


Hi Matt,

Thanks for getting in touch! These targets do negate each other. But they are in an over all wrapper that sets OctoPackImported first.
If it doesn’t find OctoPack imported, it then checks if the file exists, and if it doesn’t, you need to install it, if it is installed then it wasn’t properly built.
We believe this is where it is failing, it is not finding OctoPack as a package.
What Build Server are you using? Try restoring your packages before the build to see if it remedies the problem of Octopack not being found.

Let me know how this goes!

My Problem was that the below line was missing.



It may have gone missing when I upgraded to v3 not sure, but it disappeared. I must admit the code is confusing. You may want to revisit how you are doing this as to not confuse people in the future.