Ask a questionAsk a question
 

General DiscussionFileGroupIsNotSupportedInScriptException

  • Sunday, June 28, 2009 6:29 AMCraigfis Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    I've just added File group definitions to my VSDB (2008) project and build is now failing with the following exception:
    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v9.0\TeamData\Microsoft.VisualStudio.TeamSystem.Data.Tasks.targets(105,5)Error MSB4018: The "SqlBuildTask" task failed unexpectedly.
    Microsoft.VisualStudio.TeamSystem.Data.Schema.FileGroupIsNotSupportedInScriptException: Exception of type 'Microsoft.VisualStudio.TeamSystem.Data.Schema.FileGroupIsNotSupportedInScriptException' was thrown.
       at Microsoft.VisualStudio.TeamSystem.Data.Schema.SchemaManager.LoadSchemaObject(String sqlScript, SchemaType expectedType, SchemaManagerCommandContext commandContext)
       at Microsoft.VisualStudio.TeamSystem.Data.Schema.SchemaManager.LoadSchemaObjectFromFile(String path, SchemaType expectedType, SchemaManagerCommandContext commandContext)
       at Microsoft.VisualStudio.TeamSystem.Data.Schema.BuildSchemaObjects.LoadSchemaObjectFromFile(SchemaManager sm, ErrorManager em, String fileName, ConnectionSettings settings)
       at Microsoft.VisualStudio.TeamSystem.Data.Schema.BuildSchemaObjects.BuildSchemaManager(Boolean quotedIdentifier, ConnectionSettings defaultSettings, String suppressedWarnings, BuildConfig config)
       at Microsoft.VisualStudio.TeamSystem.Data.Schema.SqlBuildTaskHelper.Initialize()
       at Microsoft.VisualStudio.TeamSystem.Data.Tasks.SqlBuildTask.Execute()
       at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)
     Done executing task "SqlBuildTask" -- FAILED.

    Any idea why or what the fix for this might be?

