Merge pull request #25256 from dotnet/prkrishn/dotnet-watch

Allow dotnet watch to refresh on changes to .razor files in reference…
This commit is contained in:
Artak 2020-08-28 20:23:59 -07:00 committed by GitHub
commit f891c2b15d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 6 deletions

View File

@ -78,6 +78,11 @@ Copyright (c) .NET Foundation. All rights reserved.
This property affects C# projects targeting 3.0 or later.
-->
<RazorUpToDateReloadFileTypes>.cs;.razor;.resx;.cshtml</RazorUpToDateReloadFileTypes>
<!--
Target used by dotnet-watch to resolve additional items.
-->
<CustomCollectWatchItems>$(CustomCollectWatchItems);_RazorSdkCustomCollectWatchItems</CustomCollectWatchItems>
</PropertyGroup>
<ItemGroup Condition="'$(EnableDefaultItems)' == 'true' And '$(EnableDefaultContentItems)' == 'true'">

View File

@ -327,12 +327,6 @@ Copyright (c) .NET Foundation. All rights reserved.
-->
<UpToDateCheckBuilt Include="@(RazorIntermediateAssembly)"
Condition="'$(RazorCompileOnBuild)'=='true' AND '@(Content->WithMetadataValue('Extension', '.cshtml'))' != ''" Set="RazorViews" />
<!-- 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>
<!--
@ -870,6 +864,15 @@ Copyright (c) .NET Foundation. All rights reserved.
</PropertyGroup>
</Target>
<Target Name="_RazorSdkCustomCollectWatchItems">
<ItemGroup>
<Watch Include="%(Content.FullPath)" Condition="'%(Content.Extension)' == '.razor' AND '%(Content.Watch)' != 'false'" />
<Watch Include="%(Content.FullPath)" Condition="'%(Content.Extension)' == '.razor.css' AND '%(Content.Watch)' != 'false'" />
<Watch Include="%(Content.FullPath)"
Condition="'$(_Targeting30OrNewerRazorLangVersion)' == 'true' AND '$(AddCshtmlFilesToDotNetWatchList)' != 'false' AND '%(Content.Extension)' == '.cshtml' AND '%(Content.Watch)' != 'false'" />
</ItemGroup>
</Target>
<PropertyGroup Condition="'$(RazorDesignTimeTargets)'==''">
<RazorDesignTimeTargets>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Razor\Microsoft.NET.Sdk.Razor.DesignTime.targets</RazorDesignTimeTargets>
<RazorDesignTimeTargets Condition="!Exists('$(RazorDesignTimeTargets)')">$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.Razor.DesignTime.targets</RazorDesignTimeTargets>

View File

@ -41,6 +41,7 @@ Returns: @(Watch)
</_CollectWatchItemsDependsOn>
<_CollectWatchItemsDependsOn Condition=" '$(TargetFramework)' != '' ">
_CoreCollectWatchItems;
$(CustomCollectWatchItems);
</_CollectWatchItemsDependsOn>
</PropertyGroup>

View File

@ -0,0 +1 @@
.net