Skip to content

Conversation

@dylanvdmerwe
Copy link
Contributor

Often we have issues where the nswag.json file will specify the "runtime" to something other than "net80". In my case "net90" and now going forward "net100".

With NSwag installed with NPM, either as a global package or as a devDependencies in package.json. In my case "nswag" is listed as a devDependency in package.json.

If you then execute the NSwag NPM script (nswag run nswag.json), the js script sets the defaultCoreVersion to Net80. This will load the NSwag command line tool for .NET Core Net80.

But because the runtime specified in the config file is different (net90 in my case) you will get this error:

NSwag NPM CLI
NSwag command line tool for .NET Core Net80, toolchain v14.2.0.0 (NJsonSchema v11.1.0.0 (Newtonsoft.Json v13.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: C:\Projects\WebsiteProjects\Website.Site\site\node_modules\nswag\bin\binaries\Net80

Executing file '..\..\..\WebServiceProjects\WebService.SiteApi\nswag.json' with variables ''...
System.InvalidOperationException: The specified runtime in the document (Net90) differs from the current process runtime (Net80). Change the runtime with the '/runtime:Net90' parameter or run the file with the correct command line binary.

You'll see the incorrect binary was used (Net80 instead of Net90)

If you then try run npm run nswag.json /runtime:Net90 you will get this error:

NConsole.UnusedArgumentException: Unrecognised arguments are present: [/runtime:Net90]

What this fix does is attempt to set defaultCoreVersion from the runtime specified in the json configuration file (if it exists).

In the case where the config file sets 'runtime': 'net90', and you run nswag run nswag.json, defaultCoreVersion is set to Net90 for you loading the appropriate binary:

NSwag NPM CLI
Found runtime from config: Net90
Using runtime: Net90
NSwag command line tool for .NET Core Net90

If runtime is not set in the config file, the original defaultCoreVersion of Net80 will be used.

Tested on latest 14.6.2.

@RicoSuter RicoSuter merged commit 2d3437d into RicoSuter:master Nov 20, 2025
3 checks passed
@RicoSuter
Copy link
Owner

v14.6.3

This was referenced Nov 21, 2025
github-actions bot pushed a commit to EelcoLos/nx-tinkering that referenced this pull request Nov 24, 2025
Updated [NSwag.Core](https://github.com/RicoSuter/NSwag) from 14.6.2 to
14.6.3.

<details>
<summary>Release notes</summary>

_Sourced from [NSwag.Core's
releases](https://github.com/RicoSuter/NSwag/releases)._

## 14.6.3

## What's Changed

* Using final .NET 10 libraries/SDK and minor .NET 10 fixes (v14.6.3) by
@​RicoSuter in RicoSuter/NSwag#5307
* Updated packages for CVE-2025-55315 by @​erjdev in
RicoSuter/NSwag#5299
* fix: nswag.js try detect the runtime version from config file by
@​dylanvdmerwe in RicoSuter/NSwag#5302

## New Contributors

* @​erjdev made their first contribution in
RicoSuter/NSwag#5299
* @​dylanvdmerwe made their first contribution in
RicoSuter/NSwag#5302

**Full Changelog**:
RicoSuter/NSwag@v14.6.2...v14.6.3

Commits viewable in [compare
view](RicoSuter/NSwag@v14.6.2...v14.6.3).
</details>

Updated [NSwag.Core.Yaml](https://github.com/RicoSuter/NSwag) from
14.6.2 to 14.6.3.

<details>
<summary>Release notes</summary>

_Sourced from [NSwag.Core.Yaml's
releases](https://github.com/RicoSuter/NSwag/releases)._

## 14.6.3

## What's Changed

* Using final .NET 10 libraries/SDK and minor .NET 10 fixes (v14.6.3) by
@​RicoSuter in RicoSuter/NSwag#5307
* Updated packages for CVE-2025-55315 by @​erjdev in
RicoSuter/NSwag#5299
* fix: nswag.js try detect the runtime version from config file by
@​dylanvdmerwe in RicoSuter/NSwag#5302

## New Contributors

* @​erjdev made their first contribution in
RicoSuter/NSwag#5299
* @​dylanvdmerwe made their first contribution in
RicoSuter/NSwag#5302

**Full Changelog**:
RicoSuter/NSwag@v14.6.2...v14.6.3

Commits viewable in [compare
view](RicoSuter/NSwag@v14.6.2...v14.6.3).
</details>

Updated
[NSwag.Generation.AspNetCore](https://github.com/RicoSuter/NSwag) from
14.6.2 to 14.6.3.

<details>
<summary>Release notes</summary>

_Sourced from [NSwag.Generation.AspNetCore's
releases](https://github.com/RicoSuter/NSwag/releases)._

## 14.6.3

## What's Changed

* Using final .NET 10 libraries/SDK and minor .NET 10 fixes (v14.6.3) by
@​RicoSuter in RicoSuter/NSwag#5307
* Updated packages for CVE-2025-55315 by @​erjdev in
RicoSuter/NSwag#5299
* fix: nswag.js try detect the runtime version from config file by
@​dylanvdmerwe in RicoSuter/NSwag#5302

## New Contributors

* @​erjdev made their first contribution in
RicoSuter/NSwag#5299
* @​dylanvdmerwe made their first contribution in
RicoSuter/NSwag#5302

**Full Changelog**:
RicoSuter/NSwag@v14.6.2...v14.6.3

Commits viewable in [compare
view](RicoSuter/NSwag@v14.6.2...v14.6.3).
</details>

Updated [NSwag.MSBuild](https://github.com/RicoSuter/NSwag) from 14.6.2
to 14.6.3.

<details>
<summary>Release notes</summary>

_Sourced from [NSwag.MSBuild's
releases](https://github.com/RicoSuter/NSwag/releases)._

## 14.6.3

## What's Changed

* Using final .NET 10 libraries/SDK and minor .NET 10 fixes (v14.6.3) by
@​RicoSuter in RicoSuter/NSwag#5307
* Updated packages for CVE-2025-55315 by @​erjdev in
RicoSuter/NSwag#5299
* fix: nswag.js try detect the runtime version from config file by
@​dylanvdmerwe in RicoSuter/NSwag#5302

## New Contributors

* @​erjdev made their first contribution in
RicoSuter/NSwag#5299
* @​dylanvdmerwe made their first contribution in
RicoSuter/NSwag#5302

**Full Changelog**:
RicoSuter/NSwag@v14.6.2...v14.6.3

Commits viewable in [compare
view](RicoSuter/NSwag@v14.6.2...v14.6.3).
</details>

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants