Replies: 4 comments
-
Hi @freekind, This is a by-product of a behaviour from NuGet. If you specify the source of the package then the Cake NuGetPackageInstaller will add a The solution for this is to remove the source from the addin directive
That should hint nuget to look for packages also on that source (on top of you machine level config). More on the Nuget install command. Regards, Seb. |
Beta Was this translation helpful? Give feedback.
-
On second thought @patriksvensson, given this feature is bound to confuse people more than it will help them, shouldn't we remove this option altogether and direct people through documentation and examples to add their custom sources on the project Nuget.Config instead? Because if we are honest, what are the odds that a package on a custom feed will not rely at all on a component that is on the nuget feed at some dependency level. And given that you can't add multiple URLs to the addInn directive (nor would I think that is a nice solution), this becomes a not so useful feature to begin with. |
Beta Was this translation helpful? Give feedback.
-
@freekind 0.21.1 targets .NET 4.5 and requires assemblies and dependencies to be in the net45 moniker in your nuget packages, make sure the nuget package has the correct folder structure, the error indicates it's not. A nuget a mutitargetet nuget folder struncture could look something like this:
If the assemblies are in a newer version than the consuming assembly it won't work, so verify that the package is in the correct folder, a nuget is just a zip file so you could just unzip it or use something like the NuGet Package Explorer tool which will visualize package targets and dependencies. The current target framework for Cake if .NET 4.6 for Cake.exe or netstandard1.6 for Cake.CoreCLR. @sebandres in the next release we won't be using nuget.exe by default, from Cake 0.23.0 you can opt-in to the inproc new behavior with configuration documented here. Essentially setting environment variable CAKE_NUGET_USEINPROCESSCLIENT to true or passing parameter As we there have full control of the installations process it's easier for us to support edge cases, or Cake specific scenarios. This will add proper support for referencing addins/assemblies with dependencies, we've got no plans of removing the ability to specify a source from the addin directive. |
Beta Was this translation helpful? Give feedback.
-
Hi @devlead, Thanks for the response. I just had a look at the new NuGetPackageInstaller you mentioned and it does seem to address this problem by aggregating the sources on top of the provided on the addin url which is great news! I'll opt in on our projects and give that a go. Regards, Seb. |
Beta Was this translation helpful? Give feedback.
-
Our organisation has a custom NuGet repository for hosting our reusable libraries. By the meantime, we are exploring how cake works to integrate it to our CI process.
What You Are Seeing?
However, when I try to install a package from that local repo with the #addin directive, I keep getting the following error:
Could not find any assemblies compatible with .NETFramework,Version=v4.5.
Here's the code snippet I'm using.
#addin "nuget:file://mycustomrepo?package=mylocalpackage"
I've been reading a lot of threads about that error and I've done the following steps up to now:
Also tried different #addin syntax such as:
#addin "nuget:?package=mylocalpackage" - same result as my NuGet sources refer to the right repos.
#addin "nuget:?package=mynonexistinglocalpackage" - I get a coherent error message.
What is Expected?
I expect my package to be flawlessly installed the same way it is when I use another NuGet endpoint.
What version of Cake are you using?
0.21.1
Are you running on a 32 or 64 bit system?
32 bit system
What environment are you running on? Windows? Linux? Mac?
Windows 7, Visual Studio 2015.
Are you running on a CI Server? If so, which one?
not for that test.
How Did You Get This To Happen? (Steps to Reproduce)
create a NuGet package that complies to the NuGet standards and host it locally.
create a new Cake AddIn project in Visual Studio and create a new cake-build script;
Reference that package through the #addin directive in a new cake-build script (build.cake), as shown above.
4, Run the script through the Task Runner Explorer OR launch the script through the command line.
Output Log
From the commandline with cake.exe:
D:\PROJETS\Git\POCCake\Cake.MyModule1\Cake.Addin1>cake --verbosity=diagnostic
Module directory does not exist.
Analyzing build script...
Analyzing D:/PROJETS/Git/POCCake/Cake.MyModule1/Cake.Addin1/build.cake...
Processing build script...
Installing addins...
Installing NuGet package IAFG.IA.RC.Development.Health.Cake.AddIns...
Executing: "C:/WINDOWS/SysWOW64/nuget.exe" install "IAFG.IA.RC.Development.Healt
h.Cake.AddIns" -OutputDirectory "D:/PROJETS/Git/POCCake/Cake.MyModule1/Cake.Addi
n1/tools/Addins" -Source "file://mycustomrepo" -Versi
on "1.0.1" -ExcludeVersion -NonInteractive
Could not find any assemblies compatible with .NETFramework,Version=v4.5.
Error: Cake.Core.CakeException: Failed to install addin 'IAFG.IA.RC.Development.
Health.Cake.AddIns'.
à Cake.Core.Scripting.ScriptProcessor.InstallAddins(ScriptAnalyzerResult anal
yzerResult, DirectoryPath installPath)
à Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath,
IDictionary`2 arguments)
à Cake.Commands.BuildCommand.Execute(CakeOptions options)
à Cake.CakeApplication.Run(CakeOptions options)
à Cake.Program.Main()
From the commandline with nuget, with the very same instruction pushed by cake:
D:\PROJETS\Git\POCCake\Cake.MyModule1\Cake.Addin1>C:\windows\syswow64\nuget.exe
install "IAFG.IA.RC.Development.Health.Cake.AddIns" -OutputDirectory "D:/PROJETS
/Git/POCCake/Cake.MyModule1/Cake.AddIn1/tools/Addins" -Source "file://mycustomrepo" -Version "1.0.1" -ExcludeVersion -NonInteractive
Feeds used:
C:\Users\leddcf.nuget\packages
file://mycustomrepo
Attempting to gather dependency information for package 'IAFG.IA.RC.Development.
Health.Cake.AddIns.1.0.1' with respect to project 'D:/PROJETS/Git/POCCake/Cake.M
yModule1/Cake.AddIn1/tools/Addins', targeting 'Any,Version=v0.0'
Gathering dependency information took 93.37 ms
Attempting to resolve dependencies for package 'IAFG.IA.RC.Development.Health.Ca
ke.AddIns.1.0.1' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'IAFG.IA.RC.Development.Health.Cake.AddIns.
1.0.1'
Resolved actions to install package 'IAFG.IA.RC.Development.Health.Cake.AddIns.1
.0.1'
Retrieving package 'IAFG.IA.RC.Development.Health.Cake.AddIns 1.0.1' from 'file:
//mycustomrepo'.
Retrieving package 'Ninject 3.2.2' from 'C:\Users\leddcf.nuget\packages'.
Adding package 'Ninject.3.2.2' to folder 'D:\PROJETS\Git\POCCake\Cake.MyModule1
Cake.AddIn1\tools\Addins'
Added package 'Ninject.3.2.2' to folder 'D:\PROJETS\Git\POCCake\Cake.MyModule1\C
ake.AddIn1\tools\Addins'
Successfully installed 'Ninject 3.2.2' to D:/PROJETS/Git/POCCake/Cake.MyModule1/
Cake.AddIn1/tools/Addins
Adding package 'IAFG.IA.RC.Development.Health.Cake.AddIns.1.0.1' to folder 'D:\P
ROJETS\Git\POCCake\Cake.MyModule1\Cake.AddIn1\tools\Addins'
Added package 'IAFG.IA.RC.Development.Health.Cake.AddIns.1.0.1' to folder 'D:\PR
OJETS\Git\POCCake\Cake.MyModule1\Cake.AddIn1\tools\Addins'
Successfully installed 'IAFG.IA.RC.Development.Health.Cake.AddIns 1.0.1' to D:/P
ROJETS/Git/POCCake/Cake.MyModule1/Cake.AddIn1/tools/Addins
Executing nuget actions took 144.1 ms
The structure of the package is as follows:
Beta Was this translation helpful? Give feedback.
All reactions