protected abstract SdkResultBase ResolveSdk(SdkReference sdk, SdkResolverContextBase context, SdkResultFactoryBase factory);
Esempio n. 2
0
 public abstract Microsoft.Build.Framework.SdkResult Resolve(Microsoft.Build.Framework.SdkReference sdkReference, Microsoft.Build.Framework.SdkResolverContext resolverContext, Microsoft.Build.Framework.SdkResultFactory factory);
        public override SdkResultBase Resolve(SdkReference sdk, SdkResolverContextBase context, SdkResultFactoryBase factory)
        {
            // Escape hatch to disable this resolver
            if (Traits.Instance.EscapeHatches.DisableNuGetSdkResolver)
            {
                return(null);
            }

#if FEATURE_APPDOMAIN
            AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolve;
#else
            AssemblyLoadContext.Default.Resolving += AssemblyResolve;
#endif

            try
            {
                return(ResolveSdk(sdk, context, factory));
            }
            finally
            {
#if FEATURE_APPDOMAIN
                AppDomain.CurrentDomain.AssemblyResolve -= AssemblyResolve;
#else
                AssemblyLoadContext.Default.Resolving -= AssemblyResolve;
#endif
            }
        }