I'm totally new to the Microsoft dev scene so please go easy :)
Currently, I have a solution that contains two projects (ASP.net websites, FWIW). If I create a class in Project1, how do I expose it to Project2? Is it automatically available to Project2 because they are in the same solution? Or do I need to do something special to make the connection?
you need to Add Reference of Class to the project
Like this:
Then Go to Projects Tab (if your project is in Same Soln) .Select the class library need to refer and click ok.
When you expand your Reference you can see the class1.dll like this
Hope this may help you :)
Go to the properties of Project2, and add Project1 as a "Project Reference".
Then your class will be available via Project1.ClassName
You can then use the Imports Project1 statement to shorten the reference, and just reference ClassName
Add a project reference. Go to solution explorer and right click on Project 2's 'References' node.
Select 'Add refrence'. From the 'Projects' tab select Project 1.
That's it. Now you can use classes from Project 1 in Project 2.
You need to add a reference to the project (context menu on the project) and add Imports statements in your class files to use objects from the other project.
Normally you would just create a reference from Project 1 to Project 2, but as they are both ASP.NET websites i don't know if that would be possible (i've never tried that particular combo).
What you can do instead if that fails is share the actual class files between the two projects - in the Solution Explorer right click, Add existing file, then browse to the file containing the wanted class in project 2, and then just before you click Add, click the little down arrow on the button and select Add as link.
Related
According to documentation I could find for VS2012 I should be able to right click a class name in my code and go to definition. It will then open the correct CSS file and bring me to where it is declared.
I am using VS2013 and it has no option for this. I am using a website project and just using .html files.
The design I am working on has several CSS files so this would be a really handy feature for me to have. Has it changed in VS2013? Anyone know why I cant see this option?
Try WebEssentials. It has build in feature for this: http://vswebessentials.com/features/html#definition
I believe this a configuration issue with your copy of VS2013. Try going to a class name and hitting F12. If that takes you to the definition, something is wrong with your context menu.
I'm trying to add an existing project to another project with-in my solution.
When I go to MvcProject.2 and add a new reference to MvcProject.1 and save it, it is added to the References section and the data models load up in the object explorer. Only problem I'm having is that I'm not able to do using MvcProject.1; because there's no namespace found in the project, even the the assembly reference has been loaded. Is there a step I'm missing here? I followed the instructions on here best I could, but no luck: How do you share code between projects/solutions in Visual Studio?
Check that the Target Framework values in the Properties of both projects are the same.
Inside the project in Visual Studio, right click on the MvcProject.1 reference in the References folder and choose View In Object Browser. This will load a list, expand MvcProject.1, the first child will have an icon of curly braces that is the namespace name; whatever value is there is what you can use in your using statement.
I am using PHPStorm to develop a Symfony2 application. Everything works fine, but the 'Framework' tab doesn't show my controllers, resources and bundle contents.
It should be like this:
http://www.kevwebdev.com/img/2012/11/phpstorm-framework-tab.png
I have this:
http://pl.tinypic.com/view.php?pic=2dsls08&s=8#.U7LuDPl_sqE
I have controllers in my project, but PHPStorm doesn't show them.
Any idea what's wrong?
You need to fix your project settings. Go to File->Settings->PHP->Framework Integration and make the necessary changes as shown in the screenshot below. To change a setting for a given directory, just click in the 'Element' column and you'll get a drop down selector with the available options.
Afterwards, everything should be working fine.
I have situation like this: I am doing my own mvc project in visual studio and i found example of simmilar project on the web, in solution explorer i see that it's actaully 4 projects inside 1 as you can see in picture:
So my question is how to add for example Northwind:Model to my own project, as you can see Northwind:model contains Properities, References and classes. Most important to me are classes.
[Edit]my question is about type of project to add, that is confusing me.
Also i will need all 3 Northwind.Model, Repositories and Respositories.Entity.
Thanks for answers!
Simply right click on the Solution (Grid in your case) and select Add > New Project....
This will take you to the standard New Project dialog which you just use as normal. It can be any type of project you like, but in this case you probably want a class library.
If you've got an existing project you want to include then you can do this in a similar way. You don't have to copy the source into the same directory structure but it can help. Make sure it sits under the Grid folder. Then right click on the solution and select Add > Existing Project...*. Browse to the folder containing the project and select the .csproj file.
It sounds like you want to reference projects Northwind.Model, Northwind.Repositories and Northwind.Repositories.Entity so you can use classes in your project jqGrid.
In that case right-click References in your jqGrid project, choose Add Reference... and switch to tab Projects.
Here you should see all available projects in your solution. Select the projects you like to reference and click OK.
I can't seem to find any of my code behind files in the class view tab. I can see other classes that I have added but none of the code behind files. Is there a reason for this? I am missing a setting or something? It is quite irritating trying to navigate my way through the code all the time.
I can see all the other classes just fine just not my code behind files.
Class View is intended to provide a hierarchical view of the "symbols" defined in your project. For website projects, it will only list the referenced assemblies and any classes defined in App_code.
So, no, you aren't missing a setting. You're missing the point of the Class View window ! ;-) Maybe you should be looking in the Solution Explorer instead.
BTW, if you're having trouble navigating through code files, you should consider better organizing your files (in folders, for instance).
Edit (after a Bounty has been placed on this question... drool! ) :
Okay, I have VS 2005 SP1. I tried the following cases:
a. Create New Website (VB or C#):
The Class View window is blank until you add an App_Code folder. When added, the Class View window displays any classes added to the App_Code folder and the default Project references (System, System.Web, etc). It does not however display any Page code-behind classes.
b. Create New Project -> Web -> ASP.NET WebApplication:
The Class View window auto-populates with the Project references and the Page code-behind classes. This happens before I added any folder containing class files.
I am not sure if you are familiar with the ASP.NET Web Application Projects. If not, you need to have the Service Pack for VS 2005 installed. You can get it here. Else, you can also install the Web Application Projects extension directly.
Don't be placing classes other than the class backing the page in code-behind. Place all other code in a separate library project or at the very least in the App_Code folder.
There should be a drop down menu right above the code. The left on is the classes in your open file and the right are members of the selected class.
A great way to navigate code in Visual Studio is with the right-click context menu's Go to Definition and Go to Declaration options.
You could also use Reflector on your assemblies to view the class/member hierarchy in a tree.
VS 2008 improves the class view to what you want ... just saying.
Edit: Nevermind, VS2005 should do what you want as well. You can use the Object Browser as well.