Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过msdeploy/F#伪脚本将不在项目中部署的文件包括在内_F#_Msbuild_Msdeploy_F# Fake - Fatal编程技术网

通过msdeploy/F#伪脚本将不在项目中部署的文件包括在内

通过msdeploy/F#伪脚本将不在项目中部署的文件包括在内,f#,msbuild,msdeploy,f#-fake,F#,Msbuild,Msdeploy,F# Fake,所以我有以下的假脚本 // include Fake lib #r @"packages\FAKE.4.29.2\tools\FakeLib.dll" open Fake RestorePackages() // define directories let binDir = "./ProjFileFolder/bin/" let objDir = "./ProjFileFolder/obj/Debug/" let buildConf = getBuildParamOrDefault "c

所以我有以下的假脚本

// include Fake lib
#r @"packages\FAKE.4.29.2\tools\FakeLib.dll"
open Fake

RestorePackages()

// define directories
let binDir = "./ProjFileFolder/bin/"
let objDir = "./ProjFileFolder/obj/Debug/"

let buildConf = getBuildParamOrDefault "conf" "Debug"
let buildNumber = getBuildParamOrDefault "bn" "0"
let buildVersion = "1.0.0." + buildNumber

let publishProfile = getBuildParamOrDefault "pubprofile" ""
let publishPassword = getBuildParamOrDefault "pubpwd" ""

let setParamsWeb = [
       "DebugSymbols", "True"
       "Configuration", buildConf
       "Platform", "Any CPU"
       "PublishProfile", publishProfile
       "DeployOnBuild", "true"
       "Password", publishPassword
       "AllowUntrustedCertificate", "true"
   ]

// Targets
Target "Clean" (fun _ ->
    CleanDirs [binDir; objDir]
)

Target "Compile" (fun _ ->
    !! @"**\*.csproj"
      |> MSBuild binDir "Build" setParamsWeb
      |> Log "AppBuild-Output: "
)

// Dependencies
"Clean"
    ==> "Compile"

// start build
RunTargetOrDefault "Compile"
我在csproj文件中创建了一些目标,包括生成的/docs-doxygen文档文件夹。这在最初使用旧的msdeploy脚本时起作用,该脚本是msdeploy文件夹同步命令。他们在这里

  <Target Name="CustomCollectFiles">
    <ItemGroup>
      <_CustomFiles Include=".\docs\**\*" />
      <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>docs\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>

  <Choose>
    <When Condition="'$(Configuration)' == 'Debug'">
      <PropertyGroup>
        <CopyAllFilesToSingleFolderForPackageDependsOn>
          CustomCollectFiles;
          $(CopyAllFilesToSingleFolderForPackageDependsOn);
        </CopyAllFilesToSingleFolderForPackageDependsOn>
      </PropertyGroup>
    </When>
    <When Condition="'$(Configuration)' == 'QA'">
      <PropertyGroup>
        <CopyAllFilesToSingleFolderForPackageDependsOn>
          CustomCollectFiles;
          $(CopyAllFilesToSingleFolderForPackageDependsOn);
        </CopyAllFilesToSingleFolderForPackageDependsOn>
      </PropertyGroup>
    </When>
  </Choose>

文档\%(递归目录)%(文件名)%(扩展名)
自定义文件;
$(将所有文件复制到SingleFolderForpPackageDependson);
自定义文件;
$(将所有文件复制到SingleFolderForpPackageDependson);

如何确保伪脚本执行相同的操作,或者它执行csproj文件中的那些目标?它通过传递项目中要用于部署的azure发布配置文件的名称来运行。

因此,在本例中,由于我要部署到azure,所以我能够将目标和属性组移动到发布配置文件,而不是直接将其放在项目文件中。因此,我在我们的发布简介中总结了以下内容

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>MSDeploy</WebPublishMethod>
    <ADUsesOwinOrOpenIdConnect>False</ADUsesOwinOrOpenIdConnect>
    <PublishProvider>AzureWebSite</PublishProvider>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish>stuff</SiteUrlToLaunchAfterPublish>
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <MSDeployServiceURL>stuff</MSDeployServiceURL>
    <DeployIisAppPath>more stuff</DeployIisAppPath>
    <RemoteSitePhysicalPath />
    <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
    <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
    <EnableMSDeployBackup>True</EnableMSDeployBackup>
    <UserName>more stuff</UserName>
    <_SavePWD>True</_SavePWD>
    <_DestinationType>AzureWebSite</_DestinationType>
  </PropertyGroup>
  <Target Name="CustomCollectFiles" BeforeTargets="Compile">
    <ItemGroup>
      <_CustomFiles Include=".\docs\**\*" />
      <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>docs\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>
  <PropertyGroup>
    <CopyAllFilesToSingleFolderForPackageDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForPackageDependsOn>
  </PropertyGroup>
  <PropertyGroup>
    <CopyAllFilesToSingleFolderForMsdeployDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForMsdeployDependsOn>
  </PropertyGroup>
</Project>

MSDeploy
. 我想这是本教程的延伸