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

If [Nuget] ConfigFile directive in cake configuration file has no folder — error rises #2161

Closed
shytikov opened this issue May 22, 2018 · 3 comments · Fixed by #2563

Comments

@shytikov
Copy link

commented May 22, 2018

What You Are Seeing?

Huge error message

What is Expected?

Normal operation

What version of Cake are you using?

0.27.2

Are you running on a 32 or 64 bit system?

64

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

Windows

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

No

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

Create cake.config file with following contents:

[Nuget]
UseInProcessClient=true
LoadDependencies=false
ConfigFile=./nuget.config 

Try to run cake. Exception rises, operation is blocked.

Output Log

PS C:\Make> .\build.ps1 -Verbosity Diagnostic
Preparing to run build script...
Running build script...
Module directory does not exist.
Found NuGet.config at: nuget.config
Error: Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = BuildCommand (ReflectionActivator), Services = [Cake.Commands.BuildCommand], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ScriptRunner (ReflectionActivator), Services = [Cake.Core.Scripting.IScriptRunner], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ScriptAnalyzer (ReflectionActivator), Services = [Cake.Core.Scripting.Analysis.IScriptAnalyzer], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ILoadDirectiveProvider[] (DelegateActivator), Services = [System.Collections.Generic.IEnumerable`1[[Cake.Core.Scripting.Processors.Loading.ILoadDirectiveProvider, Cake.Core, Version=0.27.2.0, Culture=neutral, PublicKeyToken=null]]], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = NuGetLoadDirectiveProvider (ReflectionActivator), Services = [Cake.Core.Scripting.Processors.Loading.ILoadDirectiveProvider], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = NuGetPackageInstaller (ReflectionActivator), Services = [Cake.NuGet.INuGetPackageInstaller, Cake.Core.Packaging.IPackageInstaller], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor(Cake.Core.IO.IFileSystem, Cake.Core.ICakeEnvironment, Cake.NuGet.INuGetContentResolver, Cake.Core.Diagnostics.ICakeLog, Cake.Core.Configuration.ICakeConfiguration)' on type 'NuGetPackageInstaller'. ---> root cannot be null or empty
Parameter name: root (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) ---> Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ScriptRunner (ReflectionActivator), Services = [Cake.Core.Scripting.IScriptRunner], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ScriptAnalyzer (ReflectionActivator), Services = [Cake.Core.Scripting.Analysis.IScriptAnalyzer], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ILoadDirectiveProvider[] (DelegateActivator), Services = [System.Collections.Generic.IEnumerable`1[[Cake.Core.Scripting.Processors.Loading.ILoadDirectiveProvider, Cake.Core, Version=0.27.2.0, Culture=neutral, PublicKeyToken=null]]], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = NuGetLoadDirectiveProvider (ReflectionActivator), Services = [Cake.Core.Scripting.Processors.Loading.ILoadDirectiveProvider], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = NuGetPackageInstaller (ReflectionActivator), Services = [Cake.NuGet.INuGetPackageInstaller, Cake.Core.Packaging.IPackageInstaller], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor(Cake.Core.IO.IFileSystem, Cake.Core.ICakeEnvironment, Cake.NuGet.INuGetContentResolver, Cake.Core.Diagnostics.ICakeLog, Cake.Core.Configuration.ICakeConfiguration)' on type 'NuGetPackageInstaller'. ---> root cannot be null or empty
Parameter name: root (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) ---> Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ScriptAnalyzer (ReflectionActivator), Services = [Cake.Core.Scripting.Analysis.IScriptAnalyzer], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ILoadDirectiveProvider[] (DelegateActivator), Services = [System.Collections.Generic.IEnumerable`1[[Cake.Core.Scripting.Processors.Loading.ILoadDirectiveProvider, Cake.Core, Version=0.27.2.0, Culture=neutral, PublicKeyToken=null]]], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = NuGetLoadDirectiveProvider (ReflectionActivator), Services = [Cake.Core.Scripting.Processors.Loading.ILoadDirectiveProvider], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = NuGetPackageInstaller (ReflectionActivator), Services = [Cake.NuGet.INuGetPackageInstaller, Cake.Core.Packaging.IPackageInstaller], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor(Cake.Core.IO.IFileSystem, Cake.Core.ICakeEnvironment, Cake.NuGet.INuGetContentResolver, Cake.Core.Diagnostics.ICakeLog, Cake.Core.Configuration.ICakeConfiguration)' on type 'NuGetPackageInstaller'. ---> root cannot be null or empty
Parameter name: root (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) ---> Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = ILoadDirectiveProvider[] (DelegateActivator), Services = [System.Collections.Generic.IEnumerable`1[[Cake.Core.Scripting.Processors.Loading.ILoadDirectiveProvider, Cake.Core, Version=0.27.2.0, Culture=neutral, PublicKeyToken=null]]], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = NuGetLoadDirectiveProvider (ReflectionActivator), Services = [Cake.Core.Scripting.Processors.Loading.ILoadDirectiveProvider], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = NuGetPackageInstaller (ReflectionActivator), Services = [Cake.NuGet.INuGetPackageInstaller, Cake.Core.Packaging.IPackageInstaller], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor(Cake.Core.IO.IFileSystem, Cake.Core.ICakeEnvironment, Cake.NuGet.INuGetContentResolver, Cake.Core.Diagnostics.ICakeLog, Cake.Core.Configuration.ICakeConfiguration)' on type 'NuGetPackageInstaller'. ---> root cannot be null or empty
Parameter name: root (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) ---> Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = NuGetLoadDirectiveProvider (ReflectionActivator), Services = [Cake.Core.Scripting.Processors.Loading.ILoadDirectiveProvider], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = NuGetPackageInstaller (ReflectionActivator), Services = [Cake.NuGet.INuGetPackageInstaller, Cake.Core.Packaging.IPackageInstaller], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor(Cake.Core.IO.IFileSystem, Cake.Core.ICakeEnvironment, Cake.NuGet.INuGetContentResolver, Cake.Core.Diagnostics.ICakeLog, Cake.Core.Configuration.ICakeConfiguration)' on type 'NuGetPackageInstaller'. ---> root cannot be null or empty
Parameter name: root (See inner exception for details.) (See inner exception for details.) (See inner exception for details.) ---> Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = NuGetPackageInstaller (ReflectionActivator), Services = [Cake.NuGet.INuGetPackageInstaller, Cake.Core.Packaging.IPackageInstaller], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---> An exception was thrown while invoking the constructor 'Void .ctor(Cake.Core.IO.IFileSystem, Cake.Core.ICakeEnvironment, Cake.NuGet.INuGetContentResolver, Cake.Core.Diagnostics.ICakeLog, Cake.Core.Configuration.ICakeConfiguration)' on type 'NuGetPackageInstaller'. ---> root cannot be null or empty
Parameter name: root (See inner exception for details.) (See inner exception for details.) ---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Cake.Core.IO.IFileSystem, Cake.Core.ICakeEnvironment, Cake.NuGet.INuGetContentResolver, Cake.Core.Diagnostics.ICakeLog, Cake.Core.Configuration.ICakeConfiguration)' on type 'NuGetPackageInstaller'. ---> root cannot be null or empty
Parameter name: root (See inner exception for details.) ---> System.ArgumentException: root cannot be null or empty
Parameter name: root
   at NuGet.Configuration.Settings..ctor(String root, String fileName, Boolean isMachineWideSettings)
   at NuGet.Configuration.Settings.ReadSettings(String root, String settingsPath, Boolean isMachineWideSettings)
   at NuGet.Configuration.Settings.LoadUserSpecificSettings(List`1 validSettingFiles, String root, String configFileName, IMachineWideSettings machineWideSettings, Boolean useTestingGlobalPath)
   at NuGet.Configuration.Settings.LoadSettingsForSpecificConfigs(String root, String configFileName, List`1 validSettingFiles, IMachineWideSettings machineWideSettings, Boolean loadAppDataSettings, Boolean useTestingGlobalPath)
   at NuGet.Configuration.Settings.LoadDefaultSettings(String root, String configFileName, IMachineWideSettings machineWideSettings, Boolean loadAppDataSettings, Boolean useTestingGlobalPath)
   at Cake.NuGet.Install.NuGetPackageInstaller..ctor(IFileSystem fileSystem, ICakeEnvironment environment, INuGetContentResolver contentResolver, ICakeLog log, ICakeConfiguration config)
   at lambda_method(Closure , Object[] )
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
   --- End of inner exception stack trace ---
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Autofac.Features.Collections.CollectionRegistrationSource.<>c__DisplayClass0_0.<RegistrationsFor>b__0(IComponentContext c, IEnumerable`1 p)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
   at lambda_method(Closure )
   at Cake.CakeApplication.Run(CakeOptions options)
   at Cake.Program.Main()
@shytikov

This comment has been minimized.

Copy link
Author

commented May 22, 2018

Basically referencing nuget.config from current folder is not working.

@gigi81

This comment has been minimized.

Copy link

commented Jan 31, 2019

I'm having a really hard time to make cake load the nuget.config file in the same folder. Getting the same error as above. Does anyone have a workaround? Thanks

@mholo65 mholo65 self-assigned this Jan 31, 2019
@mholo65 mholo65 added the Bug label Jan 31, 2019
@mholo65 mholo65 added this to the v0.33.0 milestone Jan 31, 2019
@gigi81

This comment has been minimized.

Copy link

commented Feb 3, 2019

Current workaround I have is to generate the cake.config with the full path to nuget.config from the Powershell script before running cake

@devlead devlead modified the milestones: v0.33.0, v0.34.0 Feb 27, 2019
mholo65 added a commit to mholo65/cake that referenced this issue Jun 10, 2019
devlead added a commit that referenced this issue Jun 14, 2019
* mholo65-feature/GH-2161:
  (GH-2161) Make NuGet.Config path absolute.
devlead added a commit that referenced this issue Jul 16, 2019
* release/0.34.0: (27 commits)
  Updated version and release notes.
  add null checks
  Enhance the Teamcity Provider's PullRequest detection
  (GH-2572) Update build dependencies * Fixes #2572
  (GH-2161) Make NuGet.Config path absolute.
  Added Runtime to DotNetCoreTestSettings and test for it.
  added missing runtime property and adapted tests
  Implement the NoImplicitTarget property and extension method to enable opt-out of default target Build. Added tests for the relevant scenarios.
  (GH-2553) Address HttpClient issue on Mono
  Run integration tests on Travis CI
  Update SDK & Fix SDK root variable
  Added HttpClient integration test
  Added NuGet pack files unit test
  closes issue #2157.
  Rewrite in-proc NuGet and update to NuGet 5.0
  GH2536: Additional formatting options for XmlPoke
  Rename octo.exe to Octo.exe
  Added new nuspec properties to NuGetPackSettings and implemented related functions.
  Changes for stable Visual Studio 2019 release * fixes #2519
  (GH-2523) Fix Cake.Tool package description * fixes #2523
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.