Monday, February 20, 2012

Visual Studio AsyncCTP Install Issues

This is a quick post for anyone attempting to install and use the Visual Studio AsyncCTP library.

1) Here is the link: Visual Studio AsyncCTP from Microsoft
2) It REQUIRES having visual studio SP1 installed.
3) Installation should run fairly smooth, but it does take awhile.  At the end of installation, after you click "Finish" it should open up a web page AND there should be an AsyncCTP folder in your My Documents folder.

4) For those of you that didn't have number 3 work out as stated, read on, for everyone else, have fun :)
5) First you will need to uninstall Visual Studio SP1, and you need to fully uninstall, not just try to repair.
     a)  This process is done through the Add/Remove programs section under Control Panel, just find Service Pack 1 for Visual Studio, and click Uninstall.
     b)  Again, make sure you Uninstall it and NOT try to repair it
     c)  You will need to make sure you either have your Visual Studio iso available to mount to a virtual drive or your visual studio disc in your dvd drive.  It will require this media at some point in the installation and you have to use it.  Cancelling out will simply fail the revert process and you will be stuck where you were in item #3.
6) Once the revert process is complete, reinstall Visual Studio SP1, only.  Do not install any add-ons or windows updates with it, just SP1 clean.
7) Once that is complete, re-install AsyncCTP, everything should work out correctly as detailed in Item #3.
8) There are no shortcuts to this, it is a long and painfully slow process...

Friday, January 27, 2012

Silverlight, WCF, and the clientaccesspolicy...

This is just a quick post because I found it painfully difficult to find the answer to this, without jumping through hoops.

I have 2 solutions in seperate visual studio instances.  One solution is the WCF service that is running.  The other solution is my Silverlight application, which is also running.  When attempting to make a service call, I get a wonderful error about security policies and cross domain issues.  There is a simple fix.

1) Create a notepad file on your desktop.
2) Place this into that file:
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

3) Save the file with this filename:  "clientaccesspolicy.xml" (minus the quotes)
4) Copy the file to your project folder that is running the service.  So for example, in my wcf solution, i Have a project called IISHost that is my startup project to run my services on the dev server while I am developing.  Simply drop the "clientaccesspolicy.xml" into that folder (that folder will contain the web.config for that project also).
5) Run your service project again and you should be good to go...
6) Now to figure out how to do "cross domain" step in debugging from the client project...

Monday, February 28, 2011

Service Factory Error DSL5012 / DSL5017

“Error 1 [ModelBus]: DSL5012: Exception occurred attempting to create an adapter.\nAdapterManager: Microsoft.Practices.ServiceFactory.DataContracts.ModelBusAdapters.DataContractDslAdapterManager\nAssembly: Microsoft.Practices.ServiceFactory.DataContracts.ModelBusAdapters, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\nException: ModelingAdapterReferenceFormatException\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

Manipulating Work Items In TFS with Visual Studio 2010

Introduction

Recently, 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!

Background

Previously, 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 code

1) 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'.
Download Here
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.