2017-12-05 8 views
1

私のソリューションには2つのWeb APIプロジェクトがあります。 1つのプロジェクトは4.5.1で、もう1つのプロジェクトは4.6.1です。MsbuildはAzure公開プロファイル設定を無視します - Visual Studio 2015 - .Net 4.6.1

.Netフレームワーク4.5.1を使用したプロジェクトは、以下のパラメータを持つmsbuildタスクを使用してpをビルドし、コードを適切に公開してazureにします。大丈夫だ!! .NETフレームワーク4.6.1と

enter image description here

プロジェクトは、以下のパラメータでのMSBuildタスクを適切に構築します。上記のパラメータを指定してビルドがパッケージは紺碧に展開していない作成され

enter image description here

。以下のログを参照してください。

enter image description here

それは本当に不思議です、助けてください。私は2つのWeb APIのソリューションの間に表示される違いは、.Netフレームワークのバージョンです。

+0

@実装の詳細を見つけることができますか? –

+0

これらは私のサイトの機密データを含んでいます。それらを削除して共有することはできますか? –

+0

はい、機密データを削除してから共有してください。 –

答えて

0

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

0

最初に公開を行うにはmsbuild.exeコマンドを手動で使用することをお勧めします。これにより、TFS側の問題を絞り込むことができます。

また、ビルドエージェントのAzure SDKを最新バージョン(Azure SDK for .NET 3.0)に更新してください。

MSBuild引数に「PublishProfileRootFolder」パラメータを強制的に設定してください。詳細は、この質問を参照してください。MsBuild not finding publish profile

+0

私はAzureからの公開プロファイルを使用し、ソースをビルド中にmsbuildの引数として渡すので、どのくらい私はPublishProfileRootFolderを使用できるか分かりません。 –

+0

@ KarthikeyanVK .NETフレームワークを持つプロジェクトに対して同じパラメータでmsbuildコマンドを直接使用しましたか? 4.6.1、これは適切に機能しましたか?問題がTFSサイドまたはビルド定義に関連する場合は、これが絞り込まれます。 –

+0

こんにちは@ KarthikeyanVK、これに関するすべてのアップデートは、あなたがそれを理解しましたか? –

関連する問題