by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 05 11:03
    zhangkaizhao starred cake-build/cake
  • Jun 05 10:03
    Build #5769 passed
  • Jun 05 09:57
    gitfool opened #2793
  • Jun 05 09:30
    gep13 commented #2791
  • Jun 05 09:22
    patriksvensson commented #2791
  • Jun 05 09:17
    gitfool opened #2792
  • Jun 05 09:12
    patriksvensson commented #2791
  • Jun 05 09:12
    patriksvensson ready_for_review #2791
  • Jun 05 08:53
    Build #5768 passed
  • Jun 05 08:53
    patriksvensson edited #2791
  • Jun 05 08:52
    patriksvensson edited #2776
  • Jun 05 08:46
    patriksvensson opened #2791
  • Jun 05 04:19
    Build #575 passed
  • Jun 04 14:18
    patriksvensson commented #2790
  • Jun 04 12:39
    mholo65 commented #2790
  • Jun 04 12:34
    gep13 milestoned #2790
  • Jun 04 12:34
    gep13 labeled #2790
  • Jun 04 12:34
    gep13 assigned #2790
  • Jun 04 12:32
    gep13 commented #2790
  • Jun 04 12:31
    patriksvensson commented #2790
Victorio Berra
@VictorioBerra
They do not behave the same. And its frustrating.
So you are saying if I run the NuGet auth command before that command, it will just work?
Mattias Karlsson
@devlead
It will if you add --interactive so dotnet tool restore --interactive.
Victorio Berra
@VictorioBerra
Gotcha I will try that. Also, an alternative is to provide the --configfile param to dotnet tool restore and then dropa NuGetTool.Config in your repo that targets NuGet.org public feed. So then dotnet tool restore grabs Cake from the public feed and then you can move on to the other problems.
Mattias Karlsson
@devlead
Most .NET CLI nuget commands have an --interactive flag, --interactive will trigger the credential provider. Azure DevOps has a special one on its agents.
Victorio Berra
@VictorioBerra
@devlead So, for DotNetCoreRestore() in the build.cake, how do you auth there? Is that where you need to call NuGetSetApiKey() and set the Sources and all that?
Mattias Karlsson
@devlead
And there's also a credential provider you can download for local use so you'll get a device login if not authenticated.
For DotNetCoreRestore() you pass an DotNetCoreRestoreSettings with Interactive set to true.
Victorio Berra
@VictorioBerra
I think I have that set up already somehow. Maybe it happened through Visual Studio or something. the PAT for Git is there in my account.
Gotcha I will try all this and report back.
Mattias Karlsson
@devlead
Yes Visual Studio has credential provider built-in.
But for other IDEs / CLI you might need to download it.
There's a handy script you can use here
https://github.com/microsoft/artifacts-credprovider
Victorio Berra
@VictorioBerra

@devlead I tried this:

steps:

- task: NuGetAuthenticate@0

- task: DotNetCoreCLI@2
  inputs:
    command: 'custom'
    custom: 'tool'
    arguments: 'restore --interactive'

Got this:

C:\Program Files\dotnet\sdk\3.1.202\NuGet.targets(124,5): error : Problem starting the plugin 'C:\Users\VssAdministrator.nuget\plugins\netcore\CredentialProvider.Microsoft\CredentialProvider.Microsoft.dll'. Plugin 'CredentialProvider.Microsoft' failed within 5.657 seconds with exit code -1. [C:\Users\VssAdministrator\AppData\Local\Temp\nx1ok0f3.nhz\restore.csproj]

Victorio Berra
@VictorioBerra
Mattias Karlsson
@devlead
interesting, and it works if you dotnet tool restore --add-source https://api.nuget.org/v3/index.json ?

Does

- task: CmdLine@2
  displayName: 'Execute Cake Script'
  inputs:
    script: |
      dotnet tool restore --interactive
      dotnet cake

cause same error?

Do you have a global.json?

I ensure same .NET SDK on agent using

- task: UseDotNet@2
  displayName: Install .NET Core
  inputs:
    useGlobalJson: true

and my global.json uses latest SDK

{
  "sdk": {
    "version": "3.1.300"
  }
}

just so it's not an old SDK causing issues.

