Octopack including StyleCop.cache file

I’m having a weird issue with OctoPack and StyleCop. I have StyleCop tied into my msbuild process. I’m trying to add OctoPack into the mix so I can create a deployment package. What I’m running into is that OctoPack is including a StyleCop.cache file in the package which I don’t want.

I’m trying to figure out where it is coming from as that file is not part of the project and is just a temporary file StyleCop creates. I see the file created in the root of the project and not in the bin directory so it seems weird OctoPack would find it. However I haven’t been able to confirm it doesn’t temporarily get created in the bin folder and then deleted faster than I notice.

My question is really is there a way to force octopack to not include a file? Also should it be grabbing files from the root of the project even if they aren’t included in the project and thus have no properties like copy to output directory?



Hi Bryan,

Thanks for getting in touch. That sounds like an odd one.

A few questions, are you using OctoPack to generate the nuspec file or do you already have one there ?
Are you able to attach your csproj file and find the nuspec file in your build folder (it should be in obj\octopacking). We can make this thread private if you have concerns.



I created a sample solution/project to repo the problem. I’ve attached a zip file with everything in it including the OctoPackTest.nuspec. Looking at it you can see it explicitly includes the StyleCop.cache file even though that is not in the project file. I’m wondering how it is picking that up.

I setup the solution to do a nuget restore and excluded the packages to keep space down.

Any ideas on how I can prevent the StyleCop.cache from being added would be appreciated.

OctoPack.zip (521 KB)

Hi there,

Thanks so much for the repro! This was interesting but I have a solution for you.

OctoPack works by looking in the project at build time, determining what is going to the output directory and bundling those files. The StyleCop package changes that build output at build time to put a cache in it.

The solution is an msbuild argument /p:StyleCopCacheResults=false (which is fine as part of your build process because you’re probably doing a clean before a build anyway) which suppresses that cache being generated.

Hope that helps.


That makes sense. I was struggling trying to figure out how it was getting in there.

Thanks for the solution, works great. I had tried disabling the cache in the settings file but it wasn’t doing what I needed. That property though did the trick.