- product version: 10.0 - product type: ASP.NET Core & jQuery - framework type .net core - ABP v6
I added a reference to Migrator project in Web.Mvc project. So, I have the migrator.exe and other files in Web.Mvc project folder of artifacts. But I can not run it.
I am having trouble running migrator.exe on my local machine and on release pipeline in azure devops. I am using a Batch script tool in azure devops, where I selected migrator.exe in artifacts. I get the following error:
2021-01-12T08:12:33.9966523Z ##[command]C:\azagent\A1\_work\r2\a\_LinkEd-Classic-CI\drop\LinkEd.Web.Mvc\LinkEd.Migrator.exe
2021-01-12T08:12:34.0575972Z Cannot use file stream for [C:\azagent\A1\_work\r2\a\_LinkEd-Classic-CI\drop\LinkEd.Web.Mvc\LinkEd.Migrator.deps.json]: No such file or directory
2021-01-12T08:12:34.0578566Z A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet'.
2021-01-12T08:12:34.0579328Z Failed to run as a self-contained app.
2021-01-12T08:12:34.0580764Z - The application was run as a self-contained app because 'C:\azagent\A1\_work\r2\a\_LinkEd-Classic-CI\drop\LinkEd.Web.Mvc\LinkEd.Migrator.runtimeconfig.json' was not found.
2021-01-12T08:12:34.0581957Z - If this should be a framework-dependent app, add the 'C:\azagent\A1\_work\r2\a\_LinkEd-Classic-CI\drop\LinkEd.Web.Mvc\LinkEd.Migrator.runtimeconfig.json' file and specify the appropriate framework.
2021-01-12T08:12:34.2008684Z ##[error]Process completed with exit code -2147450749.
How do I get to generate <b>LinkEd.Migrator.deps.json</b> file?
9 Answer(s)
-
0
Hi @dauren
Could you try to publish your Migrator project and execute it after publishing the project on your Pipeline ?
You can publish your project as explained here. Then, you can run output executable using
dotnet run
command.Thanks,
-
0
Hi, thank you for reply. I have followed your advice and successfully published the migrator project. When I try to run it i receive the following error:
2021-01-13T17:15:58.4173562Z Unhandled exception. System.IO.FileNotFoundException: Could not find file 'C:\azagent\A1\_work\r2\a\log4net.config'. 2021-01-13T17:15:58.4174850Z File name: 'C:\azagent\A1\_work\r2\a\log4net.config' 2021-01-13T17:15:58.4175321Z at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle) 2021-01-13T17:15:58.4175783Z at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options) 2021-01-13T17:15:58.4176369Z at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) 2021-01-13T17:15:58.4176938Z at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) 2021-01-13T17:15:58.4177277Z at System.IO.File.OpenRead(String path) 2021-01-13T17:15:58.4177759Z at Abp.Castle.Logging.Log4Net.Log4NetLoggerFactory..ctor(String configFileName) 2021-01-13T17:15:58.4178073Z at lambda_method1(Closure , Object[] ) 2021-01-13T17:15:58.4178491Z at Castle.Core.Internal.ReflectionUtil.Instantiate(ConstructorInfo ctor, Object[] ctorArgs) 2021-01-13T17:15:58.4178996Z at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs) 2021-01-13T17:15:58.4179522Z at Castle.Core.Internal.ReflectionUtil.CreateInstance[TBase](Type subtypeofTBase, Object[] ctorArgs) 2021-01-13T17:15:58.4180031Z at Castle.Facilities.Logging.LoggingFacility.CreateProperLoggerFactory(LoggerImplementation loggerApi) 2021-01-13T17:15:58.4180534Z at Castle.Facilities.Logging.LoggingFacility.ReadConfigurationAndCreateLoggerFactory() 2021-01-13T17:15:58.4180971Z at Castle.Facilities.Logging.LoggingFacility.Init() 2021-01-13T17:15:58.4181456Z at Castle.MicroKernel.Facilities.AbstractFacility.Castle.MicroKernel.IFacility.Init(IKernel kernel, IConfiguration facilityConfig) 2021-01-13T17:15:58.4181957Z at Castle.MicroKernel.DefaultKernel.AddFacility(IFacility facility) 2021-01-13T17:15:58.4182388Z at Castle.MicroKernel.DefaultKernel.AddFacility[T](Action
1 onCreate) 2021-01-13T17:15:58.4182799Z at Castle.Windsor.WindsorContainer.AddFacility[T](Action1 onCreate) 2021-01-13T17:15:58.4183307Z at LinkEd.Migrator.Program.Main(String[] args) in D:\a\1\s\src\LinkEd.Migrator\Program.cs:line 22
But I see that the log4net.config file is present at the running directory of migrator.exe
-
0
OKay, I have figured out how to properly execute the Migrator.exe in pipeline. By default, it looks for the log4net.file in different directory, for some reason. I had to specify the Working directory option for my Batch script step, where you have to specify the directory where the Migrator.exe is located. Working directory option is under Advanced section.
But now the result is:
2021-01-13T17:46:27.7228038Z 2021-01-13 20:46:27 | Continue to migration for this host database and all tenants..? (Y/N): 2021-01-13T17:46:27.7229064Z 2021-01-13 20:46:27 | Migration canceled.
How can I specify that it should migrate all databases (tenant and host) by default?
-
0
I tried copying the
LinkEd.Migrator.deps.json
file and running the Migrator.exe, and it gave error saying thatLinkEd.Migrator.runtimeconfig.json
was not found, all of these files exist in publish folder and the Migrator.exe runs perfectly ok in publish folder. But I can not update the connection string inappsettings.json
of Migrator project during publish, so I can not use Migrator.exe there. Variable substitution changes connection string forappsettings.json
in wwwroot folder only. If I manually edit the connection string inappsettings.json
of Migrator project in publish folder, migration works perfectly. However, I suppose this is not question of aspnet zero. Thanks for help. -
0
Hi @dauren
Is your website HTTP ? If so, You can take a look at this issue.