Closed TronActive closed 4 years ago
That is weird. Clearly the startup-project is specified so it makes no sense to get an error about that.
I just run my test projects that verifies task, in the logs I get:
Tool 'dotnet-ef' (version '3.1.5') was successfully installed.
I have also used the Use .Net core task with version 3.1.101 and 3.1.301. Could you try any of these versions? Both these versions works for me. You do not need to make any modifications to your projects to do this.
I looked on the logs again and realized that maybe the startup-project might not be the problem, could it be something with YNP.EntityFrameworkCore.csproj?
Also, if you run this command locally (with modified paths), does that works?
dotnet.exe ef migrations script --idempotent --project D:\a\1\s\src\YNP.EntityFrameworkCore\YNP.EntityFrameworkCore.csproj --startup-project D:\a\1\s\src\YNP.Web.Host\YNP.Web.Host.csproj --output D:\a\1\a/migrations/YNPDbContext.sql --context YNPDbContext --verbose
Sorry just saw you replied. I tried the different .NET Core versions you asked me to and still failing. Also with the EntityFrameworkCore project, literally the only thing that changed in that project in 4 months was the update to version 3.1.4. I have no idea what to do at this time.
Also, yes it does work locally just fine. No issues. Here is a screenshot of it working. https://www.yournextplacemn.com/wp-content/uploads/6156/efcore2020-06-22_8-50-37.jpg
Don't give up @joe704la, sooner or later you will find something interesting :-)
I see that when you are running the command locally you are excluding the start-up project. What happens if you are using NP.Web.Host.csproj as the start-up project on your local computer? What happens if you leave start start-up parameter empty in DevOps?
Could you try to run the build on some old check-in that you know was building fine?
My gut feeling is that this is not related to any recent update with .NET Core. But I would love to know what it is :-)
I tried removing the startup and still failed. I tried it on an older repo that worked in the past and that worked just fine. Very confusing.
So, if you are building some older version of the it works? That some great news, I think. Then you could try different points in the history and maybe found which check-in that caused the problem. Very painful to do, but at least it is doable.
Another thing you could try is to clone the code to a different folder on your dev-machine. It could be that you have some local files in the current folder that is not a part of the repro but somehow makes it work. A clean clone would reduce that problem. Even better would be to build on a different machine.
As a workaround since I need this to work, I added a local agent to my webserver and then I was able to add a Powershell task and run the following PS Command and that worked just fine.
But funny enough if I change the command to dotnet ef instead of dotnet-ef then I get that same error about multiple projects. So I have no idea what that is supposed to mean.
Same error here.
This is the log from the failed step:
2020-07-13T20:00:08.6172059Z ##[section]Starting: Generate Migration Scripts
2020-07-13T20:00:08.6339745Z ==============================================================================
2020-07-13T20:00:08.6340165Z Task : Entity Framework Core Migrations Script Generator
2020-07-13T20:00:08.6340729Z Description : Tool for projects that use Entity Framework Core Code-First. Generates migration scripts which can be used to update a database (for instance with the task 'Azure SQL Database Deployment').
2020-07-13T20:00:08.6341278Z Version : 0.0.42
2020-07-13T20:00:08.6341507Z Author : PEK's Productions
2020-07-13T20:00:08.6341872Z Help : [More Information](https://github.com/pekspro/EF-Migrations-Script-Generator-Task)
2020-07-13T20:00:08.6342328Z ==============================================================================
2020-07-13T20:00:09.0463521Z Project path: D:\a\1\s\src\PatientManagement.EntityFrameworkCore\PatientManagement.EntityFrameworkCore.csproj
2020-07-13T20:00:09.0464628Z Start-up project path: D:\a\1\s\src\PatientManagement.Web.Mvc\PatientManagement.Web.Mvc.csproj
2020-07-13T20:00:09.0465989Z Target folder: D:\a\1\a/migrations
2020-07-13T20:00:09.0466439Z Number of database contexts: 1
2020-07-13T20:00:09.0466830Z Checking of dotnet-ef is installed.
2020-07-13T20:00:09.0576653Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe tool list --global
2020-07-13T20:00:09.4011524Z Package Id Version Commands
2020-07-13T20:00:09.4018957Z -------------------------------------
2020-07-13T20:00:09.4105887Z
2020-07-13T20:00:09.4205021Z Parsing output: "Package Id Version Commands
2020-07-13T20:00:09.4205667Z -------------------------------------
2020-07-13T20:00:09.4207652Z "
2020-07-13T20:00:09.4208304Z Installing version undefined of dotnet-ef as global tool.
2020-07-13T20:00:09.4231232Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe tool install --global dotnet-ef
2020-07-13T20:00:13.0999291Z You can invoke the tool using the following command: dotnet-ef
2020-07-13T20:00:13.1000166Z Tool 'dotnet-ef' (version '3.1.5') was successfully installed.
2020-07-13T20:00:13.1049523Z
2020-07-13T20:00:13.1347007Z Generating migration script for PatientManagementDbContext in project D:\a\1\s\src\PatientManagement.EntityFrameworkCore\PatientManagement.EntityFrameworkCore.csproj
2020-07-13T20:00:13.1365723Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe ef migrations script --idempotent --project D:\a\1\s\src\PatientManagement.EntityFrameworkCore\PatientManagement.EntityFrameworkCore.csproj --startup-project D:\a\1\s\src\PatientManagement.Web.Mvc\PatientManagement.Web.Mvc.csproj --output D:\a\1\a/migrations/PatientManagementDbContext.sql --context PatientManagementDbContext --verbose
2020-07-13T20:00:13.3642272Z Specify which project file to use because this 'D:\a\1\s' contains more than one project file.
2020-07-13T20:00:13.3696356Z
2020-07-13T20:00:13.3894874Z ##[error]The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1
2020-07-13T20:00:13.3981163Z ##[section]Finishing: Generate Migration Scripts
In this example, it's installing the latest because I didn't specify a version but it does say it was installed.
I'm trying specific versions next.
No change at all, unfortunately. It's been working so well until now.
Sorry to hear that @kfrancis :( I just do not get why this is happening. I have not done any changes to this myself for while. I guess it is something in the platform that does not work properly. Which agent specification are you using? I have tried a couple of different variant, mostly windows-2019, and all of them works just fine. Here is I log I have from a recent build on a test project, and I do not see any major difference from yours except that the result is different:
2020-07-14T09:21:56.9060459Z ##[section]Starting: Generate migrations scripts - Library project
2020-07-14T09:21:56.9209064Z ==============================================================================
2020-07-14T09:21:56.9210111Z Task : Entity Framework Core Migrations Script Generator
2020-07-14T09:21:56.9212594Z Description : Tool for projects that use Entity Framework Core Code-First. Generates migration scripts which can be used to update a database (for instance with the task 'Azure SQL Database Deployment').
2020-07-14T09:21:56.9213635Z Version : 0.0.42
2020-07-14T09:21:56.9214606Z Author : PEK's Productions
2020-07-14T09:21:56.9216504Z Help : [More Information](https://github.com/pekspro/EF-Migrations-Script-Generator-Task)
2020-07-14T09:21:56.9217513Z ==============================================================================
2020-07-14T09:21:57.2132892Z Project path: d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj
2020-07-14T09:21:57.2134730Z Start-up project path: d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj
2020-07-14T09:21:57.2135969Z Target folder: d:\a\1\a/migrations-library
2020-07-14T09:21:57.2136860Z Number of database contexts: 2
2020-07-14T09:21:57.2137669Z Checking of dotnet-ef is installed.
2020-07-14T09:21:57.2196735Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe tool list --global
2020-07-14T09:21:57.4919306Z Package Id Version Commands
2020-07-14T09:21:57.4926493Z -------------------------------------
2020-07-14T09:21:57.4984761Z
2020-07-14T09:21:57.5068770Z Parsing output: "Package Id Version Commands
2020-07-14T09:21:57.5069604Z -------------------------------------
2020-07-14T09:21:57.5070381Z "
2020-07-14T09:21:57.5071206Z Installing version undefined of dotnet-ef as global tool.
2020-07-14T09:21:57.5099128Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe tool install --global dotnet-ef
2020-07-14T09:22:00.6523568Z You can invoke the tool using the following command: dotnet-ef
2020-07-14T09:22:00.6524842Z Tool 'dotnet-ef' (version '3.1.5') was successfully installed.
2020-07-14T09:22:00.6580997Z
2020-07-14T09:22:00.6719887Z Generating migration script for LibraryDatabaseContext in project d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj
2020-07-14T09:22:00.6757156Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe ef migrations script --idempotent --project d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj --startup-project d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj --output d:\a\1\a/migrations-library/LibraryDatabaseContext.sql --context LibraryDatabaseContext --verbose
2020-07-14T09:22:01.0297332Z Using project 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj'.
2020-07-14T09:22:01.0299091Z Using startup project 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj'.
2020-07-14T09:22:01.0352183Z Writing 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\obj\NetCore3.1TestApplication.csproj.EntityFrameworkCore.targets'...
2020-07-14T09:22:01.0431467Z dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\VssAdministrator\AppData\Local\Temp\tmpA34C.tmp /verbosity:quiet /nologo d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj
2020-07-14T09:22:01.9814138Z Writing 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\obj\NetCore3.1TestApplication.csproj.EntityFrameworkCore.targets'...
2020-07-14T09:22:01.9816347Z dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\VssAdministrator\AppData\Local\Temp\tmpA6F6.tmp /verbosity:quiet /nologo d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj
2020-07-14T09:22:02.8545125Z Build started...
2020-07-14T09:22:02.8558910Z dotnet build d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj /verbosity:quiet /nologo
2020-07-14T09:22:06.9171671Z
2020-07-14T09:22:06.9173588Z Build succeeded.
2020-07-14T09:22:06.9181283Z 0 Warning(s)
2020-07-14T09:22:06.9182168Z 0 Error(s)
2020-07-14T09:22:06.9182535Z
2020-07-14T09:22:06.9183381Z Time Elapsed 00:00:03.50
2020-07-14T09:22:06.9579022Z Build succeeded.
2020-07-14T09:22:06.9744440Z dotnet exec --depsfile d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\bin\Debug\netcoreapp3.1\NetCore3.1TestApplication.deps.json --additionalprobingpath C:\Users\VssAdministrator\.nuget\packages --additionalprobingpath C:\Microsoft\Xamarin\NuGet --runtimeconfig d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\bin\Debug\netcoreapp3.1\NetCore3.1TestApplication.runtimeconfig.json C:\Users\VssAdministrator\.dotnet\tools\.store\dotnet-ef\3.1.5\dotnet-ef\3.1.5\tools\netcoreapp3.1\any\tools\netcoreapp2.0\any\ef.dll migrations script --idempotent --output d:\a\1\a/migrations-library/LibraryDatabaseContext.sql --context LibraryDatabaseContext --assembly d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\bin\Debug\netcoreapp3.1\NetCore3.1TestApplication.dll --startup-assembly d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\bin\Debug\netcoreapp3.1\NetCore3.1TestApplication.dll --project-dir d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\ --language C# --working-dir d:\a\1\s --verbose --root-namespace NetCore3_1TestApplication
2020-07-14T09:22:07.1156242Z Using assembly 'NetCore3.1TestApplication'.
2020-07-14T09:22:07.1163236Z Using startup assembly 'NetCore3.1TestApplication'.
2020-07-14T09:22:07.1189815Z Using application base 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\bin\Debug\netcoreapp3.1'.
2020-07-14T09:22:07.1191466Z Using working directory 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication'.
2020-07-14T09:22:07.1193014Z Using root namespace 'NetCore3_1TestApplication'.
2020-07-14T09:22:07.1194104Z Using project directory 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\'.
2020-07-14T09:22:07.2410599Z Finding DbContext classes...
2020-07-14T09:22:07.2430955Z Finding IDesignTimeDbContextFactory implementations...
2020-07-14T09:22:07.2453899Z Finding application service provider...
2020-07-14T09:22:07.2468153Z Finding Microsoft.Extensions.Hosting service provider...
2020-07-14T09:22:07.2485956Z Using environment 'Development'.
2020-07-14T09:22:07.4499163Z Using application service provider from Microsoft.Extensions.Hosting.
2020-07-14T09:22:07.4739765Z Found DbContext 'FirstDatabaseContext'.
2020-07-14T09:22:07.4745394Z Found DbContext 'SecondDatabaseContext'.
2020-07-14T09:22:07.4746554Z Found DbContext 'LibraryDatabaseContext'.
2020-07-14T09:22:07.4748389Z Found DbContext 'InternalLibraryDatabaseContext'.
2020-07-14T09:22:07.4749359Z Finding DbContext classes in the project...
2020-07-14T09:22:07.5642962Z Using context 'LibraryDatabaseContext'.
2020-07-14T09:22:07.9534685Z info: Microsoft.EntityFrameworkCore.Infrastructure[10403]
2020-07-14T09:22:07.9537347Z Entity Framework Core 3.1.0 initialized 'LibraryDatabaseContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
2020-07-14T09:22:07.9581693Z Finding design-time services for provider 'Microsoft.EntityFrameworkCore.SqlServer'...
2020-07-14T09:22:07.9588354Z Using design-time services from provider 'Microsoft.EntityFrameworkCore.SqlServer'.
2020-07-14T09:22:07.9605086Z Finding design-time services referenced by assembly 'NetCore3.1TestApplication'.
2020-07-14T09:22:07.9610683Z No referenced design-time services were found.
2020-07-14T09:22:07.9616289Z Finding IDesignTimeServices implementations in assembly 'NetCore3.1TestApplication'...
2020-07-14T09:22:07.9623507Z No design-time services were found.
2020-07-14T09:22:08.1225020Z Writing 'd:\a\1\a/migrations-library/LibraryDatabaseContext.sql'...
2020-07-14T09:22:08.1532808Z
2020-07-14T09:22:08.1622241Z Generating migration script for InternalLibraryDatabaseContext in project d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj
2020-07-14T09:22:08.1654251Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe ef migrations script --idempotent --project d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj --startup-project d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj --output d:\a\1\a/migrations-library/InternalLibraryDatabaseContext.sql --context InternalLibraryDatabaseContext --verbose
2020-07-14T09:22:08.4800729Z Using project 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj'.
2020-07-14T09:22:08.4803472Z Using startup project 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj'.
2020-07-14T09:22:08.4844631Z Writing 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\obj\NetCore3.1TestApplication.csproj.EntityFrameworkCore.targets'...
2020-07-14T09:22:08.4920802Z dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\VssAdministrator\AppData\Local\Temp\tmpC069.tmp /verbosity:quiet /nologo d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj
2020-07-14T09:22:09.3681069Z Writing 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\obj\NetCore3.1TestApplication.csproj.EntityFrameworkCore.targets'...
2020-07-14T09:22:09.3690602Z dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\VssAdministrator\AppData\Local\Temp\tmpC3D5.tmp /verbosity:quiet /nologo d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj
2020-07-14T09:22:10.2577475Z Build started...
2020-07-14T09:22:10.2587680Z dotnet build d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\NetCore3.1TestApplication.csproj /verbosity:quiet /nologo
2020-07-14T09:22:13.8593228Z
2020-07-14T09:22:13.8613777Z Build succeeded.
2020-07-14T09:22:13.8615411Z 0 Warning(s)
2020-07-14T09:22:13.8618997Z 0 Error(s)
2020-07-14T09:22:13.8630520Z
2020-07-14T09:22:13.8632798Z Time Elapsed 00:00:03.05
2020-07-14T09:22:13.9230344Z Build succeeded.
2020-07-14T09:22:13.9382457Z dotnet exec --depsfile d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\bin\Debug\netcoreapp3.1\NetCore3.1TestApplication.deps.json --additionalprobingpath C:\Users\VssAdministrator\.nuget\packages --additionalprobingpath C:\Microsoft\Xamarin\NuGet --runtimeconfig d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\bin\Debug\netcoreapp3.1\NetCore3.1TestApplication.runtimeconfig.json C:\Users\VssAdministrator\.dotnet\tools\.store\dotnet-ef\3.1.5\dotnet-ef\3.1.5\tools\netcoreapp3.1\any\tools\netcoreapp2.0\any\ef.dll migrations script --idempotent --output d:\a\1\a/migrations-library/InternalLibraryDatabaseContext.sql --context InternalLibraryDatabaseContext --assembly d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\bin\Debug\netcoreapp3.1\NetCore3.1TestApplication.dll --startup-assembly d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\bin\Debug\netcoreapp3.1\NetCore3.1TestApplication.dll --project-dir d:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\ --language C# --working-dir d:\a\1\s --verbose --root-namespace NetCore3_1TestApplication
2020-07-14T09:22:14.0785758Z Using assembly 'NetCore3.1TestApplication'.
2020-07-14T09:22:14.0787121Z Using startup assembly 'NetCore3.1TestApplication'.
2020-07-14T09:22:14.0792362Z Using application base 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\bin\Debug\netcoreapp3.1'.
2020-07-14T09:22:14.0793496Z Using working directory 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication'.
2020-07-14T09:22:14.0794716Z Using root namespace 'NetCore3_1TestApplication'.
2020-07-14T09:22:14.0803604Z Using project directory 'd:\a\1\s\NetCore3.1TestApplication\NetCore3.1TestApplication\'.
2020-07-14T09:22:14.1939461Z Finding DbContext classes...
2020-07-14T09:22:14.1940737Z Finding IDesignTimeDbContextFactory implementations...
2020-07-14T09:22:14.1980579Z Finding application service provider...
2020-07-14T09:22:14.1985384Z Finding Microsoft.Extensions.Hosting service provider...
2020-07-14T09:22:14.2008978Z Using environment 'Development'.
2020-07-14T09:22:14.3982363Z Using application service provider from Microsoft.Extensions.Hosting.
2020-07-14T09:22:14.4205682Z Found DbContext 'FirstDatabaseContext'.
2020-07-14T09:22:14.4212587Z Found DbContext 'SecondDatabaseContext'.
2020-07-14T09:22:14.4213870Z Found DbContext 'LibraryDatabaseContext'.
2020-07-14T09:22:14.4216167Z Found DbContext 'InternalLibraryDatabaseContext'.
2020-07-14T09:22:14.4217219Z Finding DbContext classes in the project...
2020-07-14T09:22:14.5187144Z Using context 'InternalLibraryDatabaseContext'.
2020-07-14T09:22:14.9253505Z info: Microsoft.EntityFrameworkCore.Infrastructure[10403]
2020-07-14T09:22:14.9257169Z Entity Framework Core 3.1.0 initialized 'InternalLibraryDatabaseContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
2020-07-14T09:22:14.9302135Z Finding design-time services for provider 'Microsoft.EntityFrameworkCore.SqlServer'...
2020-07-14T09:22:14.9310891Z Using design-time services from provider 'Microsoft.EntityFrameworkCore.SqlServer'.
2020-07-14T09:22:14.9334194Z Finding design-time services referenced by assembly 'NetCore3.1TestApplication'.
2020-07-14T09:22:14.9338797Z No referenced design-time services were found.
2020-07-14T09:22:14.9346905Z Finding IDesignTimeServices implementations in assembly 'NetCore3.1TestApplication'...
2020-07-14T09:22:14.9354199Z No design-time services were found.
2020-07-14T09:22:15.0948262Z Writing 'd:\a\1\a/migrations-library/InternalLibraryDatabaseContext.sql'...
2020-07-14T09:22:15.1279069Z
2020-07-14T09:22:15.1398880Z Generating migration script completed!
2020-07-14T09:22:15.1484532Z ##[section]Finishing: Generate migrations scripts - Library project
So, this is what I've found out.
On my local machine, I can reproduce this. It actually doesn't have anything to do with your plugin, but it would be nice if your plugin checked this.
dotnet ef
(you should get what you would expect, that you need more arguments)dotnet ef
againExpected: The same thing should happen, the tool should respond asking for more arguments Actual: The message "Specify which project file to use because this '(whatever your path is)' contains more than one project file" is shown.
I can't imagine this is desirable, seems broken on their end. Filed a bug with them: https://github.com/dotnet/efcore/issues/21655
Setting the working directory allows this to work (if I do it without the plugin). The plugin doesn't let me set a working directory. Is it possible to add that or to have the plugin change working directory automatically?
Nice work @kfrancis! I am trying to replicate your issue but doesn't succeed. In this repository https://github.com/pekspro/EF-Migrations-Script-Generator-Task I have several test projects. If I locally copy everything from NetCore3.0TestApplication
to NetCore3.1TestApplication
I get two .sln files just as you explained. But when I run dotnet ef
I do not get the error message Specify which project file to use because...
But I do get this message if I copy two csproj-files into the same folder on then run dotnet ef
. Do you also have several csproj-files in the same folder?
@kfrancis, I did some more testing and I added a comment to your issue dotnet/efcore#21655. I think you have found the problem :-)
@joe704la, could it be that you also have multiple csproj-files in the same folder?
@pekspro So, is there a chance of an update to allow a working directory? No idea how long they might take to find/correct and I rather like your generator. It's worked so well for so long.
@kfrancis, adding the working directory as a parameter is something I considering. I just want to them a couple of days to respond to the issue.
Just by curiosity, do you have multiple csproj-files in the same folder in your project? If that is the case you might be able to work around the problem just by renaming one of the files in the pipeline before you run this tool.
No, only solutions in the root working directory of my example.
Great, thanks for the information @kfrancis. I will see if I could add a Working directory setting the following weekend.
Thanks so much @pekspro!
@kfrancis and @joe704la, now there is a setting in the Advanced area for setting the working directory. Could you verify that this works?
I do see it, and it's working properly now with that set.
Unfortunately, they've interpreted my issue as really just an issue with the help portion of that command but that's not the issue. Thanks for adding that.
@kfrancis, great to see that it is working for you. I hope this will be fixed someday properly by the ef-core team.
I am closing this issue.
I have used this task for about 6+ months now without any issue. I updated my EF project to 3.1.4 and for some reason, it keeps telling me Specify which project file to use because this 'D:\a\1\s' contains more than one project file. I can't figure out what is going on with it. I have no had 10 times across 11 pipeline runs. I have tried many configurations in the Main Project Path and Startup project path. Including removing the startup project, and just pointing to the folder instead of the actual csproj file. I have specifically selected 3.1.4 and install dependencies for .Net Core 3. I have also tried adding Use .NET Core SDK specific version for 3.1.4. Nothing helps. I keep getting the same error.
If I run the command directly on my dev machine I can get it to work just fine. Any help would be greatly appreciated. Thank you
2020-06-20T15:20:45.9252301Z ##[section]Starting: Generate Migration Scripts 2020-06-20T15:20:45.9452811Z ============================================================================== 2020-06-20T15:20:45.9453940Z Task : Entity Framework Core Migrations Script Generator 2020-06-20T15:20:45.9454497Z Description : Tool for projects that use Entity Framework Core Code-First. Generates migration scripts which can be used to update a database (for instance with the task 'Azure SQL Database Deployment'). 2020-06-20T15:20:45.9454984Z Version : 0.0.42 2020-06-20T15:20:45.9455194Z Author : PEK's Productions 2020-06-20T15:20:45.9455547Z Help : More Information 2020-06-20T15:20:45.9455919Z ============================================================================== 2020-06-20T15:20:46.6466272Z Project path: D:\a\1\s\src\YNP.EntityFrameworkCore\YNP.EntityFrameworkCore.csproj 2020-06-20T15:20:46.6467667Z Start-up project path: D:\a\1\s\src\YNP.Web.Host\YNP.Web.Host.csproj 2020-06-20T15:20:46.6468840Z Target folder: D:\a\1\a/migrations 2020-06-20T15:20:46.6469758Z Number of database contexts: 1 2020-06-20T15:20:46.6470269Z Checking of dotnet-ef is installed. 2020-06-20T15:20:46.6535538Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe tool list --global 2020-06-20T15:20:46.9799698Z Package Id Version Commands 2020-06-20T15:20:46.9809003Z ------------------------------------- 2020-06-20T15:20:46.9884738Z 2020-06-20T15:20:46.9957249Z Parsing output: "Package Id Version Commands 2020-06-20T15:20:46.9958672Z ------------------------------------- 2020-06-20T15:20:46.9959025Z " 2020-06-20T15:20:46.9959343Z Installing latest version of dotnet-ef as global tool. 2020-06-20T15:20:46.9991935Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe tool install --global dotnet-ef --version 3.1.4 2020-06-20T15:20:49.9888996Z You can invoke the tool using the following command: dotnet-ef 2020-06-20T15:20:49.9889758Z Tool 'dotnet-ef' (version '3.1.4') was successfully installed. 2020-06-20T15:20:49.9938257Z 2020-06-20T15:20:50.0111372Z Generating migration script for YNPDbContext in project D:\a\1\s\src\YNP.EntityFrameworkCore\YNP.EntityFrameworkCore.csproj 2020-06-20T15:20:50.0165242Z [command]C:\hostedtoolcache\windows\dotnet\dotnet.exe ef migrations script --idempotent --project D:\a\1\s\src\YNP.EntityFrameworkCore\YNP.EntityFrameworkCore.csproj --startup-project D:\a\1\s\src\YNP.Web.Host\YNP.Web.Host.csproj --output D:\a\1\a/migrations/YNPDbContext.sql --context YNPDbContext --verbose 2020-06-20T15:20:50.2057794Z Specify which project file to use because this 'D:\a\1\s' contains more than one project file. 2020-06-20T15:20:50.2108101Z 2020-06-20T15:20:50.2284311Z ##[error]The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1 2020-06-20T15:20:50.2366753Z ##[section]Finishing: Generate Migration Scripts