Use Nuget.Config file in migrations bundle command
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
Dear,
I'm trying to use the "dotnet.exe ef migrations bundle" command with a nuget.config file defined on the sln folder level, but I don't see any parameters where I can define the path or the service connection name to use to authenticate against the external feed defined in the nuget.config. I'm trying this in azure pipelines, and external feed is in Nexus.
Steps in the pipeline:
* checkout
* install ef tooling
* use SDK (7.x)
* restore by use of nuget.config and externalFeedCredentials
* dotnet build of the sln with no-restore
* Nuget Authenticate
* dotnet core cli task with custom ef migrations bundle command
```
- task: DotNetCoreCLI@2
inputs:
command: 'custom'
custom: 'ef'
arguments: 'migrations bundle --configuration bundle -s "$(System.DefaultWorkingDirectory)/repo/${{parameters.workingDirectory}}/${{parameters.migrationsProject}}" -f --output "$(Build.ArtifactStagingDirectory)/migrations/efbundle_main.exe" --verbose'
```
the error:
starts when ef is building the bundle:
```
Building bundle...
dotnet publish --runtime win10-x64 --output C:\Users\SRVTFSBUILD2019prd\AppData\Local\Temp\asrz5ytu.zcf\publish --no-self-contained
Determining projects to restore...
Restored D:\AzDO_Services_R-xxxxxxxx\agent1\_work\1056\s\repo\src\api\xxxxxx.AutomaticUpload.Models\xxxxxxxxxxx.csproj (in 540 ms).
Restored D:\AzDO_Services_R-xxxxxxxx\agent1\_work\1056\s\repo\src\api\xxxxxx.AutomaticUpload.Components\xxxxxxxxxxxx.csproj (in 275 ms).
C:\Users\SRVTFSBUILD2019prd\AppData\Local\Temp\asrz5ytu.zcf\efbundle_main.csproj : error NU1101: Unable to find package . No packages exist with this id in source(s): nuget.org
C:\Users\SRVTFSBUILD2019prd\AppData\Local\Temp\asrz5ytu.zcf\efbundle_main.csproj : error NU1101: Unable to find package . No packages exist with this id in source(s): nuget.org
C:\Users\SRVTFSBUILD2019prd\AppData\Local\Temp\asrz5ytu.zcf\efbundle_main.csproj : error NU1101: Unable to find package . No packages exist with this id in source(s): nuget.org
C:\Users\SRVTFSBUILD2019prd\AppData\Local\Temp\asrz5ytu.zcf\efbundle_main.csproj : error NU1101: Unable to find package . No packages exist with this id in source(s): nuget.org
C:\Users\SRVTFSBUILD2019prd\AppData\Local\Temp\asrz5ytu.zcf\efbundle_main.csproj : error NU1101: Unable to find package . No packages exist with this id in source(s): nuget.org
C:\Users\SRVTFSBUILD2019prd\AppData\Local\Temp\asrz5ytu.zcf\efbundle_main.csproj : error NU1101: Unable to find package . No packages exist with this id in source(s): nuget.org
C:\Users\SRVTFSBUILD2019prd\AppData\Local\Temp\asrz5ytu.zcf\efbundle_main.csproj : error NU1101: Unable to find package . No packages exist with this id in source(s): nuget.org
C:\Users\SRVTFSBUILD2019prd\AppData\Local\Temp\asrz5ytu.zcf\efbundle_main.csproj : error NU1101: Unable to find package Pacaya.Business. No packages exist with this id in source(s): nuget.org
Failed to restore C:\Users\SRVTFSBUILD2019prd\AppData\Local\Temp\asrz5ytu.zcf\efbundle_main.csproj (in 5,53 sec).
Restored D:\AzDO_Services_R-xxxxxxxxx\agent1\_work\1056\s\repo\src\api\Cxxxxxs\Cxxxxxxxxxxxxxx.csproj (in 16,88 sec).
Restored D:\AzDO_Services_R-xxxxxxxxx\agent1\_work\1056\s\repo\src\api\Cxxxxxs\xxxxxxxxxxxxxxxi.csproj (in 16,88 sec).
Microsoft.EntityFrameworkCore.Tools.CommandException: Build failed. Use --verbose to see errors.
```
I would expect it to try and get those custom packages out of the nexus feed as that is defined in the nuget.config.
The dotnet restore and dotnet build tasks are running ok, but with the restore task I can give along the nuget.config path and the service connection it needs to use.
tried it also with --no-build but then the configuration bundle seems to try and get the packages in the debug configuration folder, while the dotnet build of the sln is in the release configuration.
### Include provider and version information
EF Core version: 7.*
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: NET 7.x
Operating system: Windows Server 2022
IDE: on build server with Azure devops Build Agent
Contributor guide
Assessment
This issue has not been assessed yet.