My sytem is ubuntu 20.04. Maybe There are some differences for other version, for instance 12.x, or other systems,such as CentOS.

Assume my solution file is Test.sln, and contains some projects.

First of all, you may need to install these executable pakcages:

sudo apt install dotnet-sdk-6.0
sudo apt install nuget

Configure your local nuget sources

Assuming your Nuget locates in /home/username/nuget,you can create a configuration file in your solution directory, and type or paste the configuration contents as the following:

<configuration>
    <packageSources>
        <add key="LocalSource" value="/home/username/nuget" />
    </packageSources>
</configuration>

Or you can excute the follow command in the terminal:

sudo nuget add -name localSource -source /home/username/nuget

Restore the nuget packages

You must install the nuget executable firstly.

sudo apt install nuget -Y

Then locate to your Test.sln file, and start resore your solution by the following command:

sudo dotnet restore Test.sln

Start build your solution

sudo dotnet build Test.sln

Build C++ Library project

If your solution includes a C++ Library project, you may receive an Error when you build your solution. The error perchance resembles the below text:

The imported project "/Microsoft.Cpp.Default.props" was not found.

To solve the erroneous(incorrect) propmt, you can follow the methods below:

I. Utilise cmake toolchain

II.

发表评论

电子邮件地址不会被公开。 必填项已用*标注