-
Notifications
You must be signed in to change notification settings - Fork 64
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
Support single version principle for nuget packages. #6
Comments
This could be accomplished with a shared MSBuild properties file named Directory.Build.props. This file will automatically be imported into each project found below it in the file system. It may contain any MSBuild property, including |
Hmmmm, thats an interesting idea. I did not know about the directory file like that. Like you said the dotnet cli would not install new packages to that by default though, and if anyone was to open a project in VS the package manager would not know about these packages. Perhaps it would be better to have a section in the nx-dotnet.config.js file that has package versions listed in it, and update that section when someone uses the cli to install a package. We would provide 2 schematics to facilitate this. One that adds the package reference to the needed csproj file, using the version from the config file if it matches or prompting a decision if it does not match. The other would be called something like sync-packages and would scan project files in the workspace and update the config file. This 2nd schematic could called at the end of the first, but would also allow it to be ran in case a dev had messed with packages from the manager |
Visual Studio 2019 recognizes packages that live in No matter which global file ends up holding the shared packages, a schematic to rebuild the global file from the individual projects would be a nice addition. It would be useful when the projects are modified directly and when existing .NET projects are migrated into an Nx workspace. This schematic could also be used as a CI linter that ensures all packages live in the global file and there's no inconsistencies. Between the choice of On the other hand, using an "invisible" config file allows the schematics to only include the packages that are actually used by the individual project. The dotnet CLI will include all referenced assemblies, including those that are never used, when building or publishing an application. Setting up each |
Yeah, there would definitely be more duplication in the nx-dotnet.config.js. I am still personally leaning more towards utilizing it as xml manipulation is bit more painful that just updating the js exports. Keeping built application sizes down by dotnet not knowing about the js config file is definitely a benefit. Either route we choose a sync-packages schematic will be needed in case changes are made inside visual studio. A more generic vs-sync schematic might be nice in case there are further things that crop up as not being cross-compatible. There are pro's and con's to both. Here is how I see it.
I am mostly leaning towards the config file, mostly due to the last con on the directory build props file. There are definitely benefits to the directory file though. The nx-dotnet schematics will have to read xml either way, but we already include xmldoc for reading these to parse dependency tree. |
#6 still needs to be implemented. The base sync schematic has been added, but is not implemented.
#6 still needs to be implemented. The base sync schematic has been added, but is not implemented.
# [0.4.0](v0.3.0...v0.4.0) (2021-05-01) ### Bug Fixes * **repo:** update .releaserc to commit package.json version back ([36d2f30](36d2f30)) ### Features * **core:** schematic for adding npm package [#5](#5) ([4f37be7](4f37be7)), closes [#6](#6) * **core:** support for single version principle [#6](#6) ([#32](#32)) ([8e60a13](8e60a13))
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Problem:
Nuget packages are managed within .csproj files, meaning different apps/libs in the same workspace might have different versions. This goes against single version principle, which Nrwl has defended many times in the Nx repo.
The text was updated successfully, but these errors were encountered: