Skip to content
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 file paths for <PackageVersion> in Directory.Packages.props #13964

Open
Meai opened this issue Nov 26, 2024 · 0 comments
Open

Support file paths for <PackageVersion> in Directory.Packages.props #13964

Meai opened this issue Nov 26, 2024 · 0 comments

Comments

@Meai
Copy link

Meai commented Nov 26, 2024

NuGet Product(s) Involved

NuGet.exe, Visual Studio Package Management UI, Visual Studio Package Manager Console, MSBuild.exe, dotnet.exe, NuGet SDK

The Elevator Pitch

Goal:
The following should automatically update the Visual Studio solution each time I change/remove the Path="" so that I can switch between using a local project or its published nuget package version. Please note that I'm not just talking about specifying a filepath to a local .nupkg file. What this solves is development without a publish step and without a build step into a .nupkg.

<Project>
	<PropertyGroup>
		<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
		<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
	</PropertyGroup>
	<ItemGroup>
	  <PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
	  <PackageVersion Include="ClassLibrary1" Version="1.0.0" Path="..\..\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj" />
	</ItemGroup>
</Project>

Longer scenario description:
ConsoleApp1 has a nuget reference to ClassLibrary1. Now I want to test local changes I made to ClassLibrary1. This is a very common usecase, you could argue that this is the primary usecase of having libraries. Sure I want my code to be isolated in another place but that doesn't mean that I want endless friction when actually developing this library which by definition will be used in possibly many other places. Alas in c# if I choose to use nuget packages I'm immediately entering that territory of endless friction because I'm forced to manually convert my nuget references in my entire solution to project references. Each time I want to test either the published package or test my local stashed changes I have to do this manual "vendoring/linking" step.

Comparison with other languages/package managers:
I think this is mostly a solved usecase by other package managers. Npm has 'link' and many other "workspace" tools, either built into npm/pnpm or another way from Microsoft via rushstack. Golang has the vendor system which is not exactly the same but it sort of solves this issue as well because each time you change the location of the package from an url to a filepath it should vendor itself correctly again and afaik you are coding directly against your symlinked local code.

Additional Context and Details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants