I have an "Uploads" folder with logos within in. I would like the VS2012 one-click publish to include this folder. Currently it is not.
How can I achieve this?
I have an "Uploads" folder with logos within in. I would like the VS2012 one-click publish to include this folder. Currently it is not.
How can I achieve this?
I did this for a web api project (not dot net core) which had Angular 6 as a front end. My visual studio version was 2017.
I had created a wwwroot
folder where I was compiling angular files via custom build action & this folder was not included in my project.
I edited the project file & added these lines.
<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>
I believe you need to set the folder's "Build Action" to "Content":
I tried all solutions above, but none of them worked. I'm using VS2017 and wasn't able to folder publish some help files. I edited the project file (.csproj) and added the following lines somewhere in de file.
<ItemGroup>
<Content Include="HelpFiles\**\*" />
</ItemGroup>
When I push the publish button all my help files are copied to the publish directory.
Go to Project Properties > Package / Publish Web
Then select the configuration combo that you want to setup up.
Below you have the Items to deploy. I just tested here with "All files in this project folder" and everything was published.
The only downside is that everything is getting deployed, I don't know if this is what you want.
There is an attribute named CopyToPublishDirectory to publish in vs profiles. You can specify this in .csproj
file of the project.
<ItemGroup>
<Content Update="Foo\**\*" CopyToPublishDirectory="Always" />
</ItemGroup>
<ItemGroup>
<Content Include="Foo\**\*" />
</ItemGroup>
in my case i Created a folder in the bin folder and needed to include that folder in the publish. and that code is worked for me.
<Target Name="CustomCollectFiles">
<ItemGroup>
<_CustomFiles Include=".\bin\Dlls\**\*" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>bin\Dlls\%(RecursiveDir)%(Filename)%(Extension)
</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>CustomCollectFiles;
;</CopyAllFilesToSingleFolderForPackageDependsOn>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>CustomCollectFiles;
;</CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
hope that helps someone.
In visual studio 2019 community, you have to right click on the folder and then click on publish. You can see it is published to the destination i.e. existing publish folder
In visual studio 2022 you can publish a content folder separately by right clicking it and selecting "publish".
While this means an extra step when publishing the whole project, it means that you can just push out new content without having to publish the server again