Visual Studio model link not working correctly - visual-studio-2010

First, let me explain what I have done:
I have installed the Visual Studio 2010 Feature Pack both on my local computer and on the TFS host.
The process is documented by Microsoft
I have a VS 2010 modeling solution with a component diagram.
I have created a work item of type Model (custom work item type).
I have created an association from a component in the component diagram, to the Model WI (using Link to Work Item)
The component diagram correctly links to the Model WI
The Model WI correctly contains a model link to the component in the component diagram
Problem: When I click the model link in the Model WI 'All links' tab, I get the following error:
Cannot find the linked model element. The corresponding diagram file or modeling project might have been renamed, moved, or deleted. To fix the link, click the Edit Link button in this work item to re-link the element
I tried to do exactly this, by re-selecting the component using the 'Select model element' dialog. The error is not resolved.
I tried to delete the link and re-create it by creating a new model link. The error is not resolved.
The link looks like this:
ModelLink: modelbus://ComponentDesignerAdapter.1.0/SystemComponentOverview/Architecture::ComponentName/$source control location/filename%comonent-guid
This works perfectly for another modeling project. The error only occurs in this specific modeling project, however it affects more than one component (I do not know if it affects all components in this project)
So my question is this. What could possibly cause this error?
Update: We just realized the error only occurs on my computer. When my colleague attempts to follow the link, the diagram opens correctly. I have tried 'Get latest version' from source control and restarting Visual Studio. Nothing has resolved the issue.
Update 2: I tried creating a new workspace, to no avail. At this point I am concidering re-installing Visual Studio, but I'll hold it off a day or so in case someone knows what might be causing this.

Related

_ViewStart and _Layout.cshtml files are automatically created in ASP.NET MVC 5 (annoying)

I am having a Weird and annoying problem. In my ASP.NET MVC 5 project, time to time, I see that _ViewStart file and Shared/_Layout.cshtml files are created automatically even though I did not want. So, I deleted those files but these files are getting created time to time by itself. That cause a great problem because, sometimes, if I dont notice that these files are created, I can accidentally publish the website and then, after publish, I notice that all pages are being wrapped by the auto created _Layout.cshtml file. Is it a smart helping feature of Visual Studio 2013 ? Cant we stop this ?
Emran!
I am not sure that you still need the answer but today I have also met similar problem. By some unknown reason file "Shared/_Layout.cshtml" was automatically added to my Project.
I was realy wondering why could it happen and I found which actions should be performed to make this file be created.
I have added new View to my Project and have used for it standard VS resources:
Right mouse click on Views folder.
Add -> Veiw...
Inside window for adding view I have checked "Use a layout page" and have left field below empty.
Press Add
My VS was thinking a lot and suddenly created new view and also... "Shared/_Layout.cshtml" and "Shared/_ViewStart.cshtml" files!! I do not think that this option might be switched off because it is logically to create layout page when it has been missed.
Hope this info is helpful for you and for anybody else :)

Intellisense doesn't allow adding multiple css classes in class attribute of an element

I have just installed Visual Studio 2012 RC Ultimate on my Windows 7 x64 bit system.
I have several CSS classes in a CSS file and have referenced it properly. Now see how I am doing
I added a class in my a div element like
<div class="page">
when I put my cursor after page and before ">. And I press Space button, intellisense opens but it contains only item that I have already included, it is page.
I have to write all the other classes names completely by typing.
Please tell me if you are facing the same issue. If not, then someone please tell me how can I fix this.
Added Later
Here, I have reported this BUG in Microsoft Connect.
I have just installed VS 2012 Update 2 and was hoping to get this fixed and It is now fixed. No such issue anymore. Thanks to Microsoft for considering my Bug report.
It's a know issue with VS2012. Microsoft is aware of it and working on a fix (BUG 760316: Intellinsense does not work for adding multiple classes)
You can still add multiple classes, you just have to type them out.
This issue is now fixed with Visual Studio 2012 Update 2
Instead of typing spacebar alone, type Ctrl+Spacebar. it will show you all classes.
when you type only spacebar then it will show you classes starting with page.
Do following.
go to css file. copy .page class and paste immidiately below and rename it as page1.
go back to your repro steps and you will 2 classes in intellisense now. One "page" and another "page1".

Could not find the conceptual model type

I have two Entity Data models within a MVC3 project A and B.
I have recently added the new entity data model B to deal with some new functionality, the issue is that now the existing code has stopped working and I am getting the following error when trying to access code within entity model A.
The error message is:
Could not find the conceptual model type 'project.models.Bclass'
I do not understand why it is this new functionality has affected the current code seeing as entity model A has not change in any way. And functionality B is in a separate class and does not interfere with model A.
When the new code is removed from the project and entity model B is excluded then the code works as it should.
Here is some of the stacktrace from the error:
Exception : Could not find the conceptual model type for 'Project1.Models.CrossSession'.
Application Class - method : System.Data.Metadata.Edm.MetadataWorkspace -- GetEdmSpaceType
User : temp.user
Url : http://localhost/project1/auth/message
Stacktrace : at System.Data.Metadata.Edm.MetadataWorkspace.GetEdmSpaceType(StructuralType objectSpaceType)
at System.Data.Entity.Internal.InternalContext.UpdateEntitySetMappings()
at System.Data.Entity.Internal.InternalContext.TryUpdateEntitySetMappingsForType(Type entityType)
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
Solution found. It appears in some cases (randomly) there is a mix up in the code generated by the entity framework. This is apparently a known bug and a fix should be coming in future releases. In the mean time the way around this is to move the efm to a separate class within the solution.
One possible explanation is that if you use the database first approach and forget to add the Entity classes, you will get this error.
i.e. (from the guide linked below)
Right click on the model’s designer surface.
From the context menu, choose Add Code Generation Item.
In the Add New Item dialog that opens, select Data from the list of installed templates types on the left.
Choose the ADO.NET DbContext Generator then click the Add
button.
I normally use Julie Lerman's guide; https://msdn.microsoft.com/en-us/library/jj206878(v=vs.113).aspx
Solved this by updating EntityFramework to the latest version (6.0)
http://nuget.org/packages/EntityFramework/.
After installing it regenerate the models and it will work ;)
I had the same problem with 2 different .edmx files in the same project.
For the first .edmx model I had used "Add Code Generation Item", for the second model I hadn't. The project was building correctly but throwing that exception on runtime.
I solved generating the .tt classes for the second .edmx model as well.
Well I just installed EF 4.1 and tried to combine DbContext with a EMDX - When I tried to pass back a view I got the same error - that's why I ended up here... I think the way around this is to separate the functionality out into separate asemblies in the solution...
This can also be resolved by generating the new edmx in visual studio 2010 so it matches the older ones... (And copying over the files it generates)
Using Visual Studio 12, the issue has still not been resolved. As an alternative workaround, I set up the second SQL data model using "old fashioned" Data Classes that pre-date entity models - they're still there and they still work. Use Add - New Item - (Data Category) - LINQ To SQL Classes, open the ServerExplorer, locate the server and database, then drag and drop it onto the data classes pane. Old school - but conveniently overcomes this highly inconvenient issue when the full functionality of entity models is not needed.
I removed the edmx models, removed the Entity package, re-install the entity 5.0 and works.
I was working with some legacy software and was not keen on upgrading EF. For me, the below setting on my newly added .edmx needed to be changed to match the .edmx that already existed in the project. My new one said "T4" and I changed it to "Legacy Object Context". I did have to delete the .tt templates that were generated previously in order to get it to build. Otherwise, the old generated files stay there and the new files are also there, causing "property already defined" errors. Thx to all the answers above that helped me figure this out!
(Properties panel, after clicking in the entity designer)

Solution Explorer - custom icons for my folders

Is there any way I can change the icon for my folders? In a large MVC project with a number of areas, it would be nice to see that Controllers, Model and Views have a different icon (or text).
Folder with M or V or C would be nice. I can create those if I know how to substitue them in. Even on a project by project based change.
Here is a screenie showing that some system type folders have different icons.
according to the following post, it is possible, but you will need to create your own project subtype:
http://social.msdn.microsoft.com/Forums/en/vsx/thread/7403bcaf-6389-4a9f-b64b-cd7e297027aa
the microsoft help page for the sample can be found at:
http://msdn.microsoft.com/en-us/library/bb165055(VS.80).aspx
and the sample itself is in the VS 2010 SDK SP1:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=21835
there may be another way to do it with the new managed extensions, however, i did not locate samples for this for VS 2010.

ASP.NET MVC Add View Dialog closing

Recently a large project I work on started having a problem with the Add View dialog. When clicking the Add Strongly-typed View checkbox, the spinner comes up the first time for about a second or two, and then the entire dialog just closes and disappears. If I open the dialog and click the button again, it just closes again quickly.
The project is using ASP.NET MVC 2, I have installed VS2010 SP1 and this problem occurs with or without the MVC3 tools update installed. It only happens with this project, and I have replicated the problem on 2 different development machines. If I create a new MVC2 or MVC3 project, this does not happen at all, nor do any other small to medium sized projects I have.
I can of create a regular view and change it to strongly typed by myself, so there is a workaround, but this is still pretty annoying. Any ideas what could be causing this or how to fix it?
Do you use version control? Make sure all the assemblies that your project depends on (i.e. referenced by the project itself or by its referenced assemblies) are in sync. I've just run into this (both "Add View" and "Add Controller" problems) after updating a bunch of projects from SVN and rebuilding some. The issue was fixed after I rebuilt several libraries that my MVC project depends on.
I had the same problem, and I could not open the Add->Controller dialog either as described here: Add Controller after recent tools update fails with dependency error. In my case, I had added models to my domain, but I had forgotten to add contexts for these new models; things like
public DbSet<Region> Regions { get; set; }
I had no error at compile time, and I was not using these models yes in the solution, so there was no error at run time either. I guess the problem can be anywhere though.

Resources