Monday, February 28, 2011
“Error 1 [ModelBus]: DSL5012: Exception occurred attempting to create an adapter.\nAdapterManager: Microsoft.Practices.ServiceFactory.
DataContracts.ModelBusAdapters.Data ContractDslAdapterManager\nAssembly : Microsoft.Practices.ServiceFactory. DataContracts.ModelBusAdapters, Version=126.96.36.199, Culture=neutral, PublicKeyToken=31bf3856ad364e35\nEx ception: ModelingAdapterReferenceFormatExcep tion\nException message: DSL5017: The full path representing a Model file is null or empty or invalid. Please specify a valid accessible file location for this Model.”
If you have ever received this error, you know the pain I have once felt. This is use of the ServiceFactory found at CodePlex and had literally no helpful information to get this solved. Now, it is actually a very simple problem to fix and after almost a full lost day of work and, additionally, new changes to TFS (Team Foundation Server), we have a solution.
The core issue is that the “data contracts”, the objects that your service contract is referencing has, in fact, a bad reference. That reference needs to be fixed. I am going to setup a mock example to help walk you through this problem.
1) Locate the service contract file that is giving you the above error. In the image below, you can see my project, title ASAPModel. The servicecontract that is giving me the error is called: SO.servicecontract. Double-click the file and it should open up the graphical diagram.
2) Take notice, in my example above, that I have 2 types of data contracts. One is “Employee.datacontract” and the other is “SO.datacontract”.
3) Once the SO.servicecontract file opens up it should looke like something similar to this:
4) Find a data contract object. For this example, the type “ProjectCode”, which is highlighted in blue in the above example, is of type SO.ProjectCodeDC, which is a data contract object from the SO.datacontract file. When you click on it, in the properties window, on the right, you will see several properties related to this object. Find the “Type” property, click in the field and click the “…” button on the right. That will bring up the box you see below:
5) Notice the big red “X” and the sentence next to it. Ok, so just click the ‘Browse’ button and the “Open Dialog Window” will pop up:
6) Select the corresponding data contract file, so for our example, ProjectCodeDC is from the SO.datacontract file under the ASAPModel project, click on the file and click ‘OK’. Which will bring us back to the first screen with a very good sign, all of our data contracts!
7) From here, open the DataContracts node and find your data contract, which in our case is ProjectCodeDC. Click on it and click ‘OK’, next a window will pop up only if you have multiple references to the datacontract file that were bad, as below:
8) Click ‘Yes’ here and that will reset the references to the data contract file. Repeat this for an object for each DIFFERENT data contract. So in my example here, I would have to find another object, inside the SO.servicecontract graphical diagram that referenced the Employee.datacontract file, and follow the same steps.
9) Once you are all done, reload the projects and then simply right click and generate, from inside the service contract file that was causing the error and VOILA!
10) To be fair, I did not figure this solution out, my boss did, however, I understand the issue and how it is resolved, so that is why I am writing this little article up. Hopefully, nobody will have to deal with this issue again!
Tuesday, February 22, 2011
IntroductionRecently, we needed to migrate our project information from Sharepoint to Team Foundation Studio. This involved bugs, requirements, etc. Generally, we would edit the xml file and import and so on, but required a developer to do the work, which of course would take us away from programming. After some research, I found out how, through the GUI supplied by the TFS PowerTools for Visual Studio, this same task can be accomplished. Now, our project manager and happily (I say that sarcastically) add the user stories/bugs into TFS. This GUI allows you to add controls and inputs to the Work Items screens (suchs as User Stories and Bugs) to help better define the item. Many people familiar with Sharepoint know how easy it is to add a new filter type or input control to help more clearly define the item. I hope this will save anybody the trouble of looking up this information on their own, enjoy!
BackgroundPreviously, the xml file would need to be exported, modified and imported. This generally required a developer to do the work, which of course is tedious, time consuming and should be done by a project manager or quality department.
Using the code1) You need to go to the website below and download the vs2k10 TFS PowerTools. It is an add-on for Visual Studio. Make sure your VS is shut down and click download, and then 'Run'.
2) After the installation is complete (it does take a few minutes), open VS back up. At the top of VS, in the menu bar, you need to expand the menu as such:
Tools>Process Editor>Work Item Types>Open WIT from Server (click on this).
3) A new box will open up, as shown below, expand your project, select the type (for this example I chose User Story) and click 'OK'.
4) the next screen that opens up is essentially the 'guts' of the User Story, allowing you to customize everything on the UI for adding/editing a User Story item. For this example, we are going to add a text box to the classification section to store the name of the source that provided us the user story. We first need to add a 'type' to reference from the User Story UI. First click 'New', a screen will open up. We are only going to change the 'Name', 'Reference Name', and 'Help Text' in this screen.
The 'Name' field is what will be written next to the textbox, 'Reference Name' is how it's defined in the TFS database. A good naming convention would be ProjectTitle.Name. Finally, the 'Help Text' is a description of this item we are adding. Change the values to your liking and click 'OK' to save it.
5) Next we want to click on the 'Layout' tab, and find the 'Group - Classification' section. See the screen shot below:
6) Now right click on the 'Column' node under 'Group - Classification' and select 'New Control' from the context menu. On the right will be a properties window where you just change the 'Label' to whatever you want to be displayed on the actual screen. The 'Type' property lets you choose what type of control it is (i.e. text, date, etc). In the 'FieldName' property click and select the 'Reference Name' that we created in step 4. If you followed the suggest naming convention it will be ProjectTitle.Name.
7) When you're all set, you can click 'PreviewForm' to see if it is exactly what you want.
8) When complete, make sure you save at the top of Visual Studio.