MSBuild.ExtensionPack.Sql2005.Database in 4.0 error

Mar 16, 2011 at 11:39 PM
Edited Mar 16, 2011 at 11:40 PM

The following msbuild code worked fine using 3.5.2.0

<MSBuild.ExtensionPack.Sql2005.Database TaskAction="SetOffline" DatabaseItem="MyDatabase" MachineName="$(SQLServerName)"/>

<MSBuild.ExtensionPack.Sql2005.Database TaskAction="Restore" DatabaseItem="MyDatabase" MachineName="$(SQLServerName)"
DataFilePath="$(BackupPathAndFile)" Condition="$(ResetDatabase)"/>

<MSBuild.ExtensionPack.Sql2005.Database TaskAction="SetOnline" DatabaseItem="MyDatabase" MachineName="$(SQLServerName)"/>
After installing 4.0.2.0 and pointing to it's .tasks file and setting the Project ToolsVersion to 4.0, I get:
Task "MSBuild.ExtensionPack.Sql2005.Database"
  Using a Trusted Connection
  Restoring SQL Database: GoodroeSource from D:\temp\MyDatabase.bak
D:\ServerDeployment\ServerDeployment.proj(295,3): error : FailedOperationException: Restore failed for Server 'MYSERV'. \r
D:\ServerDeployment\ServerDeployment.proj(295,3): error : SmoException: System.Data.SqlClient.SqlError: Logical file 'MyDatabase' 
is not part of database 'MyDatabase'. Use RESTORE FILELISTONLY to list the logical file names.\r
D:\ServerDeployment\ServerDeployment.proj(295,3): error : 
Done executing task "MSBuild.ExtensionPack.Sql2005.Database" -- FAILED.

I know that's a SQL error, but like I said, it worked consistently in the earlier release. 
I'd appreciate whatever help you gan give.
Coordinator
Apr 4, 2011 at 9:52 PM

Are you saying that you can execute the same task using the 3.5.2.0 code and it works?

If so, I'm confused. can you send a repro.

Mike