在 .csproj 中有下面的 Target
<Target Name="GenerateNSwag">
<ItemGroup>
<CurrentOpenApiReference>
<Command>$(NSwagExe_Net90) nswag.json /variables:Input="%(FullPath)",Output="%(OutputPath)"</Command>
</CurrentOpenApiReference>
</ItemGroup>
<Message Importance="high" Text="%0AGenerateNSwag:" />
<Message Importance="high" Text=" %(CurrentOpenApiReference.Command)" />
<Exec Command="%(CurrentOpenApiReference.Command)" LogStandardErrorAsError="true" />
</Target>
NSwag.ApiDescription.Client 版本是 14.2.0
<PackageReference Include="Microsoft.Extensions.ApiDescription.Client" Version="9.0.0">
build 时报错
System.InvalidOperationException: The command 'nswag.json' could not be found.
GenerateNSwag 对应的命令如下:
GenerateNSwag:
dotnet "C:\Users\Administrator\.nuget\packages\nswag.msbuild\14.2.0\buildTransitive\../tools/Net90/dotnet-nswag.dll" nswag.json /variables:Input="C:\dev\account\src\Cnblogs.Account.WebApi\obj\Cnblogs.Account.WebApi.json",Output="obj\Cnblogs.Account.WebApiClient.cs"
请问如何解决这个问题?
是不小心删除了 $(NSwagExe_Net90)
之后 nswag.json
之前的 run
命令引起的
<ItemGroup>
<CurrentOpenApiReference>
<Command>$(NSwagExe_Net90) run nswag.json /variables:Input="%(FullPath)",Output="%(OutputPath)"</Command>
</CurrentOpenApiReference>
</ItemGroup>