.NET Core RC 2, TFS, and you in a pickle. “Failed to make the following project runnable” – Access Denied

Can’t touch this

This is basically an issue which is likely to happen (AFAIK) if you’re currently using Server Workspaces in TFS. Due to the size of the solutions and projects I’m working in, changing to a local workspace feels a lot slower. Now, I’ve recently switched some of my projects to .NET Core, and building one of them has yielded the offending error:

Failed to make the following project runnable: aaa.bbb.ccc (.NETFramework,Version=v4.5) reason: Access to the path ‘g:\xxx\yyy\zzz\bin\Release\net45\uvw.dll’ is denied.

This is caused by the fact that those files are marked as “read-only”, which is the default for files in source control that are not checked out.

The simple fix

Since the task that errors out is executed after compilation, this can be easily fixed by creating a post-compile event. So, how do we do this within our new project configuration file, project.json (which is also soon to be dead), is rather trivial. Create a cmd file with the following command, and place it in the project root (or wherever, really):

attrib -r bin\*.* /s

(I’m assuming you’re using Windows, but I believe that you could use a similar approach if you had this problem in another OS)

Then add the file to your project.json file as a postcompile event:

    "scripts": { "postcompile": "postcompile.cmd" }

And voilà, no errors.

The extra fix

Except it fails again! What could possibly be happening? If this does happen, then the other thing you need to do is check the folders where your packages are stored. Remove the “read-only” attribute from the whole folder and you’re good to go. Nuget packages used to go on your local solution folder (solution\packages), but you can find them now at “%userprofile%\.nuget\packages” (just paste this on windows explorer).

And voilà, no errors.


2 thoughts on “.NET Core RC 2, TFS, and you in a pickle. “Failed to make the following project runnable” – Access Denied

Leave a Reply to D.Ali Keskin (@kesali) Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s