locked
RC0 of GDR. Compound Project Deployments Fail.

    Question

  • Here's the scenario. I've created, from scratch, on the RC0, a copy of AdventureWorks2008 in a database project. I can deploy this, no issues. I've created a server project to add a login to the server. I can deploy this with no issues. I'm then creating a compound project that will combine the two and ultimately deploy additional objects. I was able to work this just fine in CTP 17, but the RC0 is failing.

    I'm presenting next week at PASS, on this topic. I'd sure like to be able to show a functional demo. Some help here would be appreciated.

    When I run a build or a rebuild for the compound project, everything works. When I run a deploy, the server project deploys without error. Then the AdventureWorks2008 database project deploys witout error. Finally the compound project (I have yet to add any new objects or functions) fails. It fails if I attempt to simple create a deployment script or if I try to create a script and deploy it to a database. I'm accepting all defaults on all settings when I start it off. I'm only adjusting the connection string and the Target database name to match the other project.

    Here's the output from the error. Let me know if I should post or send a copy of the project anywhere (although recreating it shouldn't be difficult):

    ------ Build started: Project: DEV_Server, Configuration: Debug Any CPU ------
      DEV_Server -> C:\PASS\DEV_Server\sql\debug\DEV_Server.dbschema
    ------ Build started: Project: AdventureWorks, Configuration: Debug Any CPU ------
      AdventureWorks -> C:\PASS\AdventureWorks\sql\debug\AdventureWorks.dbschema
    ------ Build started: Project: AdventureWorks_Dev, Configuration: Debug Any CPU ------
        Loading project references...
        Loading project files...
        Building the project model and resolving object interdependencies...
        Validating the project model...
        Writing model to AdventureWorks_Dev.dbschema...
      AdventureWorks_Dev -> C:\PASS\AdventureWorks_Dev\sql\debug\AdventureWorks_Dev.dbschema
    ------ Deploy started: Project: DEV_Server, Configuration: Debug Any CPU ------
        Deployment script generated to:
    C:\PASS\DEV_Server\sql\debug\DEV_Server.sql

    ------ Deploy started: Project: AdventureWorks, Configuration: Debug Any CPU ------
        Deployment script generated to:
    C:\PASS\AdventureWorks\sql\debug\AdventureWorks.sql

    ------ Deploy started: Project: AdventureWorks_Dev, Configuration: Debug Any CPU ------
    C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\TeamData\Microsoft.Data.Schema.SqlTasks.targets(120,5)Error MSB4018: The "SqlDeployTask" task failed unexpectedly.
    Microsoft.Data.Schema.SchemaModel.DataSchemaModelException: Failed to load C:\Documents and Settings\fritcheyg\Local Settings\Temp\tmp2F.tmp. ---> Microsoft.Data.Schema.SchemaModel.ModelSerializationException: The reference to the element that has the name [sys].[hierarchyid] could not be resolved because no element with that name exists.
       at Microsoft.Data.Schema.SchemaModel.ModelXmlSerializer.ReferenceLinker.ResolveInternalElementReferences()
       at Microsoft.Data.Schema.SchemaModel.ModelXmlSerializer.LoadExternals(DataSchemaModel dataSchemaModel, XmlReader reader, String fileName, IExternalReferenceParts externalPartsSubstitution, String logicalSourceName, Boolean suppressErrorsForMissingDependencies)
       at Microsoft.Data.Schema.SchemaModel.DataSchemaModel.OnCustomDataAdded(CustomSchemaData customData)
       --- End of inner exception stack trace ---
       at Microsoft.Data.Schema.SchemaModel.DataSchemaModel.ThrowReferenceLoadingException(Exception innerException, String fileName)
       at Microsoft.Data.Schema.SchemaModel.DataSchemaModel.OnCustomDataAdded(CustomSchemaData customData)
       at Microsoft.Data.Schema.Sql.SchemaModel.SqlServer.SqlSchemaModel.OnCustomDataAdded(CustomSchemaData customData)
       at Microsoft.Data.Schema.SchemaModel.DataSchemaModel.AddCustomData(CustomSchemaData customData, Boolean raiseEvents)
       at Microsoft.Data.Schema.SchemaModel.DataSchemaModel.AddCustomData(CustomSchemaData customData)
       at Microsoft.Data.Schema.Sql.Build.SqlDeployment.ImportServerModel(SqlSchemaModel catalogModel, String connectionString)
       at Microsoft.Data.Schema.Sql.Build.SqlDeployment.SqlValidator.Validate(SqlPlanGenerationOptions options, SqlSchemaModel source, SqlSchemaModel target)
       at Microsoft.Data.Schema.Sql.Build.SqlDeployment.OnVerifyModels()
       at Microsoft.Data.Schema.Build.Deployment.Execute()
       at Microsoft.Data.Schema.Tasks.DBDeployTask.Execute()
       at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)
       Done executing task "SqlDeployTask" -- FAILED.
      Done building target "DspDeploy" in project "AdventureWorks_Dev.dbproj" -- FAILED.
     Done executing task "CallTarget" -- FAILED.
    Done building target "DBDeploy" in project "AdventureWorks_Dev.dbproj" -- FAILED.
    Done building project "AdventureWorks_Dev.dbproj" -- FAILED.

    Build FAILED.
    ========== Build: 3 succeeded or up-to-date, 0 failed, 0 skipped ==========
    ========== Deploy: 2 succeeded, 1 failed, 0 skipped ==========

    Friday, November 14, 2008 1:31 PM

