Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Remove ReadOnly-Attribute" method #6

Open
robertmuehsig opened this issue Jul 20, 2016 · 0 comments
Open

Add "Remove ReadOnly-Attribute" method #6

robertmuehsig opened this issue Jul 20, 2016 · 0 comments

Comments

@robertmuehsig
Copy link

I raise this issue as a result of a gitter discussion.

My scenario: I have a couple of .config files checked in the source control (TFS VC), which needs to be replaced (or re-generated) before I invoke MSBuild.
I use "DeleteFiles" and/or "CleanDirectories" for this kind of stuff from Cake, but both will fail because they refuse to delete "read-only" protected files.

Gary told me that this behavior is by design and is in most cases the logical choice. He pointed me to the FileHelper addin - maybe this would be a good place for this kind of functionality.

My current workaround is trivial:

public void EnsureFileIsWritable(string filePath)
{
    System.IO.File.SetAttributes(filePath, FileAttributes.Normal);
}

If you are interested in a PR just let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant