Publishing blazor app generates "source file is actually a directory" error, how can I fix this?

Viewed 74

In VS2022 when I try to publish my server blazor app to folder I get the following error:

The source file "C:\Users\xxxxx\.nuget\packages\blazorpropertygridcomponents\1.0.0\staticwebassets\css\open-iconic\ICON-LICENSE" is actually a directory.  The "Copy" task does not support copying directories.

I have tried to find a solution to this but have not yet found one... as to the error there is a file in the ICON-LICENSE folder called ICON-LICENSE which has no extension but is a text file.

enter image description here

If this possibly a bug with the publish functionality? How do I either work around or correct?

My pubxml file:

<Project>
  <PropertyGroup>
   <DeleteExistingFiles>true</DeleteExistingFiles>
   <ExcludeApp_Data>false</ExcludeApp_Data>
   <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
   <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
   <LastUsedPlatform>Any CPU</LastUsedPlatform>
   <PublishProvider>FileSystem</PublishProvider>
   <PublishUrl>C:\Sandbox\My-services\Projects\My.WebApplication\bin\Release\net6.0-windows\publish</PublishUrl>
   <WebPublishMethod>FileSystem</WebPublishMethod>
   <_TargetId>Folder</_TargetId>
   <SiteUrlToLaunchAfterPublish />
   <TargetFramework>net6.0-windows</TargetFramework>
   <ProjectGuid>e07fe3d5-f8a5-4c79-80c3-df642ecfda76</ProjectGuid>
   <SelfContained>false</SelfContained>
  </PropertyGroup>
</Project>
1 Answers

I was able to work around the problem, by copying off the files, deleting the folders and copying the files back to the parent folder(eg.: open-iconic). Evidently you cannot copy a file with the same name as the folder to the parent folder.

This does not answer the problem as to why publish cannot determine whether a file is an actual file or not. If its a naming issue then the publish routine needs to be fixed for that as well.

I am not marking this as the answer as I believe the answer is to fix the actual publish problem.

Related