Dotnet Core library issue

Welcome Forums General PowerShell Q&A Dotnet Core library issue

This topic contains 2 replies, has 3 voices, and was last updated by

1 year, 1 month ago.

  • Author
  • #97161

    Topics: 2
    Replies: 10
    Points: 0
    Rank: Member

    I am totally new to dotnet core.
    I generated a new Folder on my drive, after this I executed this command:
    Donet new classlib -o DLL-Test
    after this I went to the Project Folder and changed the class1.cs file like this:

    using System;
    namespace dll_test
        public class Class1
            public static string NewString(){
                return "Newstring";

    after this I added the powershell lib like this:
    dotnet add package PowerShellStandard.Library –version 5.1.0-preview-02

    finally i build the dll, which is now showing up:
    dotnet build

    and now I try to Import this via powershell by add-type and specify the source of the file.
    BUT I get an error which is complaining about: At least one type in the assembly could not be loaded.

    Did you had this strange issue before OR you can see directly what i am doing wrong?


  • #97212

    Topics: 13
    Replies: 4872
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    Unfortunately, this isn't a .NET forum – you might have better luck getting a good answer someplace like StackOverflow. This website is dedicated to PowerShell.

  • #97218

    Topics: 21
    Replies: 592
    Points: 1,149
    Helping Hand
    Rank: Community Hero

    Works for me.

    $env:path += ';C:\Windows\Microsoft.NET\Framework64\v4.0.30319'
    csc /t:library class1.cs
    add-type -path '.\class1.dll'

The topic ‘Dotnet Core library issue’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort