FileGroupIsNotSupportedInScriptException
- 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?- Type modifiéBarclay HillMSFT, Modérateurlundi 24 août 2009 22:37No Response
- Type modifiéDuke KamstraMSFT, Modérateurjeudi 19 novembre 2009 17:13Stale thread
- Type modifiéBarclay HillMSFT, Modérateurmardi 20 octobre 2009 20:30Responses
Toutes les réponses
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.The individual files are defined under:-- 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]
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- Proposé comme réponseGert DrapersMSFTlundi 29 juin 2009 16:45
- Non proposé comme réponseCraigfis lundi 29 juin 2009 17:30
- 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.
Can you share the scripts you're using?
Orlanzo- 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
)
- 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... - 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 - 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. - 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? - I'm wondering if the ...ProjectVersion.. tag in each of the dbproj files are the same.
Orlanzo - Yes, both had the same project and schema version:
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>3.5</ProjectVersion> - 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 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- 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. 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/bahillWas there any additional information on this topic? We just upgraded to GDR2 and have been getting a few errors. This is one of them.
- 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- Proposé comme réponseBarclay HillMSFT, Modérateurmardi 20 octobre 2009 20:31
- 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? - 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 - 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.

