gpt4 book ai didi

c# - 命令 "run C:\agent\_work\8\s\Web\webapi.nswag"以代码 9009 退出

转载 作者:行者123 更新时间:2023-11-30 15:54:56 25 4
gpt4 key购买 nike

我正在尝试构建一个安装了 NSwagger 的项目。这是我的 .csproj 配置:

<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NSwag.MSBuild.11.15.3\build\NSwag.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NSwag.MSBuild.11.15.3\build\NSwag.MSBuild.props'))" />
</Target>

<Target Name="BeforeBuild">
<Exec Command="$(NSwagExe) run $(SolutionDir)webapi.nswag" />
</Target>

错误:

ValidateSolutionConfiguration: Building solution configuration "Debug|Any CPU". Project "C:\agent_work\8\s\Web\CSU.Marketplace.Web.sln" (1) is building "C:\agent_work\8\s\Web\CSU.Marketplace.Web\CSU.Marketplace.Web.csproj" (2) on node 1 (default targets). BeforeBuild: run C:\agent_work\8\s\Web\webapi.nswag 'run' is not recognized as an internal or external command, operable program or batch file. Web\CSU.Marketplace.Web\CSU.Marketplace.Web.csproj(942,5): Error MSB3073: The command " run C:\agent_work\8\s\Web\webapi.nswag" exited with code 9009.

最佳答案

项目文件不导入 NSwag 构建任务。因此在构建时,$(NSwagExe) 扩展为一个空字符串,并且 msbuild 尝试运行命令的其余部分:

运行 C:\agent_work\8\s\Web\webapi.nswag

添加这样的东西:

<ItemGroup>
<PackageReference Include="NSwag.MSBuild" Version="11.12.9" />
</ItemGroup>

关于c# - 命令 "run C:\agent\_work\8\s\Web\webapi.nswag"以代码 9009 退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49243501/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com