-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move NuGet API usage to its own extension (#824)
NuGet API may not be stable and loading an arbitrary version with MSBuild may cause problems. This change isolates those calls so we can pin it to our own version. This change does a couple of things: - Moves all NuGet usages to extension. This will now load in its own AssemblyLoadContext so we won't have any conflicts - Updates to the latest NuGet client API libraries - Adds a 'required' extension concept so that they will load in all cases even when loading is disabled.
- Loading branch information
1 parent
3ba125a
commit ed3bdb6
Showing
40 changed files
with
302 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/common/Microsoft.DotNet.UpgradeAssistant.Abstractions/ITargetFrameworkCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.DotNet.UpgradeAssistant | ||
{ | ||
public interface ITargetFrameworkCollection : IReadOnlyCollection<TargetFrameworkMoniker> | ||
{ | ||
void SetTargetFramework(TargetFrameworkMoniker tfm); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/components/Microsoft.DotNet.UpgradeAssistant.MSBuild/Factories.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
|
||
namespace Microsoft.DotNet.UpgradeAssistant.MSBuild | ||
{ | ||
internal class Factories | ||
{ | ||
private readonly Func<IUpgradeContext, IProject, INuGetReferences> _nugetReferenceFactory; | ||
private readonly Func<IProjectFile, ITargetFrameworkCollection> _tfmCollectionFactory; | ||
private readonly Func<string, ISolutionInfo> _infoGenerator; | ||
|
||
public Factories( | ||
Func<IUpgradeContext, IProject, INuGetReferences> nugetReferenceFactory, | ||
Func<IProjectFile, ITargetFrameworkCollection> tfmCollectionFactory, | ||
Func<string, ISolutionInfo> infoGenerator) | ||
{ | ||
_nugetReferenceFactory = nugetReferenceFactory; | ||
_tfmCollectionFactory = tfmCollectionFactory; | ||
_infoGenerator = infoGenerator; | ||
} | ||
|
||
public INuGetReferences CreateNuGetReferences(IUpgradeContext context, IProject project) => _nugetReferenceFactory(context, project); | ||
|
||
public ITargetFrameworkCollection CreateTfmCollection(IProjectFile project) => _tfmCollectionFactory(project); | ||
|
||
public ISolutionInfo CreateSolutionInfo(string name) => _infoGenerator(name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.