Creating a class library in visual studio code

后端 未结 1 1937
遇见更好的自我
遇见更好的自我 2020-12-24 15:16

It might be a silly question, Let\'s say I don\'t have a Windows OS, have a Linux. I have created a .Net core console app, also want to create a class library and reference

1条回答
  •  生来不讨喜
    2020-12-24 16:08

    The best way to do it is from the console, since you are using the latest supported templates this way. VSCode also has an integrated terminal you can use for this.

    $ dotnet new lib -o MyLib
    $ dotnet new sln #assuming there is no .sln file yet. if there is, skip this
    $ dotnet sln add MyLib/MyLib.csproj
    $ cd MyConsoleApp
    $ dotnet add reference ../MyLib/MyLib.csproj
    

    If you need different frameworks, you can use the -f argument:

    $ dotnet new lib -o MyLib -f netcoreapp2.0
    

    or manually change the element inside the generated .csproj file.

    0 讨论(0)
提交回复
热议问题