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

Cannot resolve NuGet package references to local packages #124

Open
jimevans opened this issue May 1, 2019 · 4 comments
Open

Cannot resolve NuGet package references to local packages #124

jimevans opened this issue May 1, 2019 · 4 comments

Comments

@jimevans
Copy link
Contributor

jimevans commented May 1, 2019

Many monorepo enthusiasts insist that dependencies are checked into the source control system. The .NET ecosystem supports this by use of a custom NuGet feed. In Visual Studio, this can be achieved by creating a file called NuGet.config XML file and adding a <packageSources> element that contains a reference to the directory on disk containing the .nupkg files. In the IDE, this shows up as an entry in the Package Sources list of the NuGet Package Manager window.

Additionally, this would allow users to use internal packages not published to nuget.org, as there is currently no way to do this. The use case here is a version of a package where the maintainer either has not or will not accept bug fixes, and the development team maintains a forked version of the dependency project. There may not be any need for the development team to build this dependency as part of the target project, and the dependency code should not be a part of the target project.

@tomaszstrejczek
Copy link
Collaborator

The nuget_package rule support source parameter which specifies package source to use:
https://github.com/bazelbuild/rules_dotnet/blob/master/dotnet/workspace.rst#nuget_package

@jimevans
Copy link
Contributor Author

jimevans commented May 1, 2019

That’s fair, I suppose, but for a package that lives in the source control repo, and therefore already exists locally on disk and doesn’t need to be downloaded, how should that URL be formatted? And do I need to lay the packages out in the repo in a specific directory format (like packages/<packageName>/<packageVersion>/packagefile.nupkg?

@tomaszstrejczek
Copy link
Collaborator

tomaszstrejczek commented May 18, 2019

Currently it will not work. nuget_package under the hood uses download_and_extract (https://docs.bazel.build/versions/master/skylark/lib/repository_ctx.html#download_and_extract) which AFAIK can't handle local files. However custom remote package source should work.

@jimevans
Copy link
Contributor Author

Well, let’s mark this as a feature request then, and see what it would take to develop.

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