File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
test/Microsoft.VisualStudio.Composition.Analyzers.Tests/Helpers Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
4+ #pragma warning disable SA1202 // Elements should be ordered by access - because field initializer depend on each other
5+
46internal static class ReferencesHelper
57{
8+ private static readonly string NuGetConfigPath = FindNuGetConfigPath ( ) ;
9+
610 internal static ReferenceAssemblies DefaultReferences = ReferenceAssemblies . NetFramework . Net472 . Default
11+ . WithNuGetConfigFilePath ( NuGetConfigPath )
712 . WithPackages ( ImmutableArray . Create (
813 new PackageIdentity ( "System.Composition.AttributedModel" , "6.0.0" ) ,
914 new PackageIdentity ( "System.ComponentModel.Composition" , "6.0.0" ) ) ) ;
15+
16+ private static string FindNuGetConfigPath ( )
17+ {
18+ string ? path = AppContext . BaseDirectory ;
19+ while ( path is not null )
20+ {
21+ string candidate = Path . Combine ( path , "nuget.config" ) ;
22+ if ( File . Exists ( candidate ) )
23+ {
24+ return candidate ;
25+ }
26+
27+ path = Path . GetDirectoryName ( path ) ;
28+ }
29+
30+ throw new InvalidOperationException ( "Could not find NuGet.config by searching up from " + AppContext . BaseDirectory ) ;
31+ }
1032}
You can’t perform that action at this time.
0 commit comments