Answers

  • Hi Grant,

    unfortunately following the steps Jeff laid out, I don't have any problems on my RC0 machine.

    I got your solution and was able to get it to work by doing the following:

    1. With the solution closed go to each project's directory and delete the .dbmdl file (ProjectName.dbmdl)
    2. Open the solution
    3. Delete all references and clean the solution
    4. Re-add references and rebuild

    Go ahead and try that out and see if that helps. Sadly, since I didn't see the same problems when following the original steps it seems unlikely that it will.

    Let me know if that helps, I will continue looking into a workaround for you.
    • Marked as answer by StevenPo Tuesday, January 27, 2009 10:45 PM
    Monday, November 17, 2008 10:19 PM

All replies

  • Hi Grant,

    Why do you want to use a single project instead of keeping the database and server project separate? By creating a reference from the database project to the server project, you should be able to reference any server objects from the database project.

    I am interested in seeing how you are creating your compound project so I can try to reproduce your behavior. Can you send me your solution at roroach (at) microsoft (dot) com?
    Friday, November 14, 2008 6:20 PM
  • I did intend for them to be seperate. In fact, I was trying to create three projects. One for the database itself. One for server. The third would be an "environmental" database. This would add in the bits and pieces, usually security, that are different in a development environment from a QA enviroment, from Staging, etc.

    I'll send the solution right away.
    Friday, November 14, 2008 7:02 PM
  •   Grant,

    I've not been able to reproduce this on our last build.  Here's what I did (please correct me if I took steps incorrectly)
    1. Create a 2k8 database project (AW2k8)
    2. Import Adventureworks2008 from a remote server
    3. Set the connection string for the project to another remote server (Mintgiver2k8) and deploy
    4. Add a 2k8 server project to the solution (AW2k8Server)
    5. Add a login to the project
    6. Deploy the project to Mintgiver2k8
    7. Add a 2k8 database project to the solution (ThisOneProject)
    8. Add a database project reference to AW2k8 and another project reference to AW2k8Server
    9. Set the target of ThisOneProject to be the same as AW2k8
    10. Build
    11. Deploy to script

    Following these steps I don't hit an error.  I have a couple of shot-in-the-dark suggestions and follow-up steps that I'll take on my side:

    • Does your third project have a reference to Microsoft.SqlTypes.dbschema?  It should be default.  This reference should resolve [sys].[hierarchyid]
    • If you have the Microsoft.SqlTypes.dbschema ref, try deleting it and re-adding.  This is just a shot-in-the-dark.
    • I tried this on our latest build, not RC0.  I'm getting an RC0 machine set up to try to repro if my steps are correct

    Looks like Roger will be reviewing your project.  Since he's just a couple doors down, I'll see what he finds.



    Thanks


    Jeff
    Friday, November 14, 2008 7:31 PM
    Moderator
  • Yep. Those are the precise steps (laid out better than I did, btw). I'm emailing a copy of the project now.
    Friday, November 14, 2008 7:35 PM
  • I'm trying the reload of Microsoft.SqlTypes.dbschema...

    Nope. Same error. It's only occurring when I build and deploy the compound project. I can build and deploy either of the two projects referenced by the compound project with no issues. I'm not sure if it's helpful or not, but the failure occurs before the .SQL script is created.
    Friday, November 14, 2008 7:43 PM
  • Just so you know, this same layout worked fine in CTP 17. After uninstalling CTP 17 and installing RC0 I recreated the solution and projects, as you outlined. I've deleted the solution and recreated it. I've created a new solution and stored it elsewhere. I'm just hitting this error any time I get the compound project going. Individual projects are working just fine.
    Friday, November 14, 2008 7:47 PM
  •  Hey,

    If it's working on your machine, want to lend it to me between 3pm & 4:15pm on Wednesday? I just need to get through the presentation at PASS. At this point, I'm planning on doing everything but the demo of the compound deployment.
    Friday, November 14, 2008 7:50 PM
  • OK, we'll get that RC0 machine set up and try to repro the issue.  Worst case is that it has to do with an unclean uninstall of CTP17, but that's pure speculation at this point.
    Jeff
    Friday, November 14, 2008 7:50 PM
    Moderator
  • Hi Grant,

    unfortunately following the steps Jeff laid out, I don't have any problems on my RC0 machine.

    I got your solution and was able to get it to work by doing the following:

    1. With the solution closed go to each project's directory and delete the .dbmdl file (ProjectName.dbmdl)
    2. Open the solution
    3. Delete all references and clean the solution
    4. Re-add references and rebuild

    Go ahead and try that out and see if that helps. Sadly, since I didn't see the same problems when following the original steps it seems unlikely that it will.

    Let me know if that helps, I will continue looking into a workaround for you.
    • Marked as answer by StevenPo Tuesday, January 27, 2009 10:45 PM
    Monday, November 17, 2008 10:19 PM
  • Hello,

    Thanks for all the help. It still failed. I'll just skip the part of the presentation where I deploy the database. I'll still be able to cover everything appropriately. Thanks again for trying.

    Grant
    Tuesday, November 18, 2008 4:45 PM
  • I also have such a problem. Here's the output from the error.

    [Pid=4316;Tid=1;Time=09:06:49]: Error: 16384: Exception in DatabaseProjectNode.RecreateModel: DataSchemaModel is null indicating a file lock problem
        CallStack=   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
       at System.Environment.get_StackTrace()
       at System.Diagnostics.TraceEventCache.get_Callstack()
       at Microsoft.Data.Schema.Common.Diagnostics.TSDTraceListenerDecorator.TraceEvent(TraceEventCache eventCache, String source, TraceEventType severity, Int32 id, String message)
       at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String message)
       at Microsoft.VisualStudio.Data.Schema.Project.Project.DatabaseProjectNode.RecreateModel(Boolean dataSchemaModelWasRecycled)
       at Microsoft.VisualStudio.Data.Schema.Project.Project.DatabaseProjectNode.Reload()
       at Microsoft.VisualStudio.Data.Schema.Project.Project.MPF.ProjectNode.Load(String filename, String location, String name, UInt32 flags, Guid& iidProject, Int32& canceled)
       at Microsoft.VisualStudio.Data.Schema.Project.Project.DatabaseProjectNode.Load(String filename, String location, String name, UInt32 flags, Guid& iidProject, Int32& canceled)
       at Microsoft.VisualStudio.Data.Schema.Project.Project.MPF.ProjectNode.InitializeForOuter(String filename, String location, String name, UInt32 flags, Guid& iid, IntPtr& projectPointer, Int32& canceled)
       at Microsoft.VisualStudio.Shell.Interop.IVsCreateAggregateProject.CreateAggregateProject(String pszProjectTypeGuids, String pszFilename, String pszLocation, String pszName, UInt32 grfCreateFlags, Guid& iidProject, IntPtr& ppvProject)
       at Microsoft.VisualStudio.Data.Schema.Project.Project.MPF.ProjectFactory.CreateProject(String fileName, String location, String name, UInt32 flags, Guid& projectGuid, IntPtr& project, Int32& canceled)
       at Microsoft.VisualStudio.Shell.Flavor.FlavoredProjectFactoryBase.Microsoft.VisualStudio.Shell.Interop.IVsProjectFactory.CreateProject(String fileName, String location, String name, UInt32 flags, Guid& projectGuid, IntPtr& project, Int32& canceled)
    [Pid=4316;Tid=1;Time=09:07:58]: Error: 16384: Exception in DatabaseProjectNode.RecreateModel: DataSchemaModel is null indicating a file lock problem
        CallStack=   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
       at System.Environment.get_StackTrace()
       at System.Diagnostics.TraceEventCache.get_Callstack()
       at Microsoft.Data.Schema.Common.Diagnostics.TSDTraceListenerDecorator.TraceEvent(TraceEventCache eventCache, String source, TraceEventType severity, Int32 id, String message)
       at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String message)
       at Microsoft.VisualStudio.Data.Schema.Project.Project.DatabaseProjectNode.RecreateModel(Boolean dataSchemaModelWasRecycled)
       at Microsoft.VisualStudio.Data.Schema.Project.Project.DatabaseProjectNode.Reload()
       at Microsoft.VisualStudio.Data.Schema.Project.Project.MPF.ProjectNode.Load(String filename, String location, String name, UInt32 flags, Guid& iidProject, Int32& canceled)
       at Microsoft.VisualStudio.Data.Schema.Project.Project.DatabaseProjectNode.Load(String filename, String location, String name, UInt32 flags, Guid& iidProject, Int32& canceled)
       at Microsoft.VisualStudio.Data.Schema.Project.Project.MPF.ProjectNode.InitializeForOuter(String filename, String location, String name, UInt32 flags, Guid& iid, IntPtr& projectPointer, Int32& canceled)
       at Microsoft.VisualStudio.Shell.Interop.IVsCreateAggregateProject.CreateAggregateProject(String pszProjectTypeGuids, String pszFilename, String pszLocation, String pszName, UInt32 grfCreateFlags, Guid& iidProject, IntPtr& ppvProject)
       at Microsoft.VisualStudio.Data.Schema.Project.Project.MPF.ProjectFactory.CreateProject(String fileName, String location, String name, UInt32 flags, Guid& projectGuid, IntPtr& project, Int32& canceled)
       at Microsoft.VisualStudio.Shell.Flavor.FlavoredProjectFactoryBase.Microsoft.VisualStudio.Shell.Interop.IVsProjectFactory.CreateProject(String fileName, String location, String name, UInt32 flags, Guid& projectGuid, IntPtr& project, Int32& canceled)
    Sunday, November 8, 2009 7:14 AM
  • Hi,

    The precise problem I was running into was solved over a year ago shortly after the full release came out. The main problem I found was that after putting together a compound project I needed to do a build to script prior to attempting to deploy to a database. If I do that after adding multiple projects together, I always get a successful build. If I attempt to deploy straight away, I will end up with an error. I'd suggest attempting that as a starting point.

    The error you're seeing is different. You might want to post this as a seperate thread, rather than a comment on this thread. You'll get more people to see it that way.
    Sunday, November 8, 2009 12:27 PM