所以我有以下假脚本...
// include Fake lib
#r @"packagesFAKE.4.29.2toolsFakeLib.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文件中创建的目标,其中包括生成/文档doxygen文档文件夹。最初使用我的旧MSDEPLOY脚本(这是MSDEPLOY文件夹Sync命令)时,这起作用了。他们是...
<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>
如何确保假脚本执行相同的事情或它在CSPROJ文件中执行这些目标?它通过传递Azure Publish配置文件的名称而运行,您想用来部署项目中的部署。
因此,在这种情况下,因为我要部署到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>
我们将发布配置文件导入到项目中,以便假脚本仅接受发布配置文件和发布密码的名称,然后接受我试图包括的Doxygen文档,并且在Pre/Post Build Event上创建的Doxygen文档是自动包含。我已经将其添加到我们的dev/QA发布配置文件中,但没有将其添加到我们的生产发布个人资料中,因为我们不希望将其部署到产品中。但是,很高兴自动部署并在我们的开发/质量质量质量检查环境中使用,以供任何人访问。我在项目中包括了"文档"文件夹。不确定这是否会对它的工作方式产生任何影响。
我遵循本教程... https://www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/deploying-extra-files。