フィルターのクリア

How can I get MATLAB CI job to compile app to use .NET Core?

5 ビュー (過去 30 日間)
James Hood
James Hood 2022 年 11 月 21 日
編集済み: James Hood 2023 年 9 月 27 日
If I run the below commands in MATLAB on my compiler machine, the compiled app runs fine. However, when my continuous integration job runs them I this "Bad IL format" error message, which makes me think it's trying to load my DLL in .NET Framework instead of .NET Core. I added dotnetenv("core") to the command the CI job is running, but it doesn't seem to resolve the situation.
- task: RunMATLABCommand@0
displayName: 'Build TileExplorer.mlapp'
inputs:
command: |
openProject('MyProject.prj');
dotnetenv("core");
compiler.build.standaloneWindowsApplication('MyApp.mlapp', 'OutputDir', 'publish', 'Verbose', 'On', 'AdditionalFiles', ["MyNetCoreLibrary.dll"], 'ExecutableIcon', 'logo.png');
  2 件のコメント
Rhys
Rhys 2023 年 8 月 15 日
Any feedback on this?
James Hood
James Hood 2023 年 9 月 27 日
編集済み: James Hood 2023 年 9 月 27 日
@Rhys My CI job wasn't checking out the source code with LFS enabled. The error message upon running the compiled app was due to the embedded .DLL files being the LFS references instead of the actual file contents.

サインインしてコメントする。

採用された回答

James Hood
James Hood 2023 年 9 月 27 日
My issue turned out to be that the continuous integration job was not checking out the source code with LFS enabled. This of course resulted in the .dll files being the textual LFS references instead of the file's contents.
I realized this when inspecting the extracted app in the MCR cache and observing the .NET .dll files were all <1 KBs. Enabling LFS in my pipeline's checkout command resolved the error message.

その他の回答 (1 件)

Venkat Siddarth
Venkat Siddarth 2023 年 9 月 7 日
編集済み: Venkat Siddarth 2023 年 9 月 7 日
I understand that you are experiencing Bad IL format error, while running the continuous integration job.
The "Bad IL format" error typically indicates an issue or error in the Intermediate Language (IL) code of a program.
To solve this issue,refer the following steps:
  • Check the .NET Core version: Verify that the correct version of .NET Core is installed on your continuous integration machine. To ensure it matches the version you are targeting.
  • Clean and rebuild: Sometimes, the error may be caused by a corrupted or outdated IL file. Try cleaning the project (remove temporary files, cache etc) and rebuilding it to regenerate the IL code.
  • Check compiler and runtime versions: Ensure that the compiler version used during development matches the runtime version used in the continuous integration environment. Mismatched versions can lead to compatibility issues and result in a "bad IL format" error.
  • Update dependencies: If you are using any third-party libraries or dependencies, make sure they are up to date. Sometimes, using an outdated version of a library can cause compatibility issues with the IL code.
  • Verify build process: Check the build process in your continuous integration environment to ensure that all the necessary steps, such as compiling, packaging, and deploying(if any), are performed correctly. Any issues in the build process can lead to a "bad IL format" error.
I hope this resolves the query,
Regards,
Venkat Siddarth V.

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by