Grofit
Grofit
CC#
Created by Grofit on 12/29/2024 in #help
✅ Web project used to work, now msbuild failing but nothing has changed in the source
I have just opened up a project that was working fine last time I was compiling it (lets say 6 months ago), since then only thing I can think of that I have done is install .net 9, but other than that nothing has changed with .net to my knowledge. The projects in question are still targetting .net 8 anyway. So with that out of the way whenever I try to compile a Microsoft.NET.Sdk.Razor project which contains a section to copy static content:
<Target Name="_StaticWebAssetsComputeFilesToBuild" AfterTargets="GetCopyToOutputDirectoryItems" DependsOnTargets="ResolveStaticWebAssetsInputs">
<ItemGroup>
<!-- Filter the static web assets foreign to the project and then add them to the list of resolved
files to publish.
-->
<_ExternalBuildStaticWebAsset Include="%(StaticWebAsset.FullPath)" Condition="'%(SourceType)' != ''">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>$([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)','$([MSBuild]::NormalizePath('wwwroot\%(BasePath)\%(RelativePath)'))'))</TargetPath>
</_ExternalBuildStaticWebAsset>
<!-- Remove any existing external static web asset that might have been added as part of the
regular publish pipeline. -->
<_SourceItemsToCopyToOutputDirectory Remove="@(_ExternalBuildStaticWebAsset)" />
<_SourceItemsToCopyToOutputDirectory Include="@(_ExternalBuildStaticWebAsset)" />
</ItemGroup>
</Target>
<Target Name="_StaticWebAssetsComputeFilesToBuild" AfterTargets="GetCopyToOutputDirectoryItems" DependsOnTargets="ResolveStaticWebAssetsInputs">
<ItemGroup>
<!-- Filter the static web assets foreign to the project and then add them to the list of resolved
files to publish.
-->
<_ExternalBuildStaticWebAsset Include="%(StaticWebAsset.FullPath)" Condition="'%(SourceType)' != ''">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>$([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)','$([MSBuild]::NormalizePath('wwwroot\%(BasePath)\%(RelativePath)'))'))</TargetPath>
</_ExternalBuildStaticWebAsset>
<!-- Remove any existing external static web asset that might have been added as part of the
regular publish pipeline. -->
<_SourceItemsToCopyToOutputDirectory Remove="@(_ExternalBuildStaticWebAsset)" />
<_SourceItemsToCopyToOutputDirectory Include="@(_ExternalBuildStaticWebAsset)" />
</ItemGroup>
</Target>
Which blows up now because its adding #[.{fingerprint}]? into the destination file output for some reason, which never used to happen and says its unable to copy due to bad label syntax. (Will post more info on that on separate message as running out of characters in this one).
9 replies