Creating a project in Layered Architecture in Visual Studio - visual-studio

I am a developer who has developed applications in Java from the beginning. But now I have to switch into C#. Even though those two languages are quite similar, I find it difficult to get used with the IDE; which is the Visual Studio.
I have used Eclipse and NetBeans for the projects I have done using Java. Coming from them, I find the Visual Studio environment different in big manner.
I am trying to develop a simple application which has 3 separate layers of coding like Model-View-Controller. In fact I am developing a WPF application. In that, I need my view code to be in a one layer, data models and all the database related stuff in another separate layer and the code in between the View and the model in a separate layer.
In java, When we use Eclipse or NetBeans, what we do is we create 3 separate packages for those 3 layers. But I cannot figure out how to create different packages in Visual Studio. As I see, in C#, namespaces are used instead of packages. Isn't it? But I don't know how to create different namespaces and different classes in those namespaces. (Just like we create a new class inside the packages created in Eclipse)
I am bit confused here in this case. How can I create different packages (or namespaces) in Visual Studio & how to create the project structure as I need ?
Thank You..!

Related

Nesting Projects

I see that MS has documentation on how to implement nesting projects when implementing new project types. While this looks do-able, I'd rather not write and maintain my own VS extension if I can avoid doing so. Is there any "generic" project type already implemented by some extension that will allow project nesting? The idea would be that the parent project does nothing but include its children and allow building, adding references, etc.
Managed Package Framework for Projects is for Visual Studio 2013 and includes "a project system that supports nesting" (see the NestedProject sample). I have not tried it myself, though I did look through it a while back (the VS 2010 version) and it has thorough documentation.
It may or may not be as extensive as what you are looking for. From the overview in the documentation:
Creating a new project type in Visual Studio is complex task. Using MPF_Proj is a good starting point for creating custom project types in Visual Studio written in managed code but there are limitations that would have to be considered before using the framework.
MPF_Proj is not a .NET library. It is rather a framework of source files (classes, utilities etc.) that can be included in a VSPackage project.

Visual Studio quickstart for *nix / OS X / Xcode developers

I've been writing C/C++ for years using Xcode and am very comfortable with *nix systems. Now I'm working with people who only understand Windows; I've decided to try to learn that environment too.
I was thinking that google would be my best friend, but even the terminology for VS is sufficiently orthogonal to that of Xcode that I can't make any headway. (E.g., what's the equivalent of "Add new Target to project" for VS?)
Can anyone point me to a guide to VS for Xcode practitioners? I've seen lots of translators going the other direction.
Thanks!
I do not know of any XCode to VS Guide, but according to XCode Documentation:
A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace.
The analogous concept in Visual Studio would be a project. In Visual Studio, a project contains code files, assets and settings which compile into an output of some sort. (Could be an executable, a DLL, a website, or a few other options...) Projects can reference other projects or other external libraries (System or user libraries) which are all delivered together at compile time.
A solution contains multiple projects which can be related (referenced) and compiled and linked together.
When you first start VS, it will ask you to Open or Create a project. It usually will automatically create a solution and automatically add the project to it. To add additional projects, you can right click the solution in the "Solution Explorer" and add another project.
Hope this helps
I believe what you're looking for is the Build Configuration Manager in Visual Studio. (It's been a while since I've used XCode). As I recall a "Target" in Xcode is how you want the project built. In VS you get a Debug and Release configuration by default but you can use the Build menu and choose "Configuration..." to create more.
I don't know of a tutorial for XCode users but Kate Gregory has some nice beginner screencasts on pluralsight for using Visual Studio 2010. Those may get you over some learning curve hurdles. I think they have a 30 day free trial. If you move on to .NET development they have a lot more that can really help you get up to speed quickly.
Quick Terminology
In Visual Studio you typically create a Solution. A solution can consist of any number of Projects. You can add projects for .DLLs (libraries), services, applications (gui and console based). You can have multiple applications but can only designate one as the Startup Project.
In my typical project I start with the GUI and Add a project of the type I want. Then I often add a library project for new code that I think I can use across multiple applications. Existing code in both supplied libraries and ones you've built are added as References. You can right-click on References in the Solution Explorer and select Add References.
In XCode (when I used it) your IDE consisted of two pieces, XCode and Interface Builder. In Visual Studio you can build interface elements directly in Visual Studio ( but there is also a tool called Blend that allows for UI creation and modification). There are THREE major types of interfaces web (usually an ASP.NET application), WinForms and WPF. I think of WinForms as the equivalent of what you build in IB. WPF is the most recent addition and has lots of advantages but a somewhat steep learning curve.
This is probably oversimplified because VS does so much and I'm mostly familiar with the C# and C++/CLI capabilties. However it also supports Visual F#, Iron Python, Iron Ruby, Visual Basic, Sharepoint, Office Integration,Silverlight, XNA, etc.
Visual Studio is very extensible. There are lots of extensions to make it integrate with other tools. There are also a couple of extremely useful extensions that make refactoring and writing code easier, my personal favorite is ReSharper from JetBrains.

Creating custom designer over XML file as VSIX 2010 package

We have a set of VS 2008 packages which leverages custom Project/Item templates, designers around XML files for our in house product development using VS. We are planning to move to VS 2010 and looking for migrating our VS 2008 packages to 2010. I see that there has been a rewrite of VS from ground up using WPF/MEF, but still could not figure out how we can leverage it for our packages. I am seeing some guidelines, samples and community material on how we should be extending the VS 2010 WPF based text editor, but could not find any reference implementations on how one should implement a custom designer on top of XML using the WPF/MEF APIs of VS SDK.
Only sample I have come across regards to any custom designer implementation so far was Example.XmlWpfDesigner - http://code.msdn.microsoft.com/Designer-View-Over-XML-20a81f17 which does not talk anything about WPF/MEF way of doing custom designers.
Has anybody come across any reference implementations along these lines? Any help regarding this would be much appreciated.
Thanks,
Siva
The sample you linked to is the right one to be looking at for a designer over an XML file. It is a WPF-design surface that edits VSTemplate XML files.
The only part of the VS API's that moved to MEF in VS 2010 was the core text editor. While you are welcome to use MEF for the implementation details of your designer, you'll still need to talk to the VS COM API's to do things like buffer management, interfacing with Source Control interfaces, etc...

Definitions of XCode project templates, and approaches to Cocoa development

My background is c#, .net, and Visual Studio.
I've been trying to get to grips with Cocoa development, but am finding it hard to find information about certain things, maybe because I'm coming in from a Visual Studio perspective.
A few questions:
What's the difference between a "Framework" project, and a "Library" project in XCode?
What are the consequences of choosing "dynamic" or "static" for your project when starting a new XCode project. Can this be changed later on? does it affect the contents of the project?
Does XCode have the concept of a "solution" with various projects like Visual Studio? If so, how do you reference projects with each other which are in the same solution in XCode?
Is it even right to approach a Cocoa project in the same way as a .net one. For example, if I was going to build a simple image manipulation app, I'd start with the core library, which could be referenced in a winforms, silverlight, or an MVC frontend app. How does that organisation work in XCode?
A Framework project builds a Framework, and a Library projects builds a Library. A Framework (.framework) is the means by which a library and its associated header files are bundled together in one package (similar to the way an executable and its sundry files are bundled together into a .app package). If you're building a library which you intend to use in multiple Cocoa projects, or distribute to other developers for that purpose, a Framework is probably the most convenient way to do so.
A static library (.a) is analogous to a .lib file in Windows. It's compiled code which you can link into your executable. A dynamic library (.dylib) is analogous to a .dll in Windows. It's compiled code which can be dynamically loaded by your executable. You can change the output from one to the other after you create it (see the Mach-O Type field under Linking in the Build tab of Project Info. However, there are probably other settings which would vary between the two. My advice would be to decide which you want to make, make the project for that, and don't change it.
Yes, you can build multiple things from an Xcode Project. An Xcode project is exactly analogous to a Visual Studio Solution. What Visual Studio calls Projects, Xcode calls Targets. So an Xcode project can have multiple targets. Say, one for a Framework, one for an application that uses that framework, one for a suite of unit tests, etc. Make yourself an Xcode project, and right click Targets->Add->New Target, and you can play around with it. Each Target has its own build settings, files, etc.
My background is more the MFC/C++ side of the Visual Studio house than the .NET/C# one, but to my knowledge, what you describe is possible, even desirable, in Xcode, sure. My projects have thus far never been large enough, nor the code amongst them common enough, to bother having a separate library for core functionality, but there's no reason you couldn't do that.

Designing a Visual Studio 2010 Integration Package

I'd like to get started with the Visual Studio 2010 SDK and creating integration packages. All I would like to do for now is provide a new project type and language service. However, I don't know how I should design it...
The package will provide an editor for a programming language that compiles for x86 or ARM processors. The problem is that there are a few language differences depending on which processor you're developing for. I'd rather not have a separate project type for each architecture, however. Preferably, the programmer chooses the architecture when they create the project and the package automatically loads up the specific parts such as the correct language service, configuration settings, and whatever custom tools and dialogs are associated with that architecture.
How would I go about doing this? I've read about "flavored projects", but I don't really understand how to implement them. Is that what I need?
A couple of points to note to get you headed in the right direction:
The interfaces for a language service to hook into the editor have completely changed for VS 2010. I would recommended asking questions on the VS Editor Forum where all the devs for the core VS editor hang out for the speediest answers since the documentation and samples are still incomplete at this point. (There is a compatibility layer to support "old" language services, but you'd be better off just using the new interfaces since you're starting from scratch.)
A "flavored project" (referred to in the docs as a Project Subtype) is a way to add/remove functionality from an existing project system. For example, there is are project flavors for Web Projects, WPF, Devices, Database, etc.... on top of CSProj and VBProj. In these cases C# and VB are the "base" project systems and WPF, Web, Database are flavors that extend the base C#/VB project systems. Since you have a custom language, you should implement your own base project system. Your best bet for starting from scratch would be to build something based off the MPFProj source library.
I'm working on something very similar -- here is my starting point:
http://blogs.msdn.com/noahric/archive/2010/02/15/markdown-part-4-outlining.aspx
It's a very nice example of how to implement an editor extension.

Resources