cake
cake copied to clipboard
Addin Framework parsing fails
What You Are Seeing?
Error: System.InvalidOperationException: Something went wrong when parsing framework.
What is Expected?
Script should run withour error
What version of Cake are you using?
Version 0.16.2+Branch.main.Sha.fb23be463dacfa51c9b19a7cd111149dda7e8c6b
Are you running on a 32 or 64 bit system?
64-bit
What environment are you running on? Windows? Linux? Mac?
Windows 7
Are you running on a CI Server? If so, which one?
No
How Did You Get This To Happen? (Steps to Reproduce)
Attaching debugger to a script that installs any Cake Addin. I am using VS Code and have tried with Visual Studio too
Output Log
Error: System.InvalidOperationException: Something went wrong when parsing framework.
at Cake.NuGet.V3.NuGetV3ContentResolver.ParseFromDirectoryPath(NuGetFramework current, DirectoryPath path)
at Cake.NuGet.V3.NuGetV3ContentResolver.GetAddinAssemblies(DirectoryPath path)
at Cake.NuGet.NuGetContentResolver.GetFiles(DirectoryPath path, PackageReference package, PackageType type)
at Cake.NuGet.NuGetPackageInstaller.Install(PackageReference package, PackageType type, DirectoryPath path)
at Cake.Core.Scripting.ScriptProcessor.InstallAddins(ScriptAnalyzerResult analyzerResult, DirectoryPath installPath)
at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
at Cake.Commands.DebugCommand.Execute(CakeOptions options)
at Cake.CakeApplication.Run(CakeOptions options)
at Cake.Program.Main()
@aateeque how does the #addin directive/in you build.cake
@devlead I have #addin nuget:?package=Cake.ReSharperReports&version=0.3.1. Same if I replace that package with Cake.AliaSql for example
You mentioned using VS Code for debugging, you are the using Cake.CoreCLR and not Cake, am I correct?
AFAIK, Cake.ReSharperReports and Cake.AliaSql are .NET 4.5 packages, and does not then work with .NET Core...
@mholo65 I have tried compiling & running latest master in VS 2015 and observe the same behaviour
@aateeque Do you have a cake.config configuration file? How are you executing the build? Are you using Cake.CoreClr or Cake package?
@aateeque can you point us at at complete reproduction of this issue. I.e. Complete cake and bootstrapper you are using, and any other related files.
To narrow down the problem, I have just got #addin nuget:?package=Cake.AliaSql in my .cake file which I pass in visual studio debug as app arg.
The exception occurs in the Install Addins step in ScriptRunner.Run(). Specifically, in NugetV3ContentResolver line 49 the assembly.Path.FullPath passed in is C:/dev/code/cake/cake/src/Cake/bin/Debug/Addins/Cake.AliaSql/Cake.AliaSql.dll and
path.GetRelativePath(...) returns relative.FullPath with Cake.AliaSql.dll.
I am sure there is a good reason, but intuitively shouldn't that relative.FullPath be the same as assembly.Path.FullPath passed earlier?
@aateeque No, it should be the relative path. The error is exactly what it says, it cannot parse the framework from the addin path. The AliasSQL NuGet package does not follow the naming conventions which should be something like lib/net45/Cake.AliaSql.dll.
@patriksvensson that makes sense then! Thanks. Could we change that to a more meaningful message perhaps? "Expected to find TFM in package path, but found none."