asp.net - Copy css/js files with msdeploy on one-click deployment -


i deployed asp.net mvc 5 application using one-click deployment in visual studio.

meanwhile need copy css/js files centralized folder, can used different applications of solution.

it seems msdeploy has some options solve this. where/how can pass parameters msdeploy using visual studio 2015?

one of options is:

we need class inherits task. copy files.

public class copyfilestofolder : task {     [required]     public string folderpathforsource { get; set; }      [required]     public string outputfolder { get; set; }      public override bool execute()     {         //do copy here          return true;     } } 

for example youproject want deploy.

we need edit yourproject.csproj file: register dll copyfilestofolder class , add target msdeploy

<project toolsversion="12.0" defaulttargets="build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">   <usingtask taskname="copyfilestofolder" assemblyfile="..\..\pathtodll\dllwithcopyfilestofolderclass.dll">   </usingtask>   <target name="copyfilestofolderforpublish">     <copyfilestofolder folderpathforsource="$(projectdir)\\$(_packagetempdir)\\content\\" outputfolder="c:\\deploy\\content\\">     </copyfilestofolder>   </target> <!-- ... -->  </project> 

as see there can pass parameters class create earlier. , last, in yourproject.pubxml file told msdeploy when putt files needed package execute copyfilestofolderforpublish target

<project toolsversion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">   <propertygroup>     <!-- other properties -->     <onaftercopyallfilestosinglefolderforpackage>copyfilestofolderforpublish;</onaftercopyallfilestosinglefolderforpackage>   </propertygroup> </project> 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -