在构建过程中,系统会生成一些文件(连接,缩小和版本化资产) .
由于这些文件是动态创建的,因此它们不会添加到项目中,因此在我发布时,visual studio不会复制它们 .
有没有办法告诉VS复制文件夹中的所有文件?
能够通过手动编辑 .csproj 文件并添加这些行来解决问题:
.csproj
<PropertyGroup> <CopyAllFilesToSingleFolderForPackageDependsOn> CustomCollectFiles; $(CopyAllFilesToSingleFolderForPackageDependsOn); </CopyAllFilesToSingleFolderForPackageDependsOn> <CopyAllFilesToSingleFolderForMsdeployDependsOn> CustomCollectFiles; $(CopyAllFilesToSingleFolderForPackageDependsOn); </CopyAllFilesToSingleFolderForMsdeployDependsOn> </PropertyGroup> <Target Name="CustomCollectFiles"> <ItemGroup> <_CustomFiles Include="public\form\dist\*.js" /> <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)"> <DestinationRelativePath>public\form\dist\%(Filename)%(Extension)</DestinationRelativePath> </FilesForPackagingFromProject> </ItemGroup> </Target> </PropertyGroup>
1 回答
能够通过手动编辑
.csproj
文件并添加这些行来解决问题: