Closed ns6000 closed 2 years ago
Hello,
i've installed latest version on my VS2019 / netstandard2.0 project and it works but instead of generating .cs file as specified in template, it generates .txt file on build (with correct content).
my csproj is:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <Configurations>Debug;Release</Configurations> <TextTransformPath>$(VsInstallRoot)\Common7\IDE\TextTransform.exe</TextTransformPath> </PropertyGroup> <ItemGroup> <PackageReference Include="Clarius.TransformOnBuild" Version="1.22.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> </ItemGroup> <ItemGroup> <None Update="AssemblyInfo.tt"> <Generator>TextTemplatingFileGenerator</Generator> <LastGenOutput>AssemblyInfo.cs</LastGenOutput> </None> </ItemGroup> <ItemGroup> <Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" /> </ItemGroup> <ItemGroup> <Compile Update="AssemblyInfo.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>AssemblyInfo.tt</DependentUpon> </Compile> </ItemGroup> </Project>
and my whole template is:
<#@ template language="C#" #> using System.Reflection; [assembly: AssemblyProduct("product")] [assembly: AssemblyCompany("company")] [assembly: AssemblyCopyright("Copyright © 2020 - 2022 company")] [assembly: AssemblyVersion("<#= versionNumber #>.<#= this.revisionNumber #>")] [assembly: AssemblyFileVersion("<#= versionNumber #>.<#= this.revisionNumber #>")] <#+ string versionNumber = "0.2.8"; int revisionNumber = (int)(DateTime.UtcNow - new DateTime(2020, 1, 1)).TotalDays; #>
Any ideas what i'm doing wrong?
add <#@ output extension="cs" #> to the top of your template file
<#@ output extension="cs" #>
that solved it, thank you!
Hello,
i've installed latest version on my VS2019 / netstandard2.0 project and it works but instead of generating .cs file as specified in template, it generates .txt file on build (with correct content).
my csproj is:
and my whole template is:
Any ideas what i'm doing wrong?