May 30 2010

Visual Studio Snippets

Category: Desktop and Server | MobileJoel Ivory Johnson @ 03:11

As a developer if you are not using some type of code generation tools then you are not achieving your true potential. In addition to plugins being available such as ReSharper or CodeRush Visual Studio has had the ability to automate some code generation builtin. One of the facility provided is code snippts. A snippet is a code template. You can define your own for patterns that you find yourself implementing over and over.

If you've never used snippets and want to get started then start off by downloading this file. It's a template for making your own snippets.  Then watch this video demonstrating how to use that file to create and use your own snippets.

 

Tags: ,

May 27 2010

Forward Comaptibility Update for Visual Studio 2010

Category: Desktop and ServerJoel Ivory Johnson @ 02:32

Now that Visual Studio has gone RTM you may find yourself needing to use both Visual Studio 2008 for maintaining your existing Windows Mobile projects while using Visual Studio 2010 for other things. You may have also noted that Visual Studio 2008 does work with TFS 2010. To resolve this problem there's a forward compatibility update for Visual Studio 2008. The update weighs in at 11 megabytes and will allow Visual Studio 2008 to work with TFS 2010.

You can download it from here.

Tags:

Apr 12 2010

Visual Studio 2010 Launch Today, WP7 Launch Later

Category: MobileJoel Ivory Johnson @ 07:04

Visual Studio 2010 Launches today. I'm holding off on installing it on my machine with the WP7 tools for now.  I have the CTP of the WP7 tools installed on one machine and the RC of VS2010 installed on another. The two don't play nice together (which kind of makes sense given that they are based on versions of the .Net 4.0 framework  at different stages of development). My expectation is that the VS2010 RTM and the VS2010 Express CTP also won't play nice together. So I'l patiently wait until the RTM release of VS2010 to install VS2010 RTM on the machine I am using for WP7 development.

Thankfully I have more than one machine, so I should be installing it on anothe rmachine later on.

Tags: ,

Mar 2 2010

New MSDN Subscription Level:Essentials

Category: Desktop and ServerJoel Ivory Johnson @ 10:38

Microsoft is making some adjustments to the Visual Studio and MSDN licensing with the release of Visual Studio 2010. For customers that purchase Visual Studio via retail the MSDN Essentials Subscription will be available. MSDN Essentials Subscribers will have access wo Windows 7 Ultimate Edition, Windows Server 2008 R2, SQL Server Datacenter R2, and 20 hours of Windows Azure usage. Presales of Visual Studio will open on 9 March 2010 at the Microsoft store and other select stores.

Found via Somasegar's Weblog

Tags:

Feb 27 2010

Sharing Source Files Among Projects

Category: Desktop and Server | MobileJoel Ivory Johnson @ 06:01

There are times when you will want to share the same source code among several projects. A common way to do so is with a shared assembly; you put common functionality in one project and then share the output among several other projects. But at times this solution isn't suitable such as when you have functionality that you plan to share across more than one .Net runtime (ex: Desktop Framework, Compact Framework, and Silverlight Runtime). For these cases you can copy your source code to the projects for all three run times. But then you end up with three branches of code and may need to make sure thay are synced up with each other.

It is possible to use the same source file in different projects by adding a link for the file from another project so that each project is using the same runtime. Since it is the same physical files changes to the file done from one project are visible to all the projects using the same linked file. Adding a linked file is easy. To link to one file's project from another right-click on the project, select Add->Existing Item and navigate to the file. Once you've found the file click on it and then click on the down triangle on the Add button and select "Add as Link."

A potential problem from using this solution is you may have items in a class that you don't want to be visible in another class. You can selectivly hide sections of code using a few preprocessor directives. As a simple example let's say I made a Windows Form application and I have all of the files from it linked to a second project. I have code in a method that is setting the text on a label. But I want the text to be set differently depending on the project in which it is run. The preprocessor directives I will use are #if, #else, and #endif.

#if App1
            txtMyMessage.Text="Hello from App1";
#else
            txtMyMessage.Text = "Hello from App2";
#endif

In the above code only the C# code in the #else, block will be compiled. The code in the #if block will be ignore. For my first project I want to code in the #if block to be used. To accomplish this I need to add a Conditional Compilation Symbol. I right-click on the project and select Properties. Under the Build tab I can add conditional compilation symbols. I've done this for the first project and have added a symbol named App1. So now the first block of code will get compiled and the second block ignored.

While this solution has it's advantages it is not the end-all solution for sharing functionality across projects. If you find yourself using excessive conditional compilation blocks in your code then you may have reached a point at which it is better off having two seperate source files.

Tags:

Feb 24 2010

Visual Studio 2010 Resources RC Resources

Category: Desktop and Server | MobileJoel Ivory Johnson @ 10:59

@MSDN_Forum posted some good resources on getting started with Visual Studio 2010 Release Candidate.

Tags: