Skip to content

serilog can't be loaded in PowerShell module #97

Description

@Andy-AO

I want to use serilog in the pwsh module to record log information, but when I install it in nuget and use it in the code, my module will not work properly. Why? I feel very confused.

Build FAILED. 5 tasks, 1 errors, 0 warnings 00:00:01.8684807
Test-SampleCmdlet: D:\GitRepository\CSharp\myModuleForSerilog\ImportAndRun.ps1:2
Line |
   2 |  Test-SampleCmdlet -FavoriteNumber 1 -FavoritePet Cat
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not load file or assembly 'Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10'.
     | The system cannot find the file specified.

Here is my case, after unpacking, execute . \build.ps1 will automatically compile and run the Cmdlet in it, and you will find the error at this time.

myModuleWithSerilog.zip

Andy-AO/myModuleWithSerilog

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions