36 lines
1.8 KiB
XML
36 lines
1.8 KiB
XML
<Project ToolsVersion="15.0" DefaultTargets="CopyTemplateToOutput">
|
|
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
|
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.tasks))\dir.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="$(PreviousStageDirectory)"
|
|
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>
|