Eri*_*k I 2 msbuild .net-core swashbuckle asp.net-core
我正在尝试构建一个包含 swashbuckle 的项目,为了排除故障,我想将 swagger 包含到发布版本中。
我现在把范围缩小到这个:
当我跑
dotnet publish -o ./out
Run Code Online (Sandbox Code Playgroud)
xml 文件 ProjectName.xml 是在 out 文件夹中生成的,当我运行时
dotnet publish -o ./out -c Release
Run Code Online (Sandbox Code Playgroud)
不会生成 xml 文件。
csproj 文件如下所示:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>obj\Debug\ProjectName.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Folder Include="somefolder\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.4" />
...
<PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />
...
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.3" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="3.0.0" />
</ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
而且我很确定我可以在给定的时间进一步缩小范围,但我对 dotnet 还很陌生,而且我猜有人已经看到了这个问题。
我正在寻找一种方法来让这个工作或解释为什么这太错误而不可行。
PS:在 linux 上运行,所以没有 Visual Studio。否则,这可能是我所知道的一个可能的解决方案:Swashbuckle + XmlComments 在本地工作,但在服务器上生成 swagger 失败
将此添加到您的 csproj 文件而不是设置OutputPath或DocumentationFile:
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
588 次 |
| 最近记录: |