Skip to content

Commit e773c6b

Browse files
committed
update README
1 parent 9334647 commit e773c6b

File tree

1 file changed

+78
-11
lines changed

1 file changed

+78
-11
lines changed

README.md

+78-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
# Project
1+
# Microsoft.MSBuildCache
22

3-
> This repo has been populated by an initial template to help get you started. Please
4-
> make sure to update the content to build a great experience for community-building.
5-
6-
As the maintainer of this project, please make a few updates:
7-
8-
- Improving this README.MD file to provide a great experience
9-
- Updating SUPPORT.MD with content about this project's support experience
10-
- Understanding the security reporting process in SECURITY.MD
11-
- Remove this section from the README
3+
The overarching effort for MSBuildCache is an evolution of the [MSBuild Project Cache](https://github.com/dotnet/msbuild/blob/main/documentation/specs/project-cache.md) to enable the "cache add" scenarios. MSBuildCache is a plugin implementation which takes advantage of this.
124

135
## Contributing
146

@@ -24,10 +16,85 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
2416
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
2517
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
2618

19+
20+
### Setup
21+
22+
It is assumed that you are using VS v17.8.0-pre.3.0 or later.
23+
24+
### Building
25+
26+
#### Using a custom MSBuild (optional)
27+
28+
Clone the [MSBuild repo](https://github.com/dotnet/msbuild) as a sibling of the MSBuildCache repo.
29+
30+
Build the msbuild repo:
31+
```
32+
..\msbuild\build.cmd /p:CreateBootstrap=true /p:Configuration=Release
33+
```
34+
Note, MSBuild only needs to built once each time you update MSBuild, not every time you want to build MSBuildCache.
35+
36+
The path to MSBuild is: `..\msbuild\artifacts\bin\bootstrap\net472\MSBuild\Current\Bin\amd64\MSBuild.exe`.
37+
38+
#### Building MSBuildCache
39+
40+
You can build `MSBuildCache.sln` and/or open it in VS.
41+
42+
### Testing
43+
44+
#### Running
45+
46+
Ensure you've built MSBuildCache as described above.
47+
48+
Now add the following in the repo you're testing with in their `NuGet.config`
49+
50+
```xml
51+
<add key="MSBuildCache" value="..\MSBuildCache\artifacts\Debug\Microsoft.MSBuildCache" />
52+
```
53+
54+
The path may need to be adjusted based on the repo and where you have MSBuildCache cloned.
55+
56+
Finally add a `PackageReference` to MSBuildCache to the repo you're testing with version `*-*` to ensure the latest gets picked up. This may look different from repo to repo but here is an example:
57+
58+
```xml
59+
<PackageReference Include="Microsoft.MSBuildCache" VersionOverride="*-*" IncludeAssets="Analyzers;Build;BuildMultitargeting;BuildTransitive" PrivateAssets="All" />
60+
```
61+
62+
**NOTE!** Because you're using a locally built package, you may need to clear it from your package cache after each iteration via a command like `rmdir /S /Q %USERPROFILE%\.nuget\packages\Microsoft.MSBuildCache`. Additionally, to ensure you're not using the head version of the package, you may need to create a branch and a dummy commit locally to ensure the version is higher.
63+
64+
**NOTE!** MSBuildCache currently does not handle incremental builds well! The current target scenario is for CI environments, so **it's expected that the repo is always clean before building**. The main reason for this gap is the same as QuickBuild: file probes and directory enumerations are not considered.
65+
66+
To enable file reporting via detours in MSBuild, ensure `/graph` and `/reportfileaccesses` are used. The latter is new as of these unmerged MSBuild changes.
67+
68+
Example of a set of commands to test MSBuildCache e2e in some repo:
69+
70+
```
71+
rmdir /S /Q %USERPROFILE%\.nuget\packages\Microsoft.MSBuildCache
72+
git clean -fdx
73+
restore
74+
<path-to-msbuild> /graph /restore:false /m /nr:false /reportfileaccesses
75+
```
76+
77+
Example of a set of commands to test MSBuildCache e2e in a subdirectory of some repo:
78+
79+
```
80+
rmdir /S /Q %USERPROFILE%\.nuget\packages\Microsoft.MSBuildCache
81+
pushd <repo-root>
82+
git clean -fdx
83+
popd
84+
restore
85+
<path-to-msbuild> /graph /restore:false /m /nr:false /reportfileaccesses
86+
```
87+
88+
#### Settings
89+
90+
There is a built-in mechanism to passing settings to a plugin, which is to add metadata to the `ProjectCachePlugin` item. This is then exposed to the plugin via the `CacheContext` during initialialization.
91+
92+
To add additional setting, add it to `PluginSettings` and `src\MSBuildCache\build\MicrosoftMSBuildCache.targets`. For naming convensions, follow what you see but the gist is that the property name should be the setting name prefixed by "MSBuildCache".
93+
2794
## Trademarks
2895

2996
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
3097
trademarks or logos is subject to and must follow
3198
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
3299
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
33-
Any use of third-party trademarks or logos are subject to those third-party's policies.
100+
Any use of third-party trademarks or logos are subject to those third-party's policies.

0 commit comments

Comments
 (0)