-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add NuGet support in scripting APIs #6900
Comments
It's not totally clear what this issue is tracking - is it to add a new preprocessor directive like Perhaps most importantly, any idea how this will work? What will the directive look like? I'm trying to decide if I should add this myself to a script-based project I maintain (Scripty), and if I do, I'd like it to look similar to what's going to get put into Roslyn so I can rip my own implementation out later. |
@daveaglick no idea of the scheduling for this other than the milestone the bug is currently bucketed in, but yes, the intent would be that you could reference a nuget package in a manner similar to |
@daveaglick You can actually do it yourself today using extension points in scripting API that already exist. The host gets the opportunity to interpret the content of #r directive as it needs to and return a metadata reference (see http://source.roslyn.io/#Microsoft.CodeAnalysis/MetadataReference/MetadataReferenceResolver.cs,15) The host can check if the reference starts with
There is an open question of how to handle dependencies though (some kind of project.lock.json file). Perhaps
would check if We could also have
to just restore packages and generate In the REPL we would manage .lock.json files for submissions in-memory. |
Of course, it's good that we can extend the scripting API, but the problem then is that we end up creating our own schema, a runner to support it, and, ultimately, scripts that are dependent on specific runners. IMHO this is so fundamental that it MUST be built into the scripting libraries itself, so we avoid an ecosystem where several different methods of importing NuGet packages into scripts start to appear. (BTW - it's already happening - see Cake). |
Is this a duplicate of #5654 ? |
For those following along, I think the custom roslyn/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Resolution.cs Lines 882 to 886 in 315c2e1
So it works fine with packages like Newtonsoft.Json that only include a single DLL, but does not work more generally. As a workaround, we can still re-use the I'm happy to contribute a PR that would implement this |
No description provided.
The text was updated successfully, but these errors were encountered: