Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression on DotNetTool Module: Targets multiple TFMs causing warnings #3238

Closed
augustoproiete opened this issue Mar 6, 2021 · 1 comment
Assignees
Labels
Milestone

Comments

@augustoproiete
Copy link
Member

The DotNetTool Module that shipped as part of the Cake release v1.1.0 regressed a fix that was applied in the old repo to target netstandard2.0 only due to known limitations in how modules are loaded (docs, #2256).

When we brought the code of the DotNetTool Module to this repo, it went back to targeting multiple TFMs: net5.0;netstandard2.0;net461.

This causes warnings to appear in the logs for users that are using Cake <= 1.0.0 and are using the DotNetTool module in their build scripts.

What You Are Seeing?

C:\augustoproiete\cake\tool\1.0.0>dotnet cake test-dotnettool-module.cake
Could not load module 'C:/augustoproiete/cake/tool/1.0.0/tools/Modules/Cake.DotNetTool.Module.1.1.0/lib/net5.0/Cake.DotNetTool.Module.dll'. System.ArgumentNullException: Value cannot be null. (Parameter 'element')
   at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)
   at System.Reflection.CustomAttributeExtensions.GetCustomAttributes[T](Assembly element)
   at Cake.Infrastructure.Composition.ModuleSearcher.LoadModule(FilePath path, ICakeConfiguration configuration) in C:\projects\cake\src\Cake\Infrastructure\Composition\ModuleSearcher.cs:line 68
Could not load module 'C:/augustoproiete/cake/tool/1.0.0/tools/Modules/Cake.DotNetTool.Module.1.1.0/lib/netstandard2.0/Cake.DotNetTool.Module.dll'. System.ArgumentNullException: Value cannot be null. (Parameter 'element')
   at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)
   at System.Reflection.CustomAttributeExtensions.GetCustomAttributes[T](Assembly element)
   at Cake.Infrastructure.Composition.ModuleSearcher.LoadModule(FilePath path, ICakeConfiguration configuration) in C:\projects\cake\src\Cake\Infrastructure\Composition\ModuleSearcher.cs:line 68

What is Expected?

Zero warnings

What version of Cake are you using?

1.0.0 and lower

Are you running on a 32 or 64 bit system?

N/A

What environment are you running on? Windows? Linux? Mac?

N/A

Are you running on a CI Server? If so, which one?

N/A

How Did You Get This To Happen? (Steps to Reproduce)

mkdir cake-1.0.0
cd cake-1.0.0
dotnet new tool-manifest
dotnet tool install Cake.Tool --version 1.0.0
code build.cake
#module "nuget:?package=Cake.DotNetTool.Module&version=1.1.0"
#tool "dotnet:https://api.nuget.org/v3/index.json?package=exceldna-unpack&version=2.1.0"
mkdir cake-1.0.0
cd cake-1.0.0
dotnet new tool-manifest
dotnet tool install Cake.Tool --version 1.0.0
cd ..

Output Log

N/A

@augustoproiete
Copy link
Member Author

We decided we'll leave it as is and document our general recommendation:

  • If you use Cake.DotNetTool.Module already on your builds, you should either:

  • (1) Upgrade Cake to version 1.1.0, and remove the Cake.DotNetTool.Module from your build script (as it's no longer needed)

or

  • (2) Pin Cake.DotNetTool.Module to a version compatible with the Cake version that you use. Cake.DotNetTool.Module version 1.0.1 is the last version compatible with Cake 1.0.0. Starting with this release, Cake.DotNetTool.Module will always be released together with Cake and will only be compatible with the current release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant