Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The DotNet Add action can be used to add a reference or package to a .Net project file. The command starts with a compatibility check to ensure the package is compatible with the frameworks in the project. If the check passes, a <PackageReference> element is added to the project file and dotnet restore is run.or a project to a .Net solution file. 

DotNet Add

Name

A friendly name for this action (will be displayed in the actions workflow area).

...

Determines if this action will be run within the relevant stage.

What to Add

Select what to want to add to what. You can choose to add one of the following:

  • Package to project 
  • Reference to project
  • Project to solution

Package to project

This option uses the "dotnet add package" command line to add a package reference to a project file. The command starts with a compatibility check to ensure the package is compatible with the frameworks in the project. If the check passes, a <PackageReference> element is added to the project file and dotnet restore is run.

The following fields are shown when this option is selected.

Project Path

The path to project file or folder to modify. If a folder is specified, the folder will be searched for a file that has a file extension that ends in "proj".

...

If left empty, this will default to the workspace folder.

Working Folder

...

An optional working folder for running the executable.

...

If left empty, this will default to the Project Path.

Target Framework

...

If the target framework name is entered, the package reference will only be added to a project targeting the specified framework.

Package Name

The name of the package reference to add.

Package Version

The version of the package to add.

Skip restore preview and compatibility check

Tick to

...

add the package without performing a restore preview and compatibility check.

Package Source

The NuGet package source to use during the restore operation.

Package Directory

...

A directory to restore the package to.

Reference to project

This option uses the "dotnet add reference" command line to add project references to a project file. The command adds one or more <ProjectReference> elements to the project file.

The following fields are shown when this option is selected.

Project Path

...

The path to project file or folder to modify. If a folder is specified, the folder will be searched for a file that has a file extension that ends in

...

"proj". If left empty, this will default to the workspace folder.

Working Folder

...

An optional working folder for running the executable.

...

If left empty, this will default to the Project Path.

Target Framework

...

If the target framework name is entered, the project reference will only be added to a project targeting the specified framework.

Project References

...

Add the path to one or more project references

...

- one reference per line. This should generally be entered as relative paths - relative to the Working Folder.


Project to solution

This option uses the "dotnet sln .. add" command line to add a project references to a solution file. 

The following fields are shown when this option is selected.

Solution Path

Path to the solution file to modify. If a folder is specified, the folder will be searched for a file that has a file extension that ends in `sln`. If there are multiple solution files in the folder, one must be specified.

...

 If left empty, this will default to the workspace folder.

Working Folder

...

An optional working folder for running the executable.

...

If left empty, this will default to the Solution Path.

Project Paths

...

Add the path to one or more project files - one file per line. This should generally be entered as relative paths - relative to the Working Folder.


Using

The Using drop down is populated with any property collector whose namespace matches the pattern defined by the DotNet CLI Actions. The pattern for this action is ^DotNet.Cli.*

...