build.cake:
var target = Argument("target", "Default");
Task("Default")
.Does(() => {
var client = new RestSharp.RestClient("www.test.com");
Information("Hello World!");
});
RunTarget(target);
packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.21.1" />
<package id="RestSharp" version="105.2.3" />
</packages>
Error Received:
error CS0246: The type or namespace name 'RestSharp' could not be fou nd (are you missing a using directive or an assembly reference?)
Use the #addin
preprocessor directive to load assemblies from nuget, it'll fetch the package and reference the assemblies within it.
#addin nuget:?package=Cake.Foo
#addin nuget:?package=Cake.Foo&version=1.2.3
#addin nuget:?package=Cake.Foo&prerelease
#addin nuget:https://myget.org/f/Cake/?package=Cake.Foo&prerelease
You read more about the preprocessor directives at cakebuild.net.
Your example script would look something like this:
#addin nuget:?package=RestSharp&version=105.2.3
var target = Argument("target", "Default");
Task("Default")
.Does(() => {
var client = new RestSharp.RestClient("http://www.test.com");
Information("Hello World!");
});
RunTarget(target);
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