Closed glenmaroney closed 2 years ago
The corresponding log from my local machine:
C:\Users\glen\source\repos\Company\Company.API.Auth\Company.API.Auth\Company.API.Auth>dotnet ef migrations script -p ..\Company.BaseClassLibrary\Company.BaseClassLibrary.csproj -o %TEMP%\script.sql -i -v Using project '..\Company.BaseClassLibrary\Company.BaseClassLibrary.csproj'. Using startup project 'C:\Users\glen\source\repos\Company\Company.API.Auth\Company.API.Auth\Company.API.Auth\Company.API.Auth.csproj'. Writing '..\Company.BaseClassLibrary\obj\Company.BaseClassLibrary.csproj.EntityFrameworkCore.targets'... dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\glen\AppData\Local\Temp\tmpF618.tmp /verbosity:quiet /nologo ..\Company.BaseClassLibrary\Company.BaseClassLibrary.csproj Writing 'C:\Users\glen\source\repos\Company\Company.API.Auth\Company.API.Auth\Company.API.Auth\obj\Company.API.Auth.csproj.EntityFrameworkCore.targets'... dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\glen\AppData\Local\Temp\tmpF7ED.tmp /verbosity:quiet /nologo C:\Users\glen\source\repos\Company\Company.API.Auth\Company.API.Auth\Company.API.Auth\Company.API.Auth.csproj dotnet build C:\Users\glen\source\repos\Company\Company.API.Auth\Company.API.Auth\Company.API.Auth\Company.API.Auth.csproj /verbosity:quiet /nologo
Build succeeded. 0 Warning(s) 0 Error(s)
Time Elapsed 00:00:02.86 dotnet exec --depsfile C:\Users\glen\source\repos\Company\Company.API.Auth\Company.API.Auth\Company.API.Auth\bin\Debug\netcoreapp2.0\netcoreapp2.0\Company.API.Auth.deps.json --additionalprobingpath C:\Users\glen.nuget\packages --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" --runtimeconfig C:\Users\glen\source\repos\Company\Company.API.Auth\Company.API.Auth\Company.API.Auth\bin\Debug\netcoreapp2.0\netcoreapp2.0\Company.API.Auth.runtimeconfig.json C:\Users\glen.nuget\packages\microsoft.entityframeworkcore.tools.dotnet\2.0.0\tools\netcoreapp2.0\ef.dll migrations script -o C:\Users\glen\AppData\Local\Temp\script.sql -i --assembly C:\Users\glen\source\repos\Company\Company.API.Auth\Company.API.Auth\Company.API.Auth\bin\Debug\netcoreapp2.0\netcoreapp2.0\Company.BaseClassLibrary.dll --startup-assembly C:\Users\glen\source\repos\Company\Company.API.Auth\Company.API.Auth\Company.API.Auth\bin\Debug\netcoreapp2.0\netcoreapp2.0\Company.API.Auth.dll --project-dir C:\Users\glen\source\repos\Company\Company.API.Auth\Company.API.Auth\Company.BaseClassLibrary\ --verbose --root-namespace Company.BaseClassLibrary Using assembly 'Company.BaseClassLibrary'. Using startup assembly 'Company.API.Auth'. Using application base 'C:\Users\glen\source\repos\Company\Company.API.Auth\Company.API.Auth\Company.API.Auth\bin\Debug\netcoreapp2.0\netcoreapp2.0'. Using working directory 'C:\Users\glen\source\repos\Company\Company.API.Auth\Company.API.Auth\Company.API.Auth'. Using root namespace 'Company.BaseClassLibrary'. Using project directory 'C:\Users\glen\source\repos\Company\Company.API.Auth\Company.API.Auth\Company.BaseClassLibrary\'. Finding DbContext classes... Finding IDesignTimeDbContextFactory implementations... Finding application service provider... Finding BuildWebHost method... Using environment 'Development'. Using application service provider from BuildWebHost method on 'Program'. Found DbContext 'ApplicationContext'. Finding DbContext classes in the project... Using context 'ApplicationContext'. Finding design-time services for provider 'Microsoft.EntityFrameworkCore.SqlServer'... Using design-time services from provider 'Microsoft.EntityFrameworkCore.SqlServer'. Finding IDesignTimeServices implementations in assembly 'Company.API.Auth'... No design-time services were found. Writing 'C:\Users\glen\AppData\Local\Temp\script.sql'...
This isn't an issue with EF so closing it. Problem was solved when using VSTS build command line v2.x rather than 1.x
When I try to build a migration script locally on my machine, it works fine. However, in VSTS Build, I get a strange exception:
Steps to reproduce
The following command is used in the VSTS pipeline and executes in the working directory for a WebAPI project: dotnet ef migrations script –p ..\Company.BaseClassLibrary\Company.BaseClassLibrary.csproj -o $(Build.ArtifactStagingDirectory)\Migrations\migration.sql -i -v
Further technical details
EF Core version: 2.0.0 Database Provider: Microsoft.EntityFrameworkCore.SqlServer Operating system: Windows 10 IDE: Visual Studio 2017 15.4