40 lines
1.9 KiB
Text
40 lines
1.9 KiB
Text
![]() |
<Project ToolsVersion="15.0" DefaultTargets="CopyTemplateToOutput">
|
||
|
<!-- workaround for https://github.com/Microsoft/msbuild/issues/885 -->
|
||
|
<!-- renaming the property because the original property is a global property and therefore
|
||
|
cannot be redefined at runtime. -->
|
||
|
|
||
|
<Import Project="Microsoft.DotNet.Cli.tasks" />
|
||
|
|
||
|
<Target Name="CopyTemplateToOutput"
|
||
|
DependsOnTargets="PrepareBundledTemplateProps;
|
||
|
EnsureTemplateRestored;
|
||
|
GetTemplateItemsToCopy"
|
||
|
Inputs="@(TemplateContent)"
|
||
|
Outputs="@(TemplateContent->'$(TemplateLayoutDirectory)/%(RecursiveDir)%(FileName)%(Extension)')">
|
||
|
<Copy SourceFiles="@(TemplateContent)"
|
||
|
DestinationFiles="@(TemplateContent->'$(TemplateLayoutDirectory)/%(RecursiveDir)%(FileName)%(Extension)')" />
|
||
|
|
||
|
<Message Text="Copied template $(TemplatePackageName) from $(TemplateNuPkgPath) to $(TemplateLayoutDirectory)."
|
||
|
Importance="High" />
|
||
|
</Target>
|
||
|
|
||
|
<Target Name="GetTemplateItemsToCopy">
|
||
|
<ItemGroup>
|
||
|
<TemplateContent Include="$(TemplateNuPkgPath)/$(TemplatePackageName.ToLower()).$(TemplatePackageVersion.ToLower()).nupkg" />
|
||
|
</ItemGroup>
|
||
|
</Target>
|
||
|
|
||
|
<Target Name="EnsureTemplateRestored"
|
||
|
Condition="!Exists('$(TemplateNuPkgPath)/$(TemplatePackageName.ToLower()).nuspec')">
|
||
|
<DotNetRestore ToolPath="$(Stage0Directory)"
|
||
|
ProjectPath="$(MSBuildThisFileDirectory)/templates/templates.csproj"
|
||
|
AdditionalParameters="/p:TemplatePackageName=$(TemplatePackageName) /p:TemplatePackageVersion=$(TemplatePackageVersion)" />
|
||
|
</Target>
|
||
|
|
||
|
<Target Name="PrepareBundledTemplateProps">
|
||
|
<PropertyGroup>
|
||
|
<TemplateNuPkgPath>$(NuGetPackagesDir)/$(TemplatePackageName.ToLower())/$(TemplatePackageVersion.ToLower())</TemplateNuPkgPath>
|
||
|
</PropertyGroup>
|
||
|
</Target>
|
||
|
</Project>
|