Update dotnet-watch README.md

This commit is contained in:
Nate McMaster 2016-10-31 14:28:14 -07:00
parent 4698985846
commit 7afad9102f
1 changed files with 31 additions and 20 deletions

View File

@ -4,6 +4,8 @@ dotnet-watch
### How To Install ### How To Install
**project.json**
Add `Microsoft.DotNet.Watcher.Tools` to the `tools` section of your `project.json` file. Add `Microsoft.DotNet.Watcher.Tools` to the `tools` section of your `project.json` file.
Use the version "1.0.0-preview2-final" if you are using .NET Core 1.0.0 and use "1.0.0-preview3-final" if you are using .NET Core 1.1.0. Use the version "1.0.0-preview2-final" if you are using .NET Core 1.0.0 and use "1.0.0-preview3-final" if you are using .NET Core 1.1.0.
@ -18,18 +20,28 @@ Use the version "1.0.0-preview2-final" if you are using .NET Core 1.0.0 and use
} }
``` ```
**MSBuild**
Install `Microsoft.DotNet.Watcher.Tools` as a `DotNetCliReference` to your project.
```xml
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0-rc1-final" />
</ItemGroup>
```
### How To Use ### How To Use
dotnet watch [-?|-h|--help] dotnet watch [-?|-h|--help]
dotnet watch [options] [[--] <dotnet arguments>...] dotnet watch [options] [[--] <args>...]
Options: Options:
-?|-h|--help Show help information -?|-h|--help Show help information
-q|--quiet Suppresses all output except warnings and errors -q|--quiet Suppresses all output except warnings and errors
-v|--verbose Show verbose output -v|--verbose Show verbose output
Add `watch` after `dotnet` in the command that you want to run: Add `watch` after `dotnet` and before the command arguments that you want to run:
| What you want to run | Dotnet watch command | | What you want to run | Dotnet watch command |
| ---------------------------------------------- | -------------------------------------------------------- | | ---------------------------------------------- | -------------------------------------------------------- |
@ -50,27 +62,13 @@ Some configuration options can be passed to `dotnet watch` through environment v
dotnet-watch can be configured from the MSBuild project file being watched. dotnet-watch can be configured from the MSBuild project file being watched.
**Project References**
By default, dotnet-watch will scan the entire graph of project references and watch all files within those projects.
dotnet-watch will ignore project references with the `Watch="false"` attribute.
```xml
<ItemGroup>
<ProjectReference Include="..\ClassLibrary1\ClassLibrary1.csproj" Watch="false" />
</ItemGroup>
```
**Watch items** **Watch items**
dotnet-watch will watch all items in the "<kbd>Watch</kbd>" item group. dotnet-watch will watch all items in the **Watch** item group.
By default, this group inclues all items in "<kbd>Compile</kbd>" and "<kbd>EmbeddedResource</kbd>". By default, this group inclues all items in **Compile** and **EmbeddedResource**.
More items can be added to watch in a project file by adding items to 'Watch'. More items can be added to watch in a project file by adding items to 'Watch'.
Example:
```xml ```xml
<ItemGroup> <ItemGroup>
<!-- extends watching group to include *.js files --> <!-- extends watching group to include *.js files -->
@ -86,7 +84,20 @@ Example:
<ItemGroup> <ItemGroup>
<!-- exclude Generated.cs from dotnet-watch --> <!-- exclude Generated.cs from dotnet-watch -->
<Compile Include="Generated.cs" Watch="false" /> <Compile Include="Generated.cs" Watch="false" />
<EmbeddedResource Include="Generated.cs" Watch="false" /> <!-- exclude Strings.resx from dotnet-watch -->
<EmbeddedResource Include="Strings.resx" Watch="false" />
</ItemGroup>
```
**Project References**
By default, dotnet-watch will scan the entire graph of project references and watch all files within those projects.
dotnet-watch will ignore project references with the `Watch="false"` attribute.
```xml
<ItemGroup>
<ProjectReference Include="..\ClassLibrary1\ClassLibrary1.csproj" Watch="false" />
</ItemGroup> </ItemGroup>
``` ```
@ -100,6 +111,6 @@ Example:
```xml ```xml
<ItemGroup Condition="'$(DotNetWatchBuild)'=='true'"> <ItemGroup Condition="'$(DotNetWatchBuild)'=='true'">
<!-- design-time only items --> <!-- only included in the project when dotnet-watch is running -->
</ItemGroup> </ItemGroup>
``` ```