Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC 5 - include WebPack output into publish

I am using MVC 5 with WebPack.

I have a "/dist" folder in my web project which is empty, but during compile I invoke WebPack and it creates output files for me. "/dest" will be populated with files which WebPack has created for me.

/dist
  /dist/script1.js
  /dist/script2.js
  etc...

How can I ensure that the "/dist" folder and all of its files are included in the publish output?

The web project publishes just fine, but the /dist folder is missing from it.

Including the files into the solution doesn't seem like the right answer. Is there a better way?

like image 309
Laurence Frost Avatar asked Dec 02 '25 10:12

Laurence Frost


1 Answers

You can add the dist folder to the project by adding to the csproj file :

<ItemGroup>
    <Content Include="dist/**" />
</ItemGroup>

this will include the dist folder and all its files in the project, and since it's declared as content it will also be included in the deployement.

like image 101
J.Loscos Avatar answered Dec 05 '25 01:12

J.Loscos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!