How can I stop asp.net from blocking access to files then throwing access denied errors on build?
<p>I repeatedly get build errors along the lines of the following:</p>

<blockquote>
  <p>Failed to make the following project runnable:
  &lt;<strong><em>project name</em></strong>>(.NETFramework,Version=v4.6.1) reason: Access to the path 'C:\&lt;<strong><em>path from root</em></strong>>\src\&lt;<strong><em>project name</em></strong>>\bin\Debug\net641\win7-64x\&lt;<strong><em>some dll, exe, config, whatever</em></strong>>' is denied.</p>
</blockquote>

<p>I was getting similar errors from other folders but taking them out of source control helped (see below)</p>

<p>Sometimes manually going to the folder in Explorer > right click > properties > uncheck "read only" works for a successful build but then either VS or TFS locks the file again and the same build error returns</p>

<p>In particular at the moment there are two .dll files being added to the bin which are repeatedly set to "read only" and I have to manually fix that in file explorer upon rebuild. AFAIK these are not in source control, but the files in another project within the solution by the same name are checked in and not changing.</p>

<p>It may have something to do with the fact I'm using <strong><em>asp.net Core RC2</em></strong> which is not official yet, plus I'm pairing it with <strong><em>Angular 2 RC1</em></strong> but I don't think that's related.</p>

<p>One theory is that it has something to do with TFS since the errors don't seem to start until I put the project under source control.</p>

<p>I've seen a number of similar questions on Stack Overflow but no answers that even begin to resolve my own repetitive problem.</p>

<p>HINT: I was getting the same with transpiled .ts > .js files and taking them out of source control seems to have helped but I don't see the bin folder in source control at all (of course it's hidden in the solution explorer and I see no option to unhide in source control explorer, so not sure if it's there at all...)</p>