Conditionally enable content items in the razor SDK (dotnet/aspnetcore-tooling#589)
* Move the globs from the project system into the Razor SDK on a separate file that can be imported by itself.
* Import the file conditionally based on the EnableRazorContent property\n\nCommit migrated from 62e33dac1d
This commit is contained in:
parent
98a2a4348b
commit
111e26dd03
|
|
@ -0,0 +1,48 @@
|
||||||
|
<!--
|
||||||
|
***********************************************************************************************
|
||||||
|
Sdk.Razor.StaticAssets.ProjectSystem.props
|
||||||
|
|
||||||
|
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
|
||||||
|
created a backup copy. Incorrect changes to this file will make it
|
||||||
|
impossible to load or build your projects from the command-line or the IDE.
|
||||||
|
|
||||||
|
Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
***********************************************************************************************
|
||||||
|
-->
|
||||||
|
<Project ToolsVersion="14.0">
|
||||||
|
|
||||||
|
<!-- Properties for supporting static content -->
|
||||||
|
<PropertyGroup>
|
||||||
|
|
||||||
|
<!-- This is a contract we have with the Web SDK to allow them in the future to import this file
|
||||||
|
instead of the whole SDK if needed.
|
||||||
|
-->
|
||||||
|
<_WebProjectSystemGlobsPropsDefined>true</_WebProjectSystemGlobsPropsDefined>
|
||||||
|
|
||||||
|
<DefaultItemExcludes>$(DefaultItemExcludes);**\node_modules\**;node_modules\**</DefaultItemExcludes>
|
||||||
|
<DefaultItemExcludes>$(DefaultItemExcludes);**\jspm_packages\**;jspm_packages\**</DefaultItemExcludes>
|
||||||
|
<DefaultItemExcludes>$(DefaultItemExcludes);**\bower_components\**;bower_components\**</DefaultItemExcludes>
|
||||||
|
<DefaultWebContentItemExcludes>$(DefaultWebContentItemExcludes);wwwroot\**</DefaultWebContentItemExcludes>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(EnableDefaultItems)' == 'true' And '$(EnableDefaultContentItems)' == 'true' ">
|
||||||
|
<!-- Publish everything under wwwroot, all JSON files, all config files and all Razor files -->
|
||||||
|
<Content Include="wwwroot\**" CopyToPublishDirectory="PreserveNewest" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
|
||||||
|
<Content Include="**\*.config" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);$(DefaultWebContentItemExcludes)" />
|
||||||
|
<Content Include="**\*.json" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);$(DefaultWebContentItemExcludes)" />
|
||||||
|
|
||||||
|
<!-- Set CopyToPublishDirectory to Never for items under AppDesignerFolder ("Properties", by default) to avoid publishing launchSettings.json -->
|
||||||
|
<Content Update="$(AppDesignerFolder)\**" CopyToPublishDirectory="Never" Condition="'$(AppDesignerFolder)' != ''"/>
|
||||||
|
|
||||||
|
<!-- Remove Content items from other item types (in a way that CPS understands) -->
|
||||||
|
<None Remove="wwwroot\**;**\*.json;**\*.config" />
|
||||||
|
<Compile Remove="wwwroot\**" />
|
||||||
|
<EmbeddedResource Remove="wwwroot\**" />
|
||||||
|
|
||||||
|
<!-- Keep track of the default content items for later to distinguish them from newly generated content items -->
|
||||||
|
<!-- It's important to keep this here so that it works well with the Web SDK -->
|
||||||
|
<_ContentIncludedByDefault Include="@(Content)" />
|
||||||
|
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -74,4 +74,8 @@ Copyright (c) .NET Foundation. All rights reserved.
|
||||||
<None Remove="**\*.razor" />
|
<None Remove="**\*.razor" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Import
|
||||||
|
Project="$(MSBuildThisFileDirectory)..\..\Sdk\Sdk.Razor.StaticAssets.ProjectSystem.props"
|
||||||
|
Condition=" '$(EnableRazorSdkContent)' == 'true' " />
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,11 @@ Copyright (c) .NET Foundation. All rights reserved.
|
||||||
***********************************************************************************************
|
***********************************************************************************************
|
||||||
-->
|
-->
|
||||||
<Project ToolsVersion="14.0" TreatAsLocalProperty="_RazorSdkTasksTFM;_Targeting30OrNewerRazorLangVersion">
|
<Project ToolsVersion="14.0" TreatAsLocalProperty="_RazorSdkTasksTFM;_Targeting30OrNewerRazorLangVersion">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<EnableDefaultContentItems Condition=" '$(EnableDefaultContentItems)' == '' ">true</EnableDefaultContentItems>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Targets supporting Razor MSBuild integration. Contain support for generating C# code using Razor
|
Targets supporting Razor MSBuild integration. Contain support for generating C# code using Razor
|
||||||
and including the generated code in the project lifecycle, including compiling, publishing and producing
|
and including the generated code in the project lifecycle, including compiling, publishing and producing
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue