Reputation: 189
Can anyone help us understand why dotnet watch is causing our applications to crash?
I'm using dotnet new mvc and yo aspnetcore-spa to create apps in visual studio code. Both work fine until I try to add a reference to DotNet Watcher tools using example at https://github.com/aspnet/DotNetTools/tree/dev/src/Microsoft.DotNet.Watcher.Tools to insert reference in csproj file:
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" />
</ItemGroup>
After adding to csproj and dotnet restore, the application throws an error and fails and is unrecoverable. It has to be deleted and I have to start from scratch.
Full csproj file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>
netcoreapp1.1
</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" />
</ItemGroup>
</Project>
The error thrown is below and happens no matter where we create the application on disk or what it is named.
Our environment is:
Microsoft .NET Core Shared Framework
Host Version : 1.1.0
Upvotes: 0
Views: 1198
Reputation: 189
Problem solved. An extension named "XML Formatter" was rewriting the csproj file on save and adding hard returns and tabs. Removing this extension, restoring csproj to it's original state, adding back in the DotNetCliToolReference code block and rebuilding via dotnet restore solved the issue.
Upvotes: 1