Modify WSSF Wizards

Topics: General Discussion Forum
Feb 28, 2007 at 6:01 PM
Hi everybody...

We detected that some wizards that should create a class in a project (a DataContract for example) and therefore just check out from source control THAT project, they actually try to check out the SOLUTION. This issue is very annoying in out team.

I was wondering how can I modify the wizards provided by the WSSF to remove the line when Checks out the Solution file.

Thanks in advance for any help regarding the modification of the wizards to do that or a workaround for the specific issue.

Mar 1, 2007 at 10:21 AM

The typical place where some recipes write solution file and therefore checking it out into your source control repository is the valueprovider GlobalValueProvider. If you take a look at the GenerateWCFDataContract.xml recipe, the arguemnt DataContractNamespace use this value provider located in Microsoft.Practices.RecipeFramework.Library assembly and will persist the DataContract namespace value into the solution file. One possible solution to this, may be changing this value provider with the ProjectGlobalsEntryProvider located in Extensions library that will persist the value into the selected project file. This change will likely solve your problem but you should carefully consider these changes since depending on your solution structure (project with different responsibilities consolidated into one, ideal scenario) the change may/may not impact the expected behavior.

Mar 1, 2007 at 3:47 PM
Thanks Charly,

we thought it was kind of a wizard bug, 'cause I didn't find anything added to the solution file. We'll see if the approach you suggest fits our needs.

Great Software Factory BTW ;)
Mar 1, 2007 at 4:58 PM
I thought that just changing "GlobalValueProvider" by "ProjectGlobalsEntryProvider" in all the GenerateWCFDataContractXXX.xml files will do th trick... but it rise an error saying "An error happened while calling the value provider or evaluating the default value of argument DataContractNamespace."

I imagined that all I have to do were modifying the XMLs... That is correct?
Thanks again!
Mar 1, 2007 at 4:58 PM
Edited Mar 1, 2007 at 4:59 PM
Duplicated post, sorry.
Mar 1, 2007 at 6:49 PM
OK, so I missed some furhter info about the usage of this provider. As you can see, it has several arguments.
Here is an example:

// Old provider
<Argument Name="DataContractNamespace" Required="true">
      <ValueProvider Type="GlobalValueProvider" Key="DataContractNamespace" />
// New provider
<Argument Name="DataContractNamespace" Required="true">
     <ValueProvider Type="ProjectGlobalsEntryProvider" ProjectArgument="DataContractsProject" PropertyName="DataContractNamespace"/> 
Now the ProjectArgument value points to the argument name that contains a reference to the selected project. The ** points to the key used to store the value of the current argument.
The full types of these providers are:
GlobalValueProvider = Microsoft.Practices.RecipeFramework.Library.ValueProviders.GlobalValueProvider, Microsoft.Practices.RecipeFramework.Library
ProjectGlobalsEntryProvider = Microsoft.Practices.RecipeFramework.Extensions.ValueProviders.VisualStudio.ProjectGlobalsEntryProvider, Microsoft.Practices.RecipeFramework.Extensions

Hope that helps,
Mar 1, 2007 at 7:18 PM
Charly... now just runs smoothly ;)

Now... What am I missing changing this?
I mean... what was formerly written to the solution file... Where is written now?
Just preventing future bugs...

Thanks a lot...
Mar 1, 2007 at 7:43 PM
The values stored at the solution level scope, are used to feed the specified arguments with default values so for example if you add a new project and let's say you set its responsibilities for Data Contract and Service Contract, then the initial values for the namespaces will be read from the solution store. With this change, now you won't have any default value since you are getting them from the project and since it is a new project you will have the store empty. Now there is a workaround for this and you can set a default value using the attribute DefaultPropertyValue and that will be placed in the appropriate page field. After you run the wizard, the value will be stored in your project for future use.