Don't publish the refs directory when the app does not have any Razor files
Fixes https://github.com/aspnet/Razor/issues/2246
This commit is contained in:
parent
6d9df1ef33
commit
9365fcd053
|
|
@ -492,17 +492,21 @@ Copyright (c) .NET Foundation. All rights reserved.
|
||||||
<ItemGroup Condition="'$(CopyRazorGenerateFilesToPublishDirectory)'=='false'">
|
<ItemGroup Condition="'$(CopyRazorGenerateFilesToPublishDirectory)'=='false'">
|
||||||
<ResolvedFileToPublish Remove="%(RazorGenerate.FullPath)"/>
|
<ResolvedFileToPublish Remove="%(RazorGenerate.FullPath)"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target
|
||||||
|
Name="_RazorRemoveRefAssembliesFromPublish"
|
||||||
|
AfterTargets="ComputeRefAssembliesToPublish"
|
||||||
|
Condition="'$(ResolvedRazorCompileToolset)'=='RazorSdk' and '$(RazorCompileOnPublish)'=='true' and '$(CopyRefAssembliesToPublishDirectory)'=='false'">
|
||||||
<!--
|
<!--
|
||||||
The ref assemblies are published whenever PreserveCompilationContext is true, which we expect to be true for
|
The ref assemblies are published whenever PreserveCompilationContext is true, which we expect to be true for
|
||||||
most usages of Razor. There's no setting that excludes just the ref assemblies, so we do it ourselves.
|
most usages of Razor. There's no setting that excludes just the ref assemblies, so we do it ourselves.
|
||||||
-->
|
-->
|
||||||
<ItemGroup Condition="'$(CopyRefAssembliesToPublishDirectory)'=='false'">
|
<ItemGroup>
|
||||||
<ResolvedFileToPublish
|
<ResolvedFileToPublish
|
||||||
Remove="%(ResolvedFileToPublish.Identity)"
|
Remove="%(ResolvedFileToPublish.Identity)"
|
||||||
Condition="'%(ResolvedFileToPublish.RelativePath)'=='$(RefAssembliesFolderName)\%(Filename)%(Extension)'"/>
|
Condition="'%(ResolvedFileToPublish.RelativePath)'=='$(RefAssembliesFolderName)\%(Filename)%(Extension)'"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="_CheckForMissingRazorCompiler" Condition="'$(IsRazorCompilerReferenced)' != 'true'">
|
<Target Name="_CheckForMissingRazorCompiler" Condition="'$(IsRazorCompilerReferenced)' != 'true'">
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,9 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||||
Assert.FileExists(result, PublishOutputPath, "SimpleMvc.pdb");
|
Assert.FileExists(result, PublishOutputPath, "SimpleMvc.pdb");
|
||||||
Assert.FileDoesNotExist(result, PublishOutputPath, "SimpleMvc.Views.dll");
|
Assert.FileDoesNotExist(result, PublishOutputPath, "SimpleMvc.Views.dll");
|
||||||
Assert.FileDoesNotExist(result, PublishOutputPath, "SimpleMvc.Views.pdb");
|
Assert.FileDoesNotExist(result, PublishOutputPath, "SimpleMvc.Views.pdb");
|
||||||
|
|
||||||
|
// By default refs will not be copied on publish
|
||||||
|
Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue