I have a following razor class library following files
The typescript builds fine, but when I pack the project, the javascript output is not included in the package under staticwebassets:
How do I properly integrate typescript with msbuild so that the generated output is included as static web assets?
this is my current csproj
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Authors>Liero</Authors>
<Version>0.7.3</Version>
<PackageTags>Blazor DataGrid</PackageTags>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup>
<TypescriptOutDir>wwwroot</TypescriptOutDir>
<ResolveCurrentProjectStaticWebAssetsInputsDependsOn>
TypeScriptCompile;
$(ResolveCurrentProjectStaticWebAssetsInputsDependsOn)
</ResolveCurrentProjectStaticWebAssetsInputsDependsOn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.0" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="4.6.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
the PrepareForBuildDependsOn should be like this:
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PrepareForBuildDependsOn>CompileTypeScript;GetTypeScriptOutputForPublishing;$(PrepareForBuildDependsOn)</PrepareForBuildDependsOn>
<TypescriptOutDir>wwwroot</TypescriptOutDir>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="4.6.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>