I'd like to create a new C# solution with Visual Studio Code.
I'm using yo tools.
Now I have a folder with ASP project. And another folder with class library.
How can I reference class library from asp project?
Seems I have to add dependency to the project.json:
"dependencies": { "ClassLibrar.Name": "*" }
But to make this possible I need solution file. But VS Code and yo doesn't create a such one.
VS Code can be used from different OS, while VS accessible only from Windows, I'd like o create a new solution with VS Code only.
Simple requirement: create web project and 1+ class libraries.
All this will be packed in docker container
1. Create: Used to Create a new empty file. Syntax in C language: int create(char *filename, mode_t mode) Parameter: filename : name of the file which you want to create.
c file contains the main function, the server. c file contains the user defined function, The third file which is server. h header file which calls the user defined functions in the server. c file and the fourth file which is makefile.mk which contains set of all the commands with their variable names.
Visual Studio Code provides a way to create the new project templates.
dotnet new
sln
dotnet new
-l
The detailed documentation is Available Here.
Open VS Code terminal and navigate to the directory where you want to create solution folder. Use following commands
dotnet new sln -o MyApiApp
The -o parameter lets you specify the output directory
Navigate to solution direction
Cd .\MyApiApp\
Create new projects under root solution folder
dotnet new console -o MyApiApp.ConsoleApp dotnet new webapi -o MyApiApp.WebApi dotnet new classlib -o MyApiApp.Repository dotnet new xunit -o MyApiApp.Tests
Add projects to solution (use tab to navigate path).
dotnet sln MyApiApp.sln add .\MyApiApp.ConsoleApp\MyApiApp.ConsoleApp.csproj .\MyApiApp.WebApi\MyApiApp.WebApi.csproj .\MyApiApp.Repository\MyApiApp.Repository.csproj .\MyApiApp.Tests\MyApiApp.Tests.csproj
Add project references
dotnet add .\MyApiApp.WebApi\MyApiApp.WebApi.csproj reference .\MyApiApp.Repository\MyApiApp.Repository.csproj dotnet add .\MyApiApp.ConsoleApp\MyApiApp.ConsoleApp.csproj reference .\MyApiApp.Repository\MyApiApp.Repository.csproj dotnet add .\MyApiApp.Tests\MyApiApp.Tests.csproj reference .\MyApiApp.WebApi\MyApiApp.WebApi.csproj .\MyApiApp.Repository\MyApiApp.Repository.csproj
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With