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)
)。
或者有什麼方法可以使這項工作?