You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this release we are please to announce the removal of the Common dependency and Nuget package 🎉 and introducing NuGet Central Package Management (i.e. with Directory.Packages.props).
Utilities have a dependency on the AWS.Lambda.Powertools.Common project.
When the utility is compiled and packaged into a nuget package the AWS.Lambda.Powertools.Common is a dependency.
This behaviour is causing Diamond dependency issues in the project.
To address this we copy the required files to each utility and make them completely isolated. This allows the client to not have to worry about dependencies between utilities and AWS.Lambda.Powertools.Common.
There is no need to delete the AWS.Lambda.Powertools.Common project but link the files in other projects, this will make it more readable in the solution explorer and makes maintenance easier because it's all in a single project.
TLDR
Add Directory.Build.props and Directory.Build.targetsmore info
These two files allows us to modify all csproj files in the solution or where the files are placed in the folder structure
Those files were added to the src folder. They modify all csproj in that folder where all utilities are. Search scope
Dependency management is a core feature of NuGet. Managing dependencies for a single project can be easy. Managing dependencies for multi-project solutions can prove to be difficult as they start to scale in size and complexity. In situations where you manage common dependencies for many different projects, you can leverage NuGet's central package management (CPM) features to do all of this from the ease of a single location.
Add a file Directory.Packages.props to the src and test folders. This allows us to manage nuget package versions for all projects in a central location. I separated src and tests because tests have many dependencies and can cause confusion. Search scope info
Implementation
Part 1 Directory.Build.props
Use MSbuild to:
Manage all common properties across all projects
These properties can be overridden by the project if it wishes to do so
Part 2 Directory.Build.targets (changes only happen in Release configuration)
Use MSbuild to:
Copy/Link AWS.Lambda.Powertools.Common *.cs files to the destination project
Remove depdendency of Common project by removing <ProjectReference Remove="..\AWS.Lambda.Powertools.Common\AWS.Lambda.Powertools.Common.csproj" />
Starting with NuGet 6.2, you can centrally manage your dependencies in your projects with the addition of a Directory.Packages.props file and an MSBuild property.
This means that the versions of the referenced packages will be defined in the central Directory.Packages.props file
File contents:
In the csproj files of the projects the referenced packages will not have a version
The resulting Release package will have no AWS.Lambda.Powertools.Common reference and will include AspectInjector nuget package. This will make the utility completely independent from AWS.Lambda.Powertools.Common Nuget package at runtime
Old:
New:
Removed AWS.Lambda.Powertools.Common project reference from test projects.
This reference now comes from Directory.Build.props. This file was added to test folder.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
In this release we are please to announce the removal of the Common dependency and Nuget package 🎉 and introducing NuGet Central Package Management (i.e. with Directory.Packages.props).
Utilities have a dependency on the AWS.Lambda.Powertools.Common project.
When the utility is compiled and packaged into a nuget package the AWS.Lambda.Powertools.Common is a dependency.
This behaviour is causing Diamond dependency issues in the project.
To address this we copy the required files to each utility and make them completely isolated. This allows the client to not have to worry about dependencies between utilities and AWS.Lambda.Powertools.Common.
There is no need to delete the AWS.Lambda.Powertools.Common project but link the files in other projects, this will make it more readable in the solution explorer and makes maintenance easier because it's all in a single project.
TLDR
Directory.Build.props
andDirectory.Build.targets
more infosrc
folder. They modify all csproj in that folder where all utilities are. Search scopeDirectory.Packages.props
to the src and test folders. This allows us to manage nuget package versions for all projects in a central location. I separated src and tests because tests have many dependencies and can cause confusion. Search scope infoImplementation
Part 1
Directory.Build.props
Part 2
Directory.Build.targets
(changes only happen in Release configuration)AWS.Lambda.Powertools.Common
*.cs files to the destination project<ProjectReference Remove="..\AWS.Lambda.Powertools.Common\AWS.Lambda.Powertools.Common.csproj" />
<PackageReference Include="AspectInjector" />
Once in
Release
configuration or when runningdotnet build -c Release
the Common folder is added to the projectPart 3 Central Package Management
Docs
Starting with NuGet 6.2, you can centrally manage your dependencies in your projects with the addition of a Directory.Packages.props file and an MSBuild property.
This means that the versions of the referenced packages will be defined in the central
Directory.Packages.props
fileFile contents:
In the csproj files of the projects the referenced packages will not have a version
If needed individual projects can override the version
Part 4 Nuget package contents
The resulting Release package will have no
AWS.Lambda.Powertools.Common
reference and will includeAspectInjector
nuget package. This will make the utility completely independent fromAWS.Lambda.Powertools.Common
Nuget package at runtimeOld:
New:
Removed
AWS.Lambda.Powertools.Common
project reference from test projects.This reference now comes from
Directory.Build.props
. This file was added to test folder.Contents:
Changes
🌟New features and non-breaking changes
🔧 Maintenance
This release was made possible by the following contributors:
@hjgraca and @amirkaws
This discussion was created from the release 1.7.0.
Beta Was this translation helpful? Give feedback.
All reactions