All Replies

  • Monday, June 29, 2009 1:20 PMOrlanzo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code

    I do recall receiving an error when the filegroups were defined within a server project.  I'm unsure if it's what you're receving now, although it may have been.  Are you creating the filegroup in a server or database project? 

    I'm using Filegroups in my solution without error.  They are defined in a database project under:

    Schema Objects >> Database Level Objects >> Storage >> Filegroups


    The script is very basic.

    -- Do not change the database name.
    -- It will be properly coded for build and deployment
    -- This is using sqlcmd variable substitution
    ALTER DATABASE [$(DatabaseName)]
        ADD FILEGROUP [Guideline_Extract_2009_01]
    
    The individual files are defined under:

    Schema Objects >> Database Level Objects >> Storage >> Files


    The script for these appear as:

    -- Do not change the database name.
    -- It will be properly coded for build and deployment
    -- This is using sqlcmd variable substitution
    ALTER DATABASE [$(DatabaseName)]
    	ADD FILE 
    	(
        	NAME = N'Guideline_Extract_2009_01', 
        	FILENAME = '$(DefaultDataPath)$(DatabaseName)_Guideline_Extract_2009_01.ndf', 
        	SIZE = 100000 KB, 
        	MAXSIZE = UNLIMITED, 
        	FILEGROWTH = 100000 KB
        ) TO FILEGROUP Guideline_Extract_2009_01 
    

    Orlanzo
    • Proposed As Answer byGert DrapersMSFTMonday, June 29, 2009 4:45 PM
    • Unproposed As Answer byCraigfis Monday, June 29, 2009 5:30 PM
    •  
  • Monday, June 29, 2009 5:30 PMCraigfis Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Yes, this is in a database project and my scripts are basically the same as above.
    Interestingly, if I try to build the project using VS2010 beta, it builds fine. That isn't an acceptable solution for me though - I need to get this working on VSDB 2008.

  • Monday, June 29, 2009 5:51 PMOrlanzo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Can you share the scripts you're using?


    Orlanzo
  • Monday, June 29, 2009 6:22 PMCraigfis Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    If I simply add a default filegroup script to the Filegroups folder without editing it I get the error.

    -- Do not change the database name.
    -- It will be properly coded for build and deployment
    -- This is using sqlcmd variable substitution
    ALTER DATABASE [$(DatabaseName)]
     ADD FILE
     (
         NAME = [SqlFile1],
         FILENAME = '$(DefaultDataPath)$(DatabaseName)_SqlFile1.ndf',
         SIZE = 3072 KB,
         MAXSIZE = UNLIMITED,
         FILEGROWTH = 1024 KB
        )
     
  • Monday, June 29, 2009 6:34 PMCraigfis Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I tried creating a new database project and adding a filegroup to it. That builds OK.
    I don't really want to have to recreate my database project if I can avoid it...
  • Monday, June 29, 2009 6:59 PMOrlanzo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I just did the same and it built without error.  Did you happen to change any of the database properties through the Prjoect Settings page?  These are defined in the Catalog properties file.  Is this a 2005 or 2008 database project?

    Also what version of Visual Studio are you using?  I'm at version 9.1.40413.00 of Microsoft Visual Studio Team System 2008 Database Edition GDR.
    Orlanzo
  • Monday, June 29, 2009 7:16 PMCraigfis Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Same VS version - VSDB GDR (9.1.40413.00)
    Targetting SQL 2005.
    I copied the settings file from my real project to the new dummy project and that still builds OK.
  • Monday, June 29, 2009 7:40 PMCraigfis Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    By comparing the newly created project file with my failing project file I've found the cause of the problem.
    The targets file that is being referenced by the new project is different than that referenced by the existing project (which was created prior to GDR - I omitted that tidbit earlier).

    New GDR projects use this:
      <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\TeamData\Microsoft.Data.Schema.SqlTasks.targets" />

    My failing project was using this:
      <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\TeamData\Microsoft.VisualStudio.TeamSystem.Data.Tasks.targets" />

    I guess there's a bug here in that GDR should convert the project to the newer target file?
  • Monday, June 29, 2009 8:59 PMOrlanzo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I'm wondering if the ...ProjectVersion.. tag in each of the dbproj files are the same.
    Orlanzo
  • Monday, June 29, 2009 10:35 PMCraigfis Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Yes, both had  the same project and schema version:
        <SchemaVersion>2.0</SchemaVersion>
        <ProjectVersion>3.5</ProjectVersion>
  • Tuesday, June 30, 2009 12:09 PMOrlanzo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    That is pretty interesting.  The project and schema versions are the same in my files as well.  In the same file, I see a PreviousProjectVersion tag that I presume is an indication of a converted project.  One of the moderators may be able to explain why this occurred or answer to whether this is a bug.
    Orlanzo
  • Tuesday, July 14, 2009 10:51 PMJill McClenahanMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    What was your starting project (VS 2005 or VS 2008 Orcas)?  And did you convert directly to GDR R2 or did you upgrade to GDR and then R2?  We will investigate to see if we can repro this bug.

    Thanks,
    Jill

  • Tuesday, August 04, 2009 5:46 PMBarclay HillMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Craig,

    I cant repro this from an upgrade of a 2008 Visual Studio Team System Database Edition SP1 Project to a GDR R2 Project.  Were you using the earlier power tools with the pre GDR project?

    Can you send my your old project so I can get a repro on this issue?

    http://blogs.msdn.com/bahill/contact.aspx

    Thanks,
    Barclay Hill Program Manager VSTS: DB Team (DataDude, DBPro, Database Edition) Please mark the responses as answer if it resolves your question.
  • Monday, August 24, 2009 10:36 PMBarclay HillMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
     

    Hi Craig,

     

    This thread has been changed to a “General Discussion” since you have not followed up with the necessary information. If you have the time to revisit the issue and provide additional information, please feel free to respond and change the issue type back to “Question”.

     

    If the issue is resolved, we would appreciate it if you can share your solution or information with other forum members who may have similar questions or issues.

     

    Thanks.


    Barclay Hill Program Manager VSTS: DB Team (DataDude, DBPro, Database Edition) Please mark the responses as answer if it resolves your question. http://blogs.msdn.com/bahill
  • Tuesday, October 20, 2009 5:49 PMbjkj Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Was there any additional information on this topic?  We just upgraded to GDR2 and have been getting a few errors.  This is one of them.

  • Tuesday, October 20, 2009 7:54 PMtomsmiMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi bjkj,

    You are getting the NotSupportedInScript exception in GDR R2?  If so, can you check your project file to see if this is in there:
      <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\TeamData\Microsoft.VisualStudio.TeamSystem.Data.Tasks.targets" />

    If so, that line should be changed to this:
      <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\TeamData\Microsoft.Data.Schema.SqlTasks.targets" />

    Easiest way to check this is to open the .dbproj file in Notepad. 

    Thanks,
    -Tom

    Tom Smith, SDET - Microsoft Visual Studio Team Edition for Database Professionals
  • Tuesday, October 20, 2009 8:22 PMbjkj Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Ok, so it looks like I caused this issue by trying to solve another.  I changed the line you mentioned above because I was getting an error stating the "SqlBuild" target was missing.  I noticed the Microsoft.Data.Schema.SqlTasks.targets file does not have the "SqlBuild" target so I switched it to the Microsoft.VisualStudio.TeamSystem.Data.Tasks.targets file. 

    I have switched the Import back and am back to the original error: "The target "SqlBuild" does not exist in the project".

    Do I need to specify both import files?
  • Wednesday, October 21, 2009 5:35 PMChristian WhiteheadMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    The only import that you need is:

      <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\TeamData\Microsoft.Data.Schema.SqlTasks.targets" />

    Before you upgraded did you have any PowerTools installed?

    Also, would it be possible for me to get a copy of your project?


    This posting is provided "AS IS" with no warranties, and confers no rights
  • Wednesday, October 21, 2009 7:51 PMbjkj Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for your help.

    Yes I had the Power Tools installed.  I currently have the 2008 Database Edition - Power Tools installed ver 9.0.1.  FYI, I opened a new thread dedicated to this topic thinking this thread might be stale and not easily identified by the initial question.