wppファイルを使用してxml peekを公開します。公開設定では、msbuildの実行時に公開プロファイルが作成されます。 xmlスニペット以下を使用してwppファイルを作成します。
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
When using this file you must supply /p:PublishSettingsFile as a parameter and /p:DeployOnBuild=true
-->
<PropertyGroup Condition=" Exists('$(PublishSettingsFile)')">
<!-- These must be declared outside of a Target because they impact the Import Project flow -->
<WebPublishMethod>MSDeploy</WebPublishMethod>
<DeployTarget>WebPublish</DeployTarget>
<PipelineDependsOn>
GetPublishPropertiesFromPublishSettings;
$(PipelineDependsOn);
</PipelineDependsOn>
</PropertyGroup>
<Target Name="GetPublishPropertiesFromPublishSettings" BeforeTargets="Build" Condition=" Exists('$(PublishSettingsFile)')">
<PropertyGroup>
<_BaseQuery>/publishData/publishProfile[@publishMethod='MSDeploy'][1]/</_BaseQuery>
<!-- This value is not in the .publishSettings file and needs to be specified, it can be overridden with a cmd line parameter -->
<!-- If you are using the Remote Agent then specify this as RemoteAgent -->
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
</PropertyGroup>
<ItemGroup>
<_MSDeployXPath Include="WebPublishMethod">
<Query>$(_BaseQuery)@publishMethod</Query>
</_MSDeployXPath>
<_MSDeployXPath Include="MSDeployServiceURL">
<Query>$(_BaseQuery)@publishUrl</Query>
</_MSDeployXPath>
<_MSDeployXPath Include="SiteUrlToLaunchAfterPublish">
<Query>$(_BaseQuery)@destinationAppUrl</Query>
</_MSDeployXPath>
<_MSDeployXPath Include="DeployIisAppPath">
<Query>$(_BaseQuery)@msdeploySite</Query>
</_MSDeployXPath>
<_MSDeployXPath Include="UserName">
<Query>$(_BaseQuery)@userName</Query>
</_MSDeployXPath>
<_MSDeployXPath Include="Password">
<Query>$(_BaseQuery)@userPWD</Query>
</_MSDeployXPath>
</ItemGroup>
<XmlPeek XmlInputPath="$(PublishSettingsFile)"
Query="%(_MSDeployXPath.Query)"
Condition=" Exists('$(PublishSettingsFile)')">
<Output TaskParameter="Result" PropertyName="%(_MSDeployXPath.Identity)"/>
</XmlPeek>
</Target>
</Project>
上記のXMLコードスニペットとWPPファイルを作成し、それをあなたのcsprojが存在するか、複数のプロジェクトで再利用するcsprojファイルフォルダの外WPPを配置しているならば、あなたが追加する必要が同じプロジェクトを配置/ P:WebPublishPipelineCustomizeTargetFile =
msbuild.exe MyProject /p:WebPublishPipelineCustomizeTargetFile=<path-to.targets-file> /p:VisualStudioVersion=11.0 /p:DeployOnBuild=true /p:PublishSettingsFile=<path-to-.publishsettings>
あなたは2つのパブリッシュプロファイルの設定を共有することができhttp://sedodream.com/2013/06/05/HowToPublishAVSWebProjectWithAPublishSettingsFile.aspx
@実装の詳細を見つけることができますか? –
これらは私のサイトの機密データを含んでいます。それらを削除して共有することはできますか? –
はい、機密データを削除してから共有してください。 –