MSbuild command line parameter for skipping the directory

前端 未结 3 2017
不知归路
不知归路 2020-12-10 20:54

I have following command line parameters in team city for deployment. everything works fine but i want to skip some directory while deployment. how can i add that logic in f

相关标签:
3条回答
  • 2020-12-10 21:23

    You can't specify a WPP skip rule via the command line because they are declared as items, not properties.

    Here is the syntax for declaring the skip rule inside your pubxml (or wpp.targets):

    <ItemGroup>
      <MsDeploySkipRules Include="SkipErrorLogFolder1"> 
        <SkipAction>Delete</SkipAction> 
        <ObjectName>filePath</ObjectName> 
        <AbsolutePath>ErrorLog</AbsolutePath> 
      </MsDeploySkipRules> 
    </ItemGroup>
    
    0 讨论(0)
  • 2020-12-10 21:26

    Actually I already implement this in my project as follow:

    <ItemGroup>
            <MsDeploySkipRules Include="SkipDeleteApp_Data_Import">
                <SkipAction></SkipAction>
                <ObjectName>dirPath</ObjectName>
                <AbsolutePath>$(_Escaped_WPPAllFilesInSingleFolder)\\App_Data\\Import</AbsolutePath>
            </MsDeploySkipRules>
        </ItemGroup>
        <ItemGroup>
            <MsDeploySkipRules Include="SkipDeleteApp_Data_File">
                <SkipAction></SkipAction>
                <ObjectName>filePath</ObjectName>
                <AbsolutePath>$(_Escaped_WPPAllFilesInSingleFolder)\\App_Data\\en-US-custom.txt</AbsolutePath>
            </MsDeploySkipRules>
        </ItemGroup>
    
    0 讨论(0)
  • 2020-12-10 21:40

    I was working on the same thing. I didn't like having to modify my .csproj file, so I tried this. It is working for me so far. In my case, I was excluding the media, App_Data\Logs, and App_Data\preview folders from deployment instead of the Data folder.

    Basically, you can pass the ExcludeFoldersFromDeployment as a parameter to MSBuild. Combining that with the SkipExtraFilesOnServer does the trick.

    /p:Configuration=Debug
    /p:DeployOnBuild=True
    /p:DeployTarget=MSDeployPublish
    /p:MsDeployServiceUrl=OurDevWebServer/msdeployagentservice
    /p:AllowUntrustedCertificate=True
    /p:MSDeployPublishMethod=RemoteAgent
    /p:CreatePackageOnPublish=True
    /p:DeployIisAppPath=umbraco_TestSite
    /p:IgnoreDeployManagedRuntimeVersion=True
    /p:SkipExtraFilesOnServer=True
    /p:ExcludeFoldersFromDeployment="media;App_Data\Logs;App_Data\preview"
    /p:IncludeSetAclProviderOnDestination=False
    /p:AuthType=NTML /p:UserName=
    
    0 讨论(0)
提交回复
热议问题