發問發問
 

一般討論FileGroupIsNotSupportedInScriptException

  • Sunday, 28 June, 2009 6:29Craigfis 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     包含代碼
    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?

所有回覆

  • Monday, 29 June, 2009 13:20Orlanzo 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     包含代碼

    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
  • Monday, 29 June, 2009 17:30Craigfis 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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, 29 June, 2009 17:51Orlanzo 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     

    Can you share the scripts you're using?


    Orlanzo
  • Monday, 29 June, 2009 18:22Craigfis 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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, 29 June, 2009 18:34Craigfis 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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, 29 June, 2009 18:59Orlanzo 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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, 29 June, 2009 19:16Craigfis 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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, 29 June, 2009 19:40Craigfis 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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, 29 June, 2009 20:59Orlanzo 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    I'm wondering if the ...ProjectVersion.. tag in each of the dbproj files are the same.
    Orlanzo
  • Monday, 29 June, 2009 22:35Craigfis 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    Yes, both had  the same project and schema version:
        <SchemaVersion>2.0</SchemaVersion>
        <ProjectVersion>3.5</ProjectVersion>
  • Tuesday, 30 June, 2009 12:09Orlanzo 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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, 14 July, 2009 22:51Jill McClenahanMSFT使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     

    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, 4 August, 2009 17:46Barclay HillMSFT, 版主使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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, 24 August, 2009 22:36Barclay HillMSFT, 版主使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
     

    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, 20 October, 2009 17:49bjkj 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     

    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, 20 October, 2009 19:54tomsmiMSFT使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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, 20 October, 2009 20:22bjkj 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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, 21 October, 2009 17:35Christian WhiteheadMSFT使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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, 21 October, 2009 19:51bjkj 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    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.