Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML Documentation file is not included in publish folder

I've selected "Xml documentation file" in my ASP.NET Core MVC application and it displays "bin\Debug\net452\MyProject.xml" as output folder. The problem is that this file doesn't exist in publish folder. Do I need to someting additional to include it? Using .NET Core 1.0-RC4 and VS.NET 2017 RC4 (new csproject format).

like image 549
dstr Avatar asked Feb 22 '17 07:02

dstr


2 Answers

If you're using project.json then you can control the files and folders that are both included and excluded by the publish process:

  "publishOptions": {
    "include": [
      "wwwroot",
      "appsettings.json",
      "appsettings.*.json",
      "web.config"
    ],
    "exclude": [
      "wwwroot/less"
    ]
  }

For .csproj based projects here is a good resource for replicating old project.json settings in XML, for example:

<ItemGroup>
  <Compile Include="..\Shared\*.cs" Exclude="..\Shared\Not\*.cs" />
  <EmbeddedResource Include="..\Shared\*.resx" />
  <Content Include="Views\**\*" PackagePath="%(Identity)" />
  <None Include="some/path/in/project.txt" Pack="true" PackagePath="in/package.txt" />

  <None Include="notes.txt" CopyToOutputDirectory="Always" />
  <!-- CopyToOutputDirectory = { Always, PreserveNewest, Never } -->

  <Content Include="files\**\*" CopyToPublishDirectory="PreserveNewest" />
  <None Include="publishnotes.txt" CopyToPublishDirectory="Always" />
  <!-- CopyToPublishDirectory = { Always, PreserveNewest, Never } -->
</ItemGroup>
like image 125
Polynomial Avatar answered Sep 23 '22 00:09

Polynomial


Apparently this is not implemented in with dotnet publish but will be in the near future: https://github.com/dotnet/sdk/issues/795

like image 37
dstr Avatar answered Sep 21 '22 00:09

dstr