{"record":{"id":"9abe96c37ec0592d","repo":"dotnet/runtime","slug":"productversion-environment-variable-is-not-defined","errorCode":null,"errorMessage":"ProductVersion environment variable is not defined","messagePattern":"ProductVersion environment variable is not defined","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/native/rollup.config.defines.js","lineNumber":15,"sourceCode":"//! Licensed to the .NET Foundation under one or more agreements.\n//! The .NET Foundation licenses this file to you under the MIT license.\n\n/* eslint-disable no-console */\n\nimport gitCommitInfo from \"git-commit-info\";\n\nif (process.env.ContinuousIntegrationBuild === undefined) {\n    throw new Error(\"ContinuousIntegrationBuild environment variable is not defined\");\n}\nif (process.env.Configuration === undefined) {\n    throw new Error(\"Configuration environment variable is not defined\");\n}\nif (process.env.ProductVersion === undefined) {\n    throw new Error(\"ProductVersion environment variable is not defined\");\n}\n\nexport const configuration = process.env.Configuration !== \"Release\" && process.env.Configuration !== \"RELEASE\" ? \"Debug\" : \"Release\";\nexport const runtimeFlavor = process.env.RuntimeFlavor || \"CoreCLR\";\nexport const productVersion = process.env.ProductVersion;\nexport const isContinuousIntegrationBuild = process.env.ContinuousIntegrationBuild === \"true\" ? true : false;\nexport const staticLibDestination = process.env.StaticLibDestination || `../../artifacts/obj/native/net${productVersion}-browser-${configuration}-wasm/lib`;\n\nconsole.log(`Rollup configuration: Configuration=${configuration}, RuntimeFlavor=${runtimeFlavor}, ProductVersion=${productVersion}, ContinuousIntegrationBuild=${isContinuousIntegrationBuild}`);\n\nexport 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\";\nexport const banner_dts = banner + \"//! This is not considered public API with backward compatibility guarantees. \\n\";\nexport const keep_classnames = /(ManagedObject|ManagedError|Span|ArraySegment)/;\nexport const keep_fnames = /(dotnetUpdateInternals|dotnetUpdateInternalsSubscriber)/;\nexport const reserved = [\n    \"_ems_\", \"Module\",\n    \"dotnetInternals\", \"dotnetUpdateInternals\", \"dotnetUpdateInternalsSubscriber\", \"dotnetInitializeModule\",\n    \"dotnetLogger\", \"dotnetAssert\", \"dotnetApi\",","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/native/rollup.config.defines.js#L1-L33","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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`)."],"exampleFix":"# before\nrollup -c  # throws ProductVersion not defined\n\n# after\nProductVersion=8.0.0 ContinuousIntegrationBuild=false Configuration=Debug rollup -c","handlingStrategy":"validation","validationCode":"if (process.env.ProductVersion === undefined) {\n  throw new Error('Set ProductVersion (e.g. 8.0.0) before running rollup');\n}","typeGuard":"function hasProductVersionEnv(env: NodeJS.ProcessEnv): boolean {\n  return env.ProductVersion !== undefined;\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["dotnet-wasm","build","rollup","environment-variables","config"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}