VS2013 MVC Controller dialog loses model classes - c#

Firstly, I'm new to ASP.Net and MVC, so still finding my feet. I seem to have a problem whereby when I close and re-open my project, the list of 'Model Class' shown in the 'Add Controller' dialog comes up blank and no matter what I do I cannot get it to show anything and yes I have tried rebuilding and searching the net for a solution.
I've broken my process down into some real simple steps that reproduce the problem every time...
1) Create new ASP.Net MVC5 project
2) Add a model class
3) Create a db context class within a DAL folder
4) Save and build
5) Right-click to add a controller, the dialog shows the list of model classes in the drop down. Click cancel.
6) Close the project and then re-open the project, you don’t need to close VS.
7) Rebuild the project
8) Right-click to add a controller, the dialog now shows a blank list of model classes in the drop down. Arghh!
I can only assume I'm missing something obvious.
Thanks
Chris

Bingo! Just two steps
1)Update your Visual studio 2013 to new update release.
2) unload your project from solution explorer then Reload it again.

Related

How to View asp.net-mvc Build in Visual Studio 2015

I apologize for the remedial question. I accidentally closed the tab in Visual Studio that allows me to view the actual application (the one that loads by default when you create a new project). How do I bring this back up?
I've tried closing and re-opening the project, going through solution explorer in its entirety, and scanning every information source I can get my hands on. Thank you for your advice (and patience)!
If you want get the interface, that if you run your application it in a browser. On the panel open your browsers and choice Browse With:
in window choice Internal Web Browser and click Browse
If you want view your build anytime in internal browser - Set as Default.
Sorry for my English.

In Visual Studio 2013 when I add an existing form then controls don't appear on designer

I'm working on a windows form application. I start a new project. I delete the Form1 stuff from the new project. I go and add from existing in the solution explorer and choose Form1.cs, Form1.Designer.cs, and Form1.resx from another project. When I look at the designer Form1 just looks blank, like a new one would with none of the controls appearing. The program still compiles fine with all it's controls intact. Did I miss a step somewhere? I've closed and reopened the project etc. This happens every single time repeatedly so I believe I'm missing something but searching here or the rest of the web hasn't provided me a solution. Maybe it's just assumed to be known by everyone already?
I am just learning c# and Visual Studio so hopefully I didn't miss something stupid. I was following direction for how to do this from a book. Some projects are re-used to teach a new idea so they have you start a new project and add in existing items from the original to then work on the new idea.
In VS 2013 I chose "Add existing Item" and just selected the .cs files, don't add *.Designer.cs and *.resx files. Then waited for few minutes and restarted VS2013. Designer.cs and resx files appeared as associated with Forms but they were excluded. I right clicked them and chose "Include In Project". Then it worked fine.
Make sure that you are loading the Form1 that you think you are loading.
By default, Visual Studio 2013 (on Windows 7) will create a folder in Documents (C:\Users*Your user name*\Documents) called "Projects". Whenever you create a new project from within Visual Studio by going to File->New Project, Visual Studio will (by default) create a new folder in the Projects folder with the project name.
I think when you "delete" Form1, you're not actually deleting it, just removing it from the project. When you go to add Form1, you're just selecting it from the same project folder, when you actually wanted to load it from a different project folder.
Try this: In your current project (the one where you deleted Form1 and then added it), in the Solution Explorer, right click on the project, and select "Open Folder in File Explorer".
This will open the project folder on disk. Now, delete Form1.cs from within Visual Studio, and switch back to the project folder. If Form1.cs is still in that project folder, then you just removed it from the project. The actual files still exist on disk. When adding existing items, Visual Studio will typically default to the selected project folder.
I have a very strong suspicion that the Form1 that you are really looking for resides in a different project folder. Without knowing the book or tutorial you are following, I can't give you any hints as to where the Form1 you want is located.

Add MVC Controller Missing

In Visual Studio 2013, I am missing the add MVC Controller - Empty scaffolding item.
When I right click the controllers folder, then Add, and click the controller option at the top of the menu. The Add Scaffold popup window appears with only a list of Web API 2 controllers to add.
http://postimg.org/image/bz5rze56n/ <--- Image here
Just to see if it is only this project, I created a new empty mvc project and followed the same steps and I did have the mvc controllers in there.
Does anyone know how I can get those options back in my main project? I'd rather not just copy and paste my existing controllers. :-P
Thank you for any help you may provide!
I know this is an old topic, but I found if you instead of using the Add->Controller option in the context menu, but instead use Add->New Item option, then choose MVC Controller and name it, then this also creates the same structure as the Empty Controller template.
shut down all running Visual studio's
run VisualStudio command prompt as admin.
type this: devenv /installvstemplates

Importing Windows Forms (C#), Visual Studio 2012

trying to add an existing Windows form into a VS2012 WinForm project, I go "Add/Existing item..." then import: MyForm.cs, MyForm.designer.cs, MyForm.resx
This used to work in earlier versions of VS. (I may have to adjust the namespaces.)
In VS2012 MyForm.designer.cs and MyForm.resx are now not associated with the Form for purposes of the Designer; i.e. they show up as separate file entries in the Solution Explorer, not nested under MyForm. Double-clicking MyForm shows an empty form (no controls) with no error messages. The project compiles and runs OK.
However, when I drag and drop the same files into the project (adjust/rename the namespace), the form files are properly associated with one another and the Designer opens the form fine.
While I now have a solution, can someone highlight what difference is between these approaches, what is the point of having an Add/Existing Item option if it doesn't work, and what is actually going on when dragging the files? Which file (.csproj perhaps?) is responsible for joining the form files? Because it works both ways in earlier versions of VS can I assume this is a bug?
Thanks.
Tried to reproduce your issue - without success.
Assume that you want to import a Form called YourFormName. Then you should only add YourFormName.cs to the project - the rest parts (YourFormName.designer.cs and YourFormName.resx) will be added automatically.
My steps:
Create WinForms project (in my case .Net Framework is 4) in VS2012 (11.0.05727.1 if matters)
Right-click on projects -> Add -> Existing Item...
Search for any WinForm with controls (I added two forms created in VS2010 for .NET framework 4 and 3.5)
With some delay (approx 30-40 seconds), for both cases "Designer" worked as expected and loaded all existed controls/codebehind
Just include the cs file and just wait for about mintue. No other files required to be added.
This will work.
go to project > add existing item
select the form myform.cs file and then click on the add button. This will import the file in your project.
To import a Form only add Form.cs to the project, do not Form.designer.cs and Form.resx, they are created for you and will cause your form to not work.
Right-click on the Project in Solution Explored, then click on Add, then click Existing Item.
Find the form Form.cs to add, add one Form.cs at a time.
Some delay is common for the forms to load, and change the namespaces.

Steps to extract values from "USER INTERFACE" custom window textbox into my code, WHILE CREATING A SET UP PROJECT?

HI, I have created a setUp project for my windows application.
My Solution has 2 Projects(1st is the Windows application and 2nd project is the setUp project that I added)I want to add custom welcome screens during installtion, so I did the following actions.
1) Created a setUp project and added it to solution having a windows application.
2) Added the primary output of the only windows application (within the solution) to the setUp project.
3) Right click on SetUp project -> VIEW -> USER INTERFACES; then added a textboxA.
4) Right click on SetUp project -> CUSTOM ACTIONS; This has 4 options Install, UnInstall,Commit,RollBack.
5) Added a new class to the Windows Application project, inherited "Installer" class to this new class. Overridded "Install" method of this class.
6)Right Click on INSTALL option -> ADD CUSTOM ACTION; and the primary output of the windows application was already added, so I didnt add anything.
HERE THE WINDOWS APPLICATION PROJECT HAS BOTH APPLICATION CODE AND ALSO THE OVERRIDDED Install METHOD.
bUT WHEN i TRY TO INSTALL THIS ITS SHOWING SOME ERROR CODE 2869.
Kindly help me with the procedure to extract values from custom textBox into my overridden Install method.
Frankly speaking I have no idea if it is possible to add anything custom to VS setup project.
I had a similar issue and soon lost my patience and migrated to WiX. It integrates with VS very well (you can add WiX XML schema to have your code coloured and Intelisense enabled). With Wix you can do far more custom things than in VS Setup.
Moreover WiX has a great community, loads of examples and last but not least, you can adjust user interface as the VS Setup projects look REALLY ugly.

Categories