2017-09-13 128 views
0

我有一個從代碼文檔創建的xml文件。 Xml文件在源代碼管理中,它位於我的項目的根目錄下。這是.csproj:不在tfs構建服務器上覆制文檔文件

<Project Sdk="Microsoft.NET.Sdk.Web"> 

    <PropertyGroup Label="Globals"> 
    <SccProjectName>SAK</SccProjectName> 
    <SccProvider>SAK</SccProvider> 
    <SccAuxPath>SAK</SccAuxPath> 
    <SccLocalPath>SAK</SccLocalPath> 
    </PropertyGroup> 

    <PropertyGroup> 
    <TargetFramework>netcoreapp1.1</TargetFramework> 
    <PreserveCompilationContext>true</PreserveCompilationContext> 
    <PackageTargetFallback>portable-net45+win8</PackageTargetFallback> 
    </PropertyGroup> 

    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> 
    <DocumentationFile>bin\Debug\netcoreapp1.1\Api.xml</DocumentationFile> 
    </PropertyGroup> 


    <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"> 
    <ItemGroup> 
     <DocFile Include="bin\*\*\Api.xml" /> 
    </ItemGroup> 

    <Copy SourceFiles="@(DocFile)" DestinationFolder="$(PublishDir)" SkipUnchangedFiles="false" /> 
    </Target> 

    <ItemGroup> 
    <Compile Remove="wwwroot\**" /> 
    <Content Remove="wwwroot\**" /> 
    <EmbeddedResource Remove="wwwroot\**" /> 
    <None Remove="wwwroot\**" /> 
    </ItemGroup> 

    <ItemGroup> 
    <None Remove="identityserver4_log.txt" /> 
    </ItemGroup> 

    <ItemGroup> 
    <Content Include="Api.xml"> 
     <CopyToOutputDirectory>Always</CopyToOutputDirectory> 
    </Content> 
    </ItemGroup> 
    <ItemGroup> 
    <PackageReference Include="AutoMapper" Version="6.0.2" /> 
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="2.0.1" /> 
    <PackageReference Include="Carable.Swashbuckle.AspNetCore.DocumentWithCode" Version="0.0.4" /> 
    <PackageReference Include="Castle.Core" Version="4.1.1" /> 
    <PackageReference Include="FluentValidation.AspNetCore" Version="7.0.2" /> 
    <PackageReference Include="IdentityServer4" Version="1.5.2" /> 
    <PackageReference Include="IdentityServer4.AccessTokenValidation" Version="1.2.1" /> 
    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" /> 
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" /> 
    <PackageReference Include="Microsoft.AspNetCore.Identity" Version="1.1.2" /> 
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" /> 
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" /> 
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" /> 
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.2" /> 
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" /> 
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.2" /> 
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" /> 
    <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" /> 
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" /> 
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.2" /> 
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.1" /> 
    <PackageReference Include="Serilog.Extensions.Logging" Version="1.4.0" /> 
    <PackageReference Include="Serilog.Extensions.Logging.ApplicationInsights" Version="1.1.0" /> 
    <PackageReference Include="StructureMap.Microsoft.DependencyInjection" Version="1.3.0" /> 
    </ItemGroup> 
    <ItemGroup> 
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" /> 
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" /> 
    </ItemGroup> 
    <ItemGroup> 
    <WCFMetadata Include="Connected Services" /> 
    </ItemGroup> 
    <ItemGroup> 
    <Folder Include="Views\Default\" /> 
    </ItemGroup> 
    <ItemGroup> 
    <ProjectReference Include="..\Api.Business\Api.Business.csproj" /> 
    </ItemGroup> 


</Project> 

該文件不會複製到我的azure webapp上的wwwroot。我必須設置什麼?

回答

0

在主要部分,保證了文檔文件被生成:

<GenerateDocumentationFile>true</GenerateDocumentationFile> 

你可以試着指定文檔文件的絕對路徑。

參考下面的示例:

<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"> 
    <ItemGroup> 
     <DocFile Include="bin\$(Configuration)\$(TargetFramework)\Api.xml" /> 
    </ItemGroup> 
    <Copy SourceFiles="@(DocFile)" DestinationFolder="$(PublishDir)" SkipUnchangedFiles="false" /> 
    </Target> 

更多信息,請參閱本GitHub的討論:https://github.com/dotnet/sdk/issues/795

您也可以嘗試在此copydocfile-example提到的解決方案。

+0

net core爲.csproj中的GenerateDocumentationFile拋出錯誤。 –

+0

@AmelSalibasic什麼樣的錯誤?您可以在這裏分享錯誤消息以進一步排除故障嗎? –

+0

它表示元素不被識別 –

相關問題