Allow UpToDateReloadFileTypes to be modified by packages (dotnet/aspnetcore-tooling#639)

* Allow UpToDateReloadFileTypes to be modified by packages

* Allow file watching with dotnet-watch
\n\nCommit migrated from fbcd0c2416
This commit is contained in:
Pranav K 2019-06-02 08:44:27 -07:00 committed by GitHub
commit 6be2d3dfcd
3 changed files with 43 additions and 21 deletions

View File

@ -17,7 +17,7 @@ Copyright (c) .NET Foundation. All rights reserved.
Defines the list of file extensions that VS will monitor to reload the application.
We'll only define these for C# projects targeting RazorLangVersion 3.0 or later, and let VS use defaults in other cases.
-->
<UpToDateReloadFileTypes Condition="'$(Language)'=='C#' AND '$(_Targeting30OrNewerRazorLangVersion)' == 'true'">$(UpToDateReloadFileTypes);.cs;.razor;.resx;.cshtml</UpToDateReloadFileTypes>
<UpToDateReloadFileTypes Condition="'$(Language)'=='C#' AND '$(_Targeting30OrNewerRazorLangVersion)' == 'true' AND '$(RazorUpToDateReloadFileTypes)' == ''">$(UpToDateReloadFileTypes);$(RazorUpToDateReloadFileTypes)</UpToDateReloadFileTypes>
</PropertyGroup>
<ItemGroup>

View File

@ -65,6 +65,12 @@ Copyright (c) .NET Foundation. All rights reserved.
<!-- Determines if the refs folder is produced as part of build \ publish -->
<PreserveCompilationReferences>false</PreserveCompilationReferences>
<!--
List of file extensions that will cause VS to restart the application when RazorSDK is effective.
This property affects C# projects targeting 3.0 or later.
-->
<RazorUpToDateReloadFileTypes>.cs;.razor;.resx;.cshtml</RazorUpToDateReloadFileTypes>
</PropertyGroup>
<ItemGroup Condition="'$(EnableDefaultItems)' == 'true' And '$(EnableDefaultContentItems)' == 'true'">

View File

@ -321,6 +321,12 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
<UpToDateCheckBuilt Include="@(RazorIntermediateAssembly)"
Condition="'$(RazorCompileOnBuild)'=='true' AND '@(Content->WithMetadataValue('Extension', '.cshtml'))' != ''" />
<!-- Set up watchers for dotnet-watch -->
<Watch Include="@(Content->WithMetadataValue('Extension', '.razor'))" />
<Watch Include="@(Content->WithMetadataValue('Extension', '.cshtml'))"
Condition="'$(_Targeting30OrNewerRazorLangVersion)' == 'true' AND '$(AddCshtmlFilesToDotNetWatchList)' != 'false'" />
</ItemGroup>
<!--
@ -846,6 +852,16 @@ Copyright (c) .NET Foundation. All rights reserved.
<Import Project="$(RazorDesignTimeTargets)" />
<PropertyGroup>
<!--
Defines the list of file extensions that VS will monitor to reload the application.
We'll only define these for C# projects targeting RazorLangVersion 3.0 or later, and let VS use defaults in other cases.
This property can be removed after the next insertion in to VS.
-->
<UpToDateReloadFileTypes Condition="'$(Language)'=='C#' AND '$(_Targeting30OrNewerRazorLangVersion)' == 'true' AND '$(RazorUpToDateReloadFileTypes)' == ''">$(RazorUpToDateReloadFileTypes)</UpToDateReloadFileTypes>
</PropertyGroup>
<!--
This is a hook to import a set of targets after the Razor targets. By default this is unused.
-->