Asp.net-Mvc
發布 MVC 應用程序時如何包含自定義文件夾?
我有一個帶有徽標的“上傳”文件夾。我希望 VS2012 一鍵發布包含此文件夾。目前不是。
我怎樣才能做到這一點?
我相信您需要將文件夾的“建構操作”設置為“內容”:
我為一個以 Angular 6 作為前端的 web api 項目(不是 dot net core)做了這個。我的視覺工作室版本是 2017 年。
我創建了一個
wwwroot文件夾,我在其中通過自定義建構操作編譯角度文件,並且該文件夾未包含在我的項目中。我編輯了項目文件並添加了這些行。
<PropertyGroup> <PipelineCollectFilesPhaseDependsOn> CustomCollectFiles; $(PipelineCollectFilesPhaseDependsOn); </PipelineCollectFilesPhaseDependsOn> </PropertyGroup> <Target Name="CustomCollectFiles"> <Message Text="Inside of CustomCollectFiles" Importance="high" /> <ItemGroup> <_CustomFiles Include="wwwroot\**\*" /> <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)"> <DestinationRelativePath>wwwroot\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath> </FilesForPackagingFromProject> </ItemGroup> </Target>