Executes code contained within the task.
Namespace: MSBuild.Community.Tasks
Assembly: MSBuild.Community.Tasks (in MSBuild.Community.Tasks.dll)
Syntax
Example
Simple script that writes to the console
Copy Code
| |
|---|---|
<PropertyGroup>
<HelloCode>
<![CDATA[
public static void ScriptMain() {
Console.WriteLine("Hello MSBuild Community Scripting World.");
}
]] >
</HelloCode>
</PropertyGroup>
<Target Name="Hello">
<Script Language="C#" Code="$(HelloCode)" Imports="System" />
</Target>
| |
Script that returns a value.
Copy Code
| |
|---|---|
<PropertyGroup>
<GetProgramFilesCode>
<![CDATA[
public static string ScriptMain() {
return Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
}
]] >
</GetProgramFilesCode>
</PropertyGroup>
<Target Name="GetProgramFilesFolder">
<Script Language="C#" Code="$(GetProgramFilesCode)">
<Output TaskParameter="ReturnValue" PropertyName="ProgramFilesFolder" />
</Script>
<Message Text="Program files are in: $(ProgramFilesFolder)" />
</Target>
| |
Inheritance Hierarchy
Thread Safety
Public static (Shared in Visual Basic)staticShared members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
See Also
Documentation version 1.0.0.0.