4
我正在尝试使用MSBuild来确定SQL服务器实例是否启用了SQL身份验证。我想以下几点:在MSBuild中使用注册表属性时引用属性?
<Target Name="VerifySQLLoginMode">
<PropertyGroup>
<SqlInstanceName>SQL08X64</SqlInstanceName>
<SqlInstanceKey>$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\[email protected]$(SqlInstanceName))</SqlInstanceKey>
<SqlLoginMode>$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\$(SqlInstanceKey)\[email protected])</SqlLoginMode>
</PropertyGroup>
<Message Text="SqlInstanceName = $(SqlInstanceName)" />
<Message Text="SqlInstanceKey = $(SqlInstanceKey)" />
<Message Text="SqlLoginMode = $(SqlLoginMode)" />
<Error Condition="'$(SqlLoginMode)' != '2'" Text="Error: SQL Authentication is disabled. Please enable it." />
</Target>
不幸的是,的MSBuild似乎并没有让里面$(registry:...)
性引用属性($(SqlInstanceName)
)。
或者有什么方法可以使这项工作?