Victorio Berra
@VictorioBerra
I am not using a global JSON
I will have to test that CmdLine compared to the DotNetCoreCLI task one second
Should I add a Global JSON?
Victorio Berra
@VictorioBerra

@devlead This seemed to work!

(added a global.json)

steps:

- task: NuGetAuthenticate@0

- task: UseDotNet@2
  displayName: Install .NET Core
  inputs:
    useGlobalJson: true

- task: CmdLine@2
  displayName: 'Execute Cake Script'
  inputs:
    script: |
      dotnet tool restore --interactive
      dotnet cake
Not sure if it was the global.json + the dotnet install command. Or if it was changing DotNetCoreCLI to CmdLine that is why I usually avoid changing too many things at once.
Victorio Berra
@VictorioBerra
The official docs say Global.json is only for advanced scenarios. I assume you are using that because historically, the azure agents have been terrible about having the latest version of Core on them?
Mattias Karlsson
@devlead
I use global.json because it ensures same SDK locally as on agent. Same reason I prefer tool-manifest as it ensures CI uses same Cake version.
Advantage as I see it with CmdLine@2 is that it's less magic and more like I do it locally.
Victorio Berra
@VictorioBerra
@devlead Does DotNetCoreRestore() in Build.Cake internally launch a dotnet CLI process? Or how does it determine what NuGet.Exe to use? IE if you use the NuGetInstaller@1 task to pull down a NuGet.exe and add it to PATH will that effect the Cake stuff at all?
Mattias Karlsson
@devlead
DotNetCoreRestore = dotnet restore
NuGetRestore = nuget restore
Victorio Berra
@VictorioBerra
Got it. Also, I notice the default azure-pipelines.yaml has the NuGetInstaller@1 any reason you dont use that?
I assume that future proofs the agent a bit by always pulling down the latest NuGet.exe?
Mattias Karlsson
@devlead
If i use NuGet.exe then I would use tool directive to ensure same version locally and on ci
#tool "nuget:https://api.nuget.org/v3/index.json?package=nuget.commandline&version=5.5.1" example from Cake.
Victorio Berra
@VictorioBerra
So, I have confirmed, without the global.json 3.1.202 is used, and the cake.tool will fail to restore.
Surely there wasnt some weird update with .net core nuget CLI to fix the auth stuff in .300?
Mattias Karlsson
@devlead
Wouldn't be surprised.
Victorio Berra
@VictorioBerra
I just read quickly through all the docs, im not seeing anything. So confusing.
I really would like to avoid another json file to manage and update. Its nice to just have the latest version be automatically used when a .net core update happens. I have too much core projects to manage and PR and deal with when theres an update. They would all benefit from automatic roll-forward.
vaishnav-n
@vaishnav-n
hi. Any suggestions on how to build VS 2008 sln files with cake
Mattias Karlsson
@devlead
Newer tool versions might work, all depends on project files an their depencies, more than solution.
vaishnav-n
@vaishnav-n
Is it necessary to mention the tool path to the version or will cake find the necessary path
will vswhere work for this. Will a parameter be accepted to find a specific version of the tool
Mattias Karlsson
@devlead
If installed in default locations, Cake tool resolution should find it. If no version is specified, then it'll try to find latest. Up to VS2015 don't think you had any option on where to install it. But from VS2017 you could if you wanted install it somewhere else. But default locations should be found by Cake. With VS2017 and up you can also VSWhere tool & alias, and set tool path. By setting tool path you'll override all of Cake builtin tool resolution.
vaishnav-n
@vaishnav-n
the build agent has both vs2019 and and vs2015 installed. so cake should be able to use only vs2015
Mattias Karlsson
@devlead
yes, if the tool version is specified. Both VS2015 and VS2019 might need that you upgrade your VS2008 solution, it might just work, but it depends on the project, som project types have variables tied to certain VS versions.
vaishnav-n
@vaishnav-n
upgrade is recommending functinal changes to the code which is not preferable. Without performing an upgrade I tried running the build setting the VS2015 version. the log
still shows that it is searching for the sdk in visual studio 2019 verison
Mattias Karlsson
@devlead
@vaishnav-n what does your MSBuild() and MSBuildSettings look like?