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

DOCS: Instructions for Microsoft.Build.CopyOnWrite do not adequately explain how to install it #552

Open
simeyla opened this issue Mar 30, 2024 · 2 comments

Comments

@simeyla
Copy link

simeyla commented Mar 30, 2024

The Microsoft.Build.CopyOnWrite MSBuild SDK overrides the native MSBuild Copy task to add support for ReFS and Dev Drive CloneFile (Copy on Write or CoW) on Windows. It is designed to be as backwards compatible as possible and should directly replace all usages of Copy in MSBuild.

That is the introduction to the CopyOnWrite package. However there are no actual instructions on how to use it. I was excited to find out this week about DevDrives and this is the last piece to get the full benefits. There is only a mention of Central Package Management, which personally I've never heard of.

  • Is it as simple as installing the package in my project (.NET Framework and/or .NET Core)?
  • Do I need to install it in all projects?
  • Do I need to change build tasks or anything like that?
  • How do I verify it's working?

Also it would be good to include information about the future update to Windows that will make this package redundant.

@ugumba
Copy link

ugumba commented Apr 29, 2024

The package works silently and automatically in a normal SDK-style project (without CPM), e.g.:

<ItemGroup>
   <PackageReference Include="Microsoft.Build.CopyOnWrite" Version="1.0.315" />
</ItemGroup>

I think you need it in all projects where you want the benefit, so I put it in Directory.Build.props.

You need a sizable solution to notice an obvious improvement, and I spotted the difference by comparing the amount of free space on my Dev Drive before and after. Since each file reference is equal to others, the difference does not show up in "Folder properties - Size" or "Folder properties - Size on disk"! I'm sure there are ways to interrogate the CoW status on individual files (using fsutil or similar tools), but I haven't looked for this.

After a clean of my solution: 455 GB free
After a full build of my solution without the package: 437 GB free
After a full build of my solution with the package: 446 GB free

I also think build times improved somewhat, but I have no clear evidence for this.

@erikmav
Copy link
Collaborator

erikmav commented May 14, 2024

Took awhile but I posted a new blog entry that describes how to determine if a file is a CoW link (block clone). See https://devblogs.microsoft.com/engineering-at-microsoft/?p=910

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

3 participants