I created three webassembly project in one solution, one of them referencing the other two. BlazorUI2 that references Client1 and Client2.
So I separate their assets like this, In Client1.csproj:
<StaticWebAssetBasePath>Client1</StaticWebAssetBasePath>
and
<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot1\service-worker.published.js" />
</ItemGroup>
And Client2 config is like Client1.
But I get the error:
MSB4094 "C:\Users\..\Desktop\BlazorUI2 - Copy\Client1\obj\Debug\net8.0\service-worker
\service-worker.js;C:\Users\..\Desktop\BlazorUI2 - Copy\Client2\obj\Debug\net8.0\service-
worker\service-worker.js;C:\Users\..\Desktop\BlazorUI2 - Copy\BlazorUI2\obj\Debug\net8.0
\service-worker\service-worker.js" is an invalid value for the "File" parameter of the
"WriteLinesToFile" task. Multiple items cannot be passed into a parameter of type
"Microsoft.Build.Framework.ITaskItem". BlazorUI2 C:\Program Files\dotnet\sdk\8.0.100
\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets
\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets 159
Based on an answer in StackOverFlow I changed .Net SDK webassembly manifest from:
<WriteLinesToFile
File="@(_BuildServiceWorkerFile->'%(Identity)')"
Lines="/*Manifest version: $(_BuildServiceWorkerAssetsManifestVersion)*/"
Condition="'$(_BuildServiceWorkerAssetsManifestVersion)' != ''" />
to:
<WriteLinesToFile
File="%(AssemblyInfoFiles.FullPath)"
Lines="AssemblyInformationalVersion("$(LabelName)")]"
Overwrite="false"/>
but I get the error:
Error MSB4044 The "WriteLinesToFile" task was not given a value for the required
parameter "File". Client1 C:\Program Files\dotnet\sdk\8.0.100
\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets
\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets 163
So how to correct this?
EDIT:
Batching files also is not working the same error raised:
<ItemGroup>
<AssemblyInfoFiles Include="$(SolutionRoot)\**\*assemblyinfo.cs" />
</ItemGroup>