I have written an inline msbuild task that won't compile. The error reads "The 'Namespace' attribute has been set but is empty. If the 'Namespace' attribute is set it must not be empty." Note: This is a Wix Installer Project. Here is my code:
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ConnectionString Condition=" '$(ConnectionString)' == ''">Server=???;Database=???;Integrated Security=True;</ConnectionString>
<SqlCommand Condition=" '$(SqlCommand)' == '' ">???</SqlCommand>
</PropertyGroup>
<UsingTask
TaskName="ExecuteScalar"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<ConnectionString ParameterType="System.String" Required="true" />
<CommandText ParameterType="System.String" Required="true" />
<Result ParameterType="System.String" Output="true" />
</ParameterGroup>
<Task>
<Reference Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.dll" />
<Using Namespace="System.Data.SqlClient" />
<Using Namepsace="System.Data.Sql" />
<Code Type="Fragment" Language="cs"><![CDATA[
using (SqlConnection conn = new SqlConnection(ConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(CommandText, conn))
{
cmd.CommandType = System.Data.CommandType.Text;
Result = cmd.ExecuteScalar() as string;
}}]]>
</Code>
</Task>
</UsingTask>
<Target Name="MyTarget">
<ExecuteScalar ConnectionString="$(ConnectionString)"
CommandText="$(SqlCommand)">
<Output TaskParameter="Result" PropertyName="MyProperty" />
</ExecuteScalar>
</Target>
<PropertyGroup>
<BuildDependsOn>
BeforeBuild;
CoreBuild;
AfterBuild
</BuildDependsOn>
</PropertyGroup>
<Target Name="Build" DependsOnTargets="$(BuildDependsOn)" />
<PropertyGroup>
<BuildDependsOn>
MyTarget;
$(BuildDependsOn)
</BuildDependsOn>
</PropertyGroup>
I cannot find anything when I search on this error. I appreciate any help.
I have been referencing: