0

In .NET 6, it is possible to use the dotnet cli this way:

dotnet watch --project DotNetWatch.msbuild MyWebApplication.dll

where DotNetWatch.msbuild contains an ItemGroup with the Watch files, for example:

<Project>
    <ItemGroup>
        <Watch Include="*.json" />
    </ItemGroup>
</Project>

The same command doesn't work in .NET 8 because it attempts to execute DotNetWatch.msbuild instead of MyWebApplication.dll.

This is the output in .NET 8:

dotnet watch  Started
Unable to run your project.
Ensure you have a runnable project type and ensure 'dotnet run' supports this project.
A runnable project should target a runnable TFM (for instance, net5.0) and have OutputType 'Exe'.
The current OutputType is 'Library'.
dotnet watch ❌ Exited with error code 1

Is there any chance this issue will be fixed? I'm aware that I can modify the command to use 'dotnet watch run --project MyWebApplication.csproj' and include the Watch itemGroup in MyWebApplication.csproj, but I'd like to confirm if this is a known compatibility issue before making the change.

I tested with 8.0.100-preview.5.23303.2 and 8.0.100-preview.3.23178.7. The same thing happens with both.

0 Answers0