-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Add nuget restore source and set WorkingDirectory to RepoRoot for global tools install #33860
Add nuget restore source and set WorkingDirectory to RepoRoot for global tools install #33860
Conversation
6dd7d06
to
09f67a1
Compare
09f67a1
to
9a9a839
Compare
test code coverage Unrelated but as there is no official code coverage build yet I use this PR to test it. |
@dotnet-bot test Windows x64 Debug Build |
ContinueOnError="WarnAndContinue" /> | ||
|
||
<!-- | ||
Installs the global tool if it doesn't exist with the right version. | ||
Creates the global tools folder automatically if it doesn't exist. | ||
--> | ||
<Exec Condition="!Exists($(GlobalToolsDir)) OR !$([System.Text.RegularExpressions.Regex]::IsMatch('$(DotNetListToolsOutput)', '$([System.Text.RegularExpressions.Regex]::Escape('%(RepoTool.Identity)'))\s+$([System.Text.RegularExpressions.Regex]::Escape('%(RepoTool.Version)'))'))" | ||
Command="$(DotNetCmd) tool install --tool-path $(GlobalToolsDir) %(RepoTool.Identity) --version %(RepoTool.Version)" | ||
Command="$(DotNetCmd) tool install --tool-path $(GlobalToolsDir) %(RepoTool.Identity) --version %(RepoTool.Version) --add-source https:%2F%2Fapi.nuget.org/v3/index.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just add the source at the beginning of restore sources: https://github.com/dotnet/corefx/pull/33860/files#diff-c9ed7fc6ec49880569e6c2eb08120fc4R4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does not work for the out-of-proc Exec task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah right. Could you instead of hardcode it here, declare a property for the restore sources of the tools and then just use that here? That would avoid using %2F as part of the string, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I considered that but as there are right now some issues with the correct encoding of the sources, i.e. there are issues with semicolons and the slashes I didn't do that now. We can revisit that when we need to add global tools that aren't available on nuget.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok cool.
dotnet tool install
command as the sources are cleared in the root NuGet.config (I have no idea why it worked on Windows!)It seems working with nuget cross-platform is still fragile.
cc @ericstj @safern