dotnet/runtime · error · Error
ProductVersion environment variable is not defined
Error message
ProductVersion environment variable is not defined
What it means
rollup.config.defines.js requires ProductVersion (e.g. 8.0.0) so it can stamp version-specific output paths and the envConstants block baked into the runtime. Undefined ProductVersion would embed 'undefined' into artifact paths and the runtime's self-description, so the config fails fast at line 14-16.
Source
Thrown at src/native/rollup.config.defines.js:15
//! Licensed to the .NET Foundation under one or more agreements.
//! The .NET Foundation licenses this file to you under the MIT license.
/* eslint-disable no-console */
import gitCommitInfo from "git-commit-info";
if (process.env.ContinuousIntegrationBuild === undefined) {
throw new Error("ContinuousIntegrationBuild environment variable is not defined");
}
if (process.env.Configuration === undefined) {
throw new Error("Configuration environment variable is not defined");
}
if (process.env.ProductVersion === undefined) {
throw new Error("ProductVersion environment variable is not defined");
}
export const configuration = process.env.Configuration !== "Release" && process.env.Configuration !== "RELEASE" ? "Debug" : "Release";
export const runtimeFlavor = process.env.RuntimeFlavor || "CoreCLR";
export const productVersion = process.env.ProductVersion;
export const isContinuousIntegrationBuild = process.env.ContinuousIntegrationBuild === "true" ? true : false;
export const staticLibDestination = process.env.StaticLibDestination || `../../artifacts/obj/native/net${productVersion}-browser-${configuration}-wasm/lib`;
console.log(`Rollup configuration: Configuration=${configuration}, RuntimeFlavor=${runtimeFlavor}, ProductVersion=${productVersion}, ContinuousIntegrationBuild=${isContinuousIntegrationBuild}`);
export const banner = "//! Licensed to the .NET Foundation under one or more agreements.\n//! The .NET Foundation licenses this file to you under the MIT license.\n//! This is generated file, see src/native/rollup.config.js\n\n";
export const banner_dts = banner + "//! This is not considered public API with backward compatibility guarantees. \n";
export const keep_classnames = /(ManagedObject|ManagedError|Span|ArraySegment)/;
export const keep_fnames = /(dotnetUpdateInternals|dotnetUpdateInternalsSubscriber)/;
export const reserved = [
"_ems_", "Module",
"dotnetInternals", "dotnetUpdateInternals", "dotnetUpdateInternalsSubscriber", "dotnetInitializeModule",
"dotnetLogger", "dotnetAssert", "dotnetApi",View on GitHub (pinned to 60108ba66e)
Solutions
- Use the MSBuild target for the native project, which derives ProductVersion from the project file and exports it.
- Set ProductVersion explicitly to match the runtime version, e.g. `ProductVersion=8.0.0`.
- Confirm the variable is present in the same shell that runs rollup (`echo $ProductVersion`).
Example fix
# before rollup -c # throws ProductVersion not defined # after ProductVersion=8.0.0 ContinuousIntegrationBuild=false Configuration=Debug rollup -c
Defensive patterns
Strategy: validation
Validate before calling
if (process.env.ProductVersion === undefined) {
throw new Error('Set ProductVersion (e.g. 8.0.0) before running rollup');
} Type guard
function hasProductVersionEnv(env: NodeJS.ProcessEnv): boolean {
return env.ProductVersion !== undefined;
} Prevention
- Let MSBuild derive ProductVersion from the project file.
- Export ProductVersion in your dev shell or CI job.
- After version bumps, propagate the new ProductVersion to all build environments.
When it happens
Trigger: Importing rollup.config.defines.js (transitively via the rollup build) without ProductVersion in the environment. The check at rollup.config.defines.js:14-16 throws before any exports are produced. Common when invoking rollup outside of MSBuild.
Common situations: Running rollup by hand. A CI job that sets ContinuousIntegrationBuild and Configuration but forgets ProductVersion. Building after a version bump where the new prop was not propagated to the env.
Related errors
- ContinuousIntegrationBuild environment variable is not defin
- Configuration environment variable is not defined
- Expected environment variable '${k}' to be a string but it w
- Unexpected behavior ${asset.behavior} of asset ${asset.name}
- __stack_pointer was not preserved by the linker or optimizer
AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10).
Data as JSON: /api/errors/9abe96c37ec0592d.
Report an issue: GitHub.