Skip to content

source-building .NET 7 fails when building npmprojects #46304

Open
@omajid

Description

@omajid

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

(This is a follow up from #42378 which is now locked. Sorry about dropping the ball on that.)

When building ASP.NET Core, turning on source-build mode makes the build fail when it's trying to build nodejs projects

I am currently testing with aspnetcore commit 9ffffa45789328985d43cc70a378fd8570988f27, but based on the issue linked above, the bug has existed for a while now.

This works:

./eng/build.sh  --ci --configuration Release --restore --build --pack 

This fails:

./eng/build.sh  --ci --configuration Release --restore --build --pack /p:ArcadeBuildFromSource=true

The build failure looks like this:

    $ yarn run build:lint && yarn run build:esm && yarn run build:cjs && yarn run build:browser && yarn run build:uglify                                      
    $ node ../common/node_modules/eslint/bin/eslint ./src --ext .ts --resolve-plugins-relative-to ../common                                                   
    $ node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d                                             $ node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module commonjs --outDir ./dist/cjs                                          
    $ node ../common/node_modules/webpack-cli/bin/cli.js                                                                                                                                                                                                                                                                    
    Duplicate Sources / Packages - No duplicates found. 🚀                                                                                                                                                                                                                                                                  
    asset signalr-protocol-msgpack.js 80.6 KiB [emitted] (name: signalr-protocol-msgpack) 1 related asset                                                         asset signalr-protocol-msgpack.min.js 28.6 KiB [emitted] [minimized] (name: signalr-protocol-msgpack.min) 1 related asset                                 
    orphan modules 89.3 KiB [orphan] 20 modules                                                                                                               
    runtime modules 1.31 KiB 6 modules                                                                                                                            built modules 76.9 KiB [built]                                                                                                                            
      ./src/browser-index.ts + 15 modules 76.9 KiB [built] [code generated]                                                                                   
        ModuleConcatenation bailout: Cannot concat with external "signalR": umd externals can't be concatenated                                               
      external "signalR" 42 bytes [built] [code generated]                                                                                                    
        ModuleConcatenation bailout: umd externals can't be concatenated                                                                                      
    webpack 5.75.0 compiled successfully in 2071 ms                                                                                                           
    $ node ../common/node_modules/terser/bin/terser -m -c --ecma 2019 --module --source-map "url='signalr-protocol-msgpack.min.js.map',content='./dist/browser/signalr-protocol-msgpack.js.map'" --comments -o ./dist/browser/signalr-protocol-msgpack.min.js ./dist/browser/signalr-protocol-msgpack.js                    
    Done in 9.65s.                                                                                                                                            
    yarn version v1.22.10                                                                                                                                     
    info Current version: 5.0.0-dev                                                                                                                           
    info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.                                                                  
    error Invalid version supplied.                                                                                                                           
  /aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets(108,5): error MSB6006: "yarn" exited with code 1. [/aspnetcore/artifacts/source-build/self/src/src/SignalR/clients/ts/signalr-protocol-msgpack/signalr-protocol-msgpack.npmproj]             
  ##vso[task.logissue type=error;sourcepath=/aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets;linenumber=108;columnnumber=5;code=MSB6006;](NETCORE_ENGINEERING_TELEMETRY=Build) "yarn" exited with code 1.                                                                
    yarn version v1.22.10                                                                                                                                     
    info Current version: 5.0.0-dev                                                                                                                           
    error Invalid version supplied.                                                                                                                           
    info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.                                                                  
  /aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets(108,5): error MSB6006: "yarn" exited with code 1. [/aspnetcore/artifacts/source-build/self/src/src/SignalR/clients/ts/signalr/signalr.npmproj]                                               
  ##vso[task.logissue type=error;sourcepath=/aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets;linenumber=108;columnnumber=5;code=MSB6006;](NETCORE_ENGINEERING_TELEMETRY=Build) "yarn" exited with code 1.                                                                
    yarn version v1.22.10                                                                                                                                     
    info Current version: 8.0.0-dev                                                                                                                           
    error Invalid version supplied.                                                                                                                           
    info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.                                                                  
  /aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets(108,5): error MSB6006: "yarn" exited with code 1. [/aspnetcore/artifacts/source-build/self/src/src/JSInterop/Microsoft.JSInterop.JS/src/Microsoft.JSInterop.JS.npmproj]                      
  ##vso[task.logissue type=error;sourcepath=/aspnetcore/artifacts/source-build/self/src/eng/targets/Npm.Common.targets;linenumber=108;columnnumber=5;code=MSB6006;](NETCORE_ENGINEERING_TELEMETRY=Build) "yarn" exited with code 1.     

This didn't seem a too big of a problem back when #42378 was opened, but with #45883, this issue makes the build break with the VMR.

From what I can tell, PackageVersion is set to empty here:

<Yarn Command="version --no-git-tag-version --new-version $(PackageVersion)" IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)" />

And that makes the yarn command fail.

I don't know why PackageVersion is empty. I know that arcade handles ${FOO}PackageVersion specially for PackageVersions.props. Could that be setting PackageVersion to empty too? Is there some way I can track what's setting PackageVersion to empty (or perhaps, not setting to the right version it when it should be set)?

$ node --version
v18.12.1
$ yarnpkg --version
1.22.19
$ npm --version
8.19.2

cc @chrisrummel @dougbu @mthalman @MichaelSimons @wtgodbe

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

area-infrastructureIncludes: MSBuild projects/targets, build scripts, CI, Installers and shared frameworktask

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions