I have a Blazor Server .NET 7 solution with the main entry project called Web.csproj. There are other projects such as Api, WebApi, WebConstants etc… When I build this blazor server project in Visual Studio, all works fine, but when I run the following msbuild command:
msbuild .WebWebWeb.csproj /p:SolutionDir=c:UsersmeDocumentsRepossolution /p:DeployOnBuild=true /p:PublishProfile=FolderProfile
I get the following error:
C:Program Filesdotnetsdk7.0.403SdksMicrosoft.NET.SdktargetsMicrosoft.NET.ConflictResolution.targets(112,5): error NETSDK1152: Found multiple publish output files with the same relative path:
C:UsersmeDocumentsRepossolutionWebAlarmingbinDebugnet7.0Api.dll.config,
C:UsersmeDocumentsRepossolutionWebWebComponentsbinDebugnet7.0Api.dll.config,
C:UsersmeDocumentsRepossolutionWebElementSelectorWindowbinDebugnet7.0Api.dll.config,
C:UsersmeDocumentsRepossolutionWebFaceplatebinDebugnet7.0Api.dll.config,
C:UsersmeDocumentsRepossolutionWebLogsbinDebugnet7.0Api.dll.config,
C:UsersmeDocumentsRepossolutionWebSummarybinDebugnet7.0Api.dll.config,
C:UsersmeDocumentsRepossolutionWebTrackingbinDebugnet7.0Api.dll.config,
C:UsersmeDocumentsRepossolutionWebWebComponentsbinDebugnet7.0WebComponents.staticwebassets.runtime.json, C:UsersmeDocumentsRepossolutionWebElementSelectorWindowbinDebugnet7.0WebComponents.staticwebassets.runtime.json, C:UsersmeDocumentsRepossolutionWebFaceplatebinDebugnet7.0WebComponents.staticwebassets.runtime.json,
C:UsersmeDocumentsRepossolutionWebLogsbinDebugnet7.0WebComponents.staticwebassets.runtime.json, C:UsersmeDocumentsRepossolutionWebSummarybinDebugnet7.0WebComponents.staticwebassets.runtime.json, C:UsersmeDocumentsRepossolutionWebWebComponentsbinReleasenet7.0WebComponents.staticwebassets.runtime.json,
C:UsersmeDocumentsRepossolutionWebElementSelectorWindowbinReleasenet7.0WebComponents.staticwebassets.runtime.json, C:UsersmeDocumentsRepossolutionWebFaceplatebinReleasenet7.0WebComponents.staticwebassets.runtime.json, C:UsersmeDocumentsRepossolutionWebLogsbinReleasenet7.0WebComponents.staticwebassets.runtime.json,
C:UsersmeDocumentsRepossolutionWebSummarybinReleasenet7.0WebComponents.staticwebassets.runtime.json,
I solved these errors by following advice from here and included the following in each of my csproj files:
<PropertyGroup>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>
but I think this is just putting a bandate on the real problem. What are these dll.config
and staticwebassets.runtime.json
files that are produced each time a project is referenced by another and how can I solve this error properly?
Perhaps I should mention, Api is a project referenced by numerous others such as Alarming, WebComponents, ElementSelectorWindow, etc…