MSBuildを使用して、SQLサーバーインスタンスでSQL認証が有効になっているかどうかを確認しようとしています。私は次のことを試みています:
<Target Name="VerifySQLLoginMode">
<PropertyGroup>
<SqlInstanceName>SQL08X64</SqlInstanceName>
<SqlInstanceKey>$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL@$(SqlInstanceName))</SqlInstanceKey>
<SqlLoginMode>$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\$(SqlInstanceKey)\MSSQLServer@LoginMode)</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>
$(SqlInstanceName)
残念ながら、MSBuildはプロパティ内のプロパティ()を参照できないようです$(registry:...)
。
または、これを機能させる方法はありますか?