-
Notifications
You must be signed in to change notification settings - Fork 164
/
Instructions.txt
52 lines (44 loc) · 1.12 KB
/
Instructions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
//C:\Windows\Microsoft.Net\Framework\v4.0.30319\csc.exe /r:"C:\Windows\Microsoft.Net\Framework\v4.0.30319\Microsoft.Build.Framework.dll" /r:"C:\Windows\Microsoft.Net\Framework\v4.0.30319\Microsoft.Build.Utilities.v4.0.dll" /target:library /out:addtask.dll addtask.cs
namespace MyTasks
{
public class AddTask : Task
{
private int number1;
[Required]
public int Number1
{
get { return number1; }
set { number1 = value; }
}
private int number2;
[Required]
public int Number2
{
get { return number2; }
set { number2 = value; }
}
private int sum;
[Output]
public int Sum
{
get { return sum; }
set { sum = value; }
}
public override bool Execute()
{
try
{
sum = number1 + number2;
}
catch (ArithmeticException e)
{
Console.WriteLine("Error occured during addition: {0}", e.Message);
return false;
}
return true;
}
}
}