Layer diagram cannot validate Universal shared project's files

Category: visual studio visualiaztion

Question

Shiro_Yacha on Thu, 31 Jul 2014 13:48:05


Hello,

I am using a layer diagram to verify the dependencies of the classes of an universal application. I am currently using the MVVMLight toolkit, and the viewmodel files are in the shared project. However, it seems that the files in the shared project cannot be validated by the layer diagram. Is it due to the fact that shared codes will be compiled into different platforms?  

This is a bit annoying as it prevents me from validating the MVVM structure. 

Best regards,

ShiroYacha

Replies

Sulabh Upadhyay on Sat, 09 Aug 2014 19:29:28


Hi ShiroYacha,

Layer validation is  supported for Universal applications as well.

In order to understand what is the exact root cause of the issue that you are facing can you please let us know following?

1. Which version of Visual Studio are you using (Visual Studio 2013). Is it  CTP /RC/RTM version of Visual Studio Update 3 ( Ultimate) .

You can get this information in Help -> About Microsoft Visual Studio.

2. Do we have other older version of Visual studio installed on the machine ? If Yes which version(s).

3. Can you please share any error message that you are getting during validation?

4. Can you please confirm if below is the exact scenario that you are trying to validate in the Layer diagram ?

   Classes from (windows )     -> Dependent on ( some class in Shared project)

   Class from ( Windows store) ->  Dependent on (some class in Shared Project)

If above is not the exact scenario, it would be great if you can share the exact scenario.

I hope you are picking the exact classes from universal app for validation instead of whole projects, as there are bidirectional dependencies between shared projects  and (windows and windows phone projects)

Shared project <-> Windows project

Shared project <-> Windows Phone project

Please note that there are few classes in shared project which are resulting in bi-directional dependencies.

Thanks,

Sulabh

Sulabh Upadhyay on Wed, 20 Aug 2014 06:57:54


Hi ShiroYacha,

  Can you please answer above queries? It will help us in understanding the root cause of the issue that you are facing

Thanks,

Sulabh Upadhyay

Shiro_Yacha on Wed, 20 Aug 2014 08:23:34


Hi Sulabh,

Sorry for the late response. it is the VS2013 Ult Update 2 that I am using. There is no other copies of VS on my machine (apart from a VS2013 on a VM but I don't think that counts?). The scenario is the one you've mentioned. I've tried to just move separate C# files from the shared project to the layer but only the project file is displayed in the layer explorer. Such as: 

Name MPDS.PomodoroSystem.Shared

Categories

Project, File

Layer

.UI

Supports Validation

False

Identifier (Assembly=file:///...csproj

Thanks,

ShiroYacha





Sulabh Upadhyay on Wed, 03 Sep 2014 11:56:45


Thanks! ShiroYacha for the reply.

With the scenario that you have mentioned, we are able to repro the issue at our end. I have forwarded the issue to the concerned team in Microsoft.

Thanks,

Sulabh Upadhyay

Shiro_Yacha on Wed, 03 Sep 2014 12:15:23


Thanks a lot, 

I am looking forward to it. 

Best regards,

ShiroYacha


Sulabh Upadhyay on Wed, 03 Sep 2014 14:17:52


As a work around :

Instead of dragging and dropping the files from shared projects you can try drag and drop of classes present inside those files from solution Explorer to the layer diagram.

Note: When you add classes from shared project they will be associated to one of the project type (either Windows project or windows phone project). You can get this information in the layer explorer.

If you want to get the class corresponding to other project type instead of default one do the following step:

1. Change the Project Context in the Code Editor ( 1st drop-down in code editor :- Project Type) to the desired project type.

2. Now do drag and drop of class from shared project in solution explorer to layer diagram. The nodes for the classes will be added to the layer diagram in context of the selected project context

Project-Windows      

|                            

Shared Project classes e.g. Shared Class A(in Windows context)

Project-WindowsPhone

|

Shared Project classes e.g. Shared Class A(in WindowsPhone context)

Thanks,

Sulabh

Shiro_Yacha on Wed, 03 Sep 2014 15:04:48


It works! It isn't that complicate as I thought in the beginning since the project context remains global. I could ctrl-select all the classes in an environment (WP) and vice-versa(W). Still it will be nice if VS team fix it in VS14.    

Thanks a lot. 

ShiroYacha