0
votes

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.

  • C:\Program Files\dotnet\sdk\1.0.1\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\Microsoft.NET.Sdk.Publish.targets(90,5): error MSB4184: The expression "[System.IO.Path]::GetFullPath(C:\test\obj\Debug\ [C:\test\test.csproj]
  • C:\Program Files\dotnet\sdk\1.0.1\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\Microsoft.NET.Sdk.Publish.targets(90,5): error MSB4184: netcoreapp1.1 [C:\test\test.csproj]
  • C:\Program Files\dotnet\sdk\1.0.1\Sdks\Microsoft.NET.Sdk.Publish\build\netstandard1.0\Microsoft.NET.Sdk.Publish.targets(90,5): error MSB4184: \PubTmp)" cannot be evaluated. Illegal characters in path. Parameter name: path [C:\test\test.csproj]

Our environment is:

  • .NET Command Line Tools (1.0.1)
  • Microsoft .NET Core Shared Framework

  • Host Version : 1.1.0

  • Build: 928f77c4bc3f49d892459992fb6e1d5542cb5e86
  • Visual Studio Code v 1.10.2
  • Windows 10
1
I've narrowed it down to a VS Code extension causing the issue. I disabled all installed extensions via code --disable-extensions in CLI and attempted a new build using yo aspnetcore-spa . Doing this allowed me to modify the csproj file, build and run successfully. I'll narrow it down to which extension is causing the issue and add a comment.bobbyK12
You probably should provide an answer, and fire an bug report.VMAtm
Thanks VMAtm - I've submitted a bug report to the extension developer. I still have apprx 21 hours before StackOverflow will allow me to accept my answer below as the accepted answer. I'll do so as soon as the system allows it. Thanks again!bobbyK12

1 Answers

1
votes

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.