Viewing entries tagged
Visual Studio

1 Comment

Must-Have Visual Studio Extensions

I'm just setting up a new dev box now and there are always some things, like extensions and tools, I feel they are a must-have for Visual Studio 2010 devs. Some of these extensions like the Web Essentials have already made it to Visual Studio 11 (still in Beta), but I still wanted to share my preferences for my must have VS extensions:
  1. ReSharper
  2. NuGet Package Manager
  3. Productivity Power Tools
  4. Web Essentials
  5. Image Optimizer
  6. Javascript Parser

There is a cool Channel 9 vid where Mads Kristensen does a walkthrough of some of the goodies in his Web Essentials and the Image Optimizer. If you are in the web dev space, you should check it out: http://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Visual-Studio-Toolbox-Web-Essentials-and-CSSCop

1 Comment

Comment

Killing all Cassini(s) with a .bat file

When working with Visual Studio and using the Web Development Server (aka CASSINI), there is often the repetitive task of killing the Cassini processes before running again. This happens especially if you are working with in-proc caching on IIS, or simply have many web applications in your solution.

What I do is run a simple bat file that automatically kills all the Cassini Web Development Server instances, that way if I need to make sure I'm using uncached data I just run it and keep on doing what I was doing before, instead of manually scanning my taskbar.

So, crack open notepad, write the following and save it as "CassiniKiller.bat"

[sourcecode language="cpp"] taskkill /F /IM "WebDev.WebServer40.exe" taskkill /F /IM "ProcessInvocation86.exe" taskkill /F /IM "iexplore.exe" [/sourcecode] Now you won't have to play cat and mouse with the Cassinis no more; now you just KILL'EM ALL :-)

Comment

1 Comment

Installing and using FxCop

This article is supporting the article “Definition of DONE” with regards of code analysis and best practices. FxCop is an application that analyzes managed code assemblies (code that targets the .NET Framework CLR) and reports information about whether the assemblies are abiding by good design guidelines and best practices. Things like architectural design, localization, performance, and security improvements are among the many things the tool will check automatically for you and give you a nice detailed report about its findings. Many of the issues are related to violations of the programming and Microsoft guidelines for writing robust and easily maintainable code using the .NET Framework.

On the home page of the tool says that "FxCop is intended for class library developers". Wait what? Class Library Developers? WTF, whatever...the fact is that the tool is good for any type of managed library, including service libraries, winForms and WPF projects. If it looks like a DLL, smells like a DLL, and it has extension "*.dll" or "*.exe" => FxCop will screen the hell out of it.

I also find FxCop a very useful learning tool for developers who are new to the .NET Framework or who are unfamiliar with the .NET Framework Design Guidelines. There is plenty of documentation online (MSDN) about the Design Guidelines and the different rule sets of best practices Microsoft recommends.

Think of FxCop as a bunch of Unit Tests that examine how your libraries conform to a bunch of best practices

FxCop is one of the tools I use to follow my Scrum definition of "Done" when writing code in .NET. But I also mentioned(wrote) about ReSharper Code Analysis features and how great they are and how we use them too. So the singular question becomes: WHAT IS THE DIFFERENCE BETWEEN FxCop and ReSharper Code Analysis?

The answer is simple:

  • ReSharper Code Analysis analyses your .NET language (C#, VB.NET) source code.
  • FxCop analyses the binaries produced by your source code. FxCop will look for the Common Intermediate Language (CIL) generated by the compiler of your .NET language.

In a sense, FxCop analysis should be done after ReSharper analysis, and will trap everything R# missed. FxCop was initially developed as an internal Microsoft Solution for optimization of new software being produced in house, and ultimately it made is way to the public.

Installing FX Cop

  1. Verify whether or not you already have the Windows SDK 7.1. If you already have the folder "C:Program FilesMicrosoft SDKsWindowsv7.1" on your FS, that means you have it; otherwise you need to install it. If you have it, skip the next steps.
  2. Download the Microsoft Windows SDK for Windows 7 and .NET Framework 4. You can download the web installer from HERE or search in Google for "windows sdk windows 7 web installer .net 4.0". Make sure you are downloading the one for .NET 4.0 and no other one.
  3. Install the SDK with the following settings
  4. Install FX Cop 10 by going to "C:ProgramFilesMicrosoftSDKsWindowsv7.1BinFxCop" and running the setup file.

Using FX Cop

There are 2 ways of using FxCop: standalone or within Visual Studio.

Using FxCop in standalone could not be simpler. It works similar to VS in the sense that you create projects where each project is nothing else than a collection of DLLs that are analyzed together (called targets in FxCop... why not, Microsoft).

To use FxCop as a Visual Studio tool:

  • Open VS and go to Tools->External Tools
  • Add a new tool and call it FxCop with the command line tool pointing to "C:Program Files (x86)Microsoft Fxcop 10.0FxCopCmd.exe"

Now without leaving VS you can either run it as a CMD line tool by going to Tools->FxCop OR you can configure your projects to enable code analysis when you build your project. Doing it the second way will allow you to get the errors and warnings on the same build output window you get compilation errors.

Wrap Up

FxCop is a very solid tool to enforce good practices on your projects and assemblies, and it offers a wide array of configurable features not on the scope of this article. Ultimately you can write your custom rules for FxCop and enforce them as part of your project code analysis. Visual Studio integration is also a great way to maintain your code as you write it.

For more resources on FxCop, check out the FxCop Official Blog.

1 Comment

2 Comments

Configuring ReSharper Code Analysis

This article is supporting the article "Definition of DONE" with regards of code cleanup.

Having your code CLEAN is not only elegant, but also a good practice and habit to have specially if you work in a team environment. Every developer have their own styles, likes and dislikes when it comes to code formatting, ordering, grouping regions, etc; precisely because of this, is always good to get the team together, crack-open some Red Bulls and come up with your code standards and practices (and while you are at it, put them up on the Wiki). You can then use automation tools for your IDE to speed up the process and make sure everybody is generating and organizing their code files using the same rules. In my case, at work, we are living in the .NET world and ReSharper 4 or later in Visual Studio does the trick perfectly for us.

ReSharper has a feature called "Code Cleanup" that accomplishes exactly that: it automates the suggestions from the "Code Analysis" and applies them to code files. You can remove code redundancies, reorder type members and remove redundant using directives among many other things. This is not the only one of the many useful things ReSharper offers to .NET developers, but is certainly one I use the quite often. Let's see how it works.

At the time of this article I'm using VS 2010 and ReSharper 5.0, so all images are representative only of such software and version.

Make it perfect in one machine

The first thing is to configure all the settings in ReSharper on one machine and then share your settings. There is plenty to go through and each team may have different requirements. For example, by default ReSharper has the inspection severity on the unit "Redundant 'this.' qualifier" to "Show as warning" and in my team WE DO LIKE to use the 'this.' qualifier regularly, so we changed the R# setting to make "Show as hint". Things of this magnitude does not impact performance in code execution, the compiler simply ignores it; and they are more of a "style" type of inspection you can always tailor to your specific needs.

Once you have your Dev Box all configured, simply export your settings so the rest of the team can use them.

You can download the style we are currently using HERE.

That is the official way of sharing things using ReSharper, BUT... there is a small problem: that only shares the code inspection rules of the ReSharper settings and not other[important] things like the "Code Cleanup" settings. Breathe with ease ninja, there are solutions.

  1. If you have ReSharper 5.1 => you can use Resharper Setting Manager. This is an open source tool (CodePlex hosted) that allows you share ALL of your R# settings very easily. Officially you need R# 5.1 for this tool; I've tried it with R# 5.0 and have had a success rate of 0.5 (there is some black magic going on there that makes it work only half of the time with R# 5.0).
  2. Go old school and just copy the settings straight from the application data on your installation folder. Just navigate to  %appdata%JetBrainsReSharperv5.0vs10.0 and copy the files UserSettings.xml and Workspace.xml to your repository (or a share folder, or email, or... ). You can then get those settings from other dev machines and put them in their respective places (close VS first).

Now when you open VS on the other dev machines you'll find the same configuration and code cleanup settings as the original box. Sweet!

Using Code Cleanup

When using VS with a source code file open, the code inspection engine will always notify you of how well (clean) your code is doing with regards to your R# settings. The keyboard shortcut to run the code clean up is Ctrl+E+C or Ctrl+K+C depending on the shortcut schema layout you are using. After you run it, things will be looking better for you ;)

  • Red light means there is a BREAKING change on the code, and will probably not compile.
  • Orange light means the code doesn't have any breaking changes, but it can be improved. You'll get some warnings and some suggestions.
  • Green means you are good to go buddy. Ready for commit.

Part of our Definition of DONE is to get a green light on your source files. No exceptions.

You can find some more useful features of ReSharper like solution-wide analysis HERE.

2 Comments

Comment

Ahhhh.... RIA Services!!!

OK, so I started going down the road of creating a silverlight web application using the Silverlight Business Application template of Visual Studio 2010. After about 4 hours trying to configure things straight with the authentication credentials and styling on the application, I decided to give up and start with my own WCF-from-scratch entity service layer to serve data to my clients. Cheez, sometimes you really need simplicity. RIA Services provides a lot of nice wrappers with the Domain Services WCF wraps, but the template itself is not very easy to adapt to your own model. Maybe later I’ll take a second look at the RIA template with VS 2010, but for now, I’m going rogue old style project by project.

Comment

Comment

New product coming...

I'm starting a new project/product now. Let's see how it goes, I have very high expectations with this new product and I'll let things slip thru as it takes shape. I still have to make a new company for it, so I can get some tax benefits too. I keep postponing the company creation thing for tomorrow and then for tomorrow. One more time, I'll do it tomorrow (and this time I'll really do it). I'll kick things up with .NET 4.0 and some Entity Framework. This is my first time working with the ADO.NET entity framework and I like very much what I've seen so far. Initially I thought to use something different from .NET, like RoR (Ruby) or Django, the Python Web framework; but I ended up going back to the land I know the best: .NET world. The reason was simply the speed at which I can work and produce code is important at this time, since I'm the only one writing code on this thing.

I'll try to keep posting about my progress here and the new challenges I face as I move forward.

 

Comment

1 Comment

SharePoint? What is that?

The first questions people ask themselves when they hear the SharePoint Buzz for the first time is What the heck is SharePoint? I will explain in a friendly and simplistic way what SharePoint is, and how it has fold out to be one of the most powerful and fast growing software solutions in the history. Coming up:

  • What is SharePoint?
  • How exactly is SharePoint different from any regular web site?
  • How can SharePoint help you in your bottom line?
  • Conclusions

What is SharePoint?

From the technical-friendly point of view SharePoint is a software ecosystem formed by many different Microsoft software products. Microsoft indifferently refers to it as Microsoft SharePoint Products and Technologies. SharePoint (aka SP) targets the space of web collaboration functions, content and document management, search and social networking in one centralized solution that offers a plethora of very powerful business applications that are deeply tight to the already popular Microsoft Office applications.

From the end users perspective SharePoint is a web site (web application) that allows users to collaborate and share information, documents, photos and other media rich content directly from the web browser without needed to have any technical skill. Simply by using tools they already know like Microsoft Word, Excel, Power Point, InfoPath and such, users can create very rich documents and have them broadcast to a large audience with the click of a button.

Another important notation to make is that SharePoint is a cross platform product. That means SharePoint, being a browser based tool, can be experienced from many different operating systems like Windows, Mac OS-X and Linux systems. Although SP is a cross platform tool, as of today's official product (MOSS 2007) there are a few rendering abnormalities with some specific content in browsers different from Internet Explorer. Users accessing SharePoint sites with the popular Firefox browser, Safari, Opera and Chrome to name a few may experience that some controls and parts of certain pages will be rendered incorrectly in the page. This issue is not very common and will not affect the functionality and power SharePoint brings to its users. SharePoint 2010 is in beta stage as of the writing if this article and the SP Team announced most of the browser compatibility problems from previous versions will disappear in the upcoming release.

Browsers in SharePoint

If you are interested in diving a bit more into the browser war, SharePoint official compatibility and the Microsoft recommendations for browser support you can explore this TechNet article that is dedicated to such topic.

Ok, so how exactly is SharePoint different from any regular web site again?

As we mentioned before, SharePoint is a collection of software applications. These applications are Server products, meaning they were made to be run in a Windows Server OS. The combination of these products (Search, Forms Server, Excel Services, SSO, etc) provide SharePoint with many built in functionality that does not need to be implemented and can still be customized to a very granular level with very little IT support.

To better understand the difference between the SharePoint offerings and building and maintaining your own web site, we must first see what goes into creating and maintaining a web site. The following table shows some (I said SOME) of pros and cons of the most popular methods to build a web site and their pros and cons (Click to enlarge).

The "Web Site" in the title of the table is quoted, because the reality is that SharePoint offers a lot more than just a Web Site, it offers collaboration, networking and business tools to make any SP install a catch-all experience. Also is worth noting that technically SharePoint does not offers a Web Site, instead (from IIS perspective) it builds a set of IIS Web Applications that are linked and can exchange information via the SharePoint ecosystem. Hold on to your hats, more on that and the SharePoint terminology later.

As you can see there is plenty to eat in the SharePoint family. But how does it directly affect you?

How can SharePoint help me as an organization or as an individual?

Honestly, even if I try I don't think I can come up with a better sentence than this one from the official Microsoft SharePoint site:

"… Microsoft Office SharePoint Server 2007 provides a single, integrated location where employees can efficiently collaborate with team members, find organizational resources, search for experts and corporate information, manage content and workflow, and leverage business insight to make better-informed decisions."

--- Pasted from <http://sharepoint.microsoft.com/product/details/Pages/default.aspx>---

SharePoint is an extension to the cloud (Internet) of all of the Office Family of products. In fact SharePoint is part of the Microsoft Office Group. If you or your organization are using any of the Microsoft Office products (Word, PowerPoint, Excel, etc) then you are half the way into becoming a great SharePoint user and take full advantage of its offerings. Although SharePoint clearly targets more businesses than individuals, the fact that most of us work for some corporation means that we're very likely to at one point or another face the SharePoint solution of your workplace. And trust me, I'll make your live so much pleasant… SharePoint will be there when:

  • You want to cut dramatically the use of paper and ink in your organization.
  • You want to improve the performance of your employees and make them work better and more organized between them.
  • You need to collaborate with a team member in writing on the same document simultaneously.
  • You want to request a day off without having to confront the boss.
  • You want people to request a day off without coming to your office or spending a fortune in paper and ink. Also want to be able to notify the requestor of your decision about his request.
  • You are a manager and you want your team to work under your schedule and not the other way around.
  • You want to expose your professional profile in the company's SharePoint to find opportunities in other departments and move up within the organization. Get discovered.
  • You want to make a small correction to a published document and will be able to make the change and make it available immediately online with one click. No downloading and re-uploading, no emailing required.
  • You want to see how a particular spread sheet or document looked like last month without disturbing the IT department to pull it off the archive.
  • You want to broadcast the meetings calendar to all the Outlook account in your department with a click of a button.
  • You want to automatically get notified when somebody completes a sale, or gets a new bid, or renews a contract and want to see at a glance the ongoing financial health of your company with real-time data.
  • You want to have a fun home page with your favorite color and alternating pictures of your family.
  • You want to access all corporate data securely from the internet.
  • You want to monitor each department of your organization and ensure they are meeting the new goals with key performance indicators.
  • You want to collect and automate the employee contact info by having forms your employees can fill in and submit from any web browser.
  • And much, much more… :)

Conclusion

I hope you after reading this article you have a better understanding about what SharePoint is, how it differs and stands out over traditional web site design as well as the immediate benefits that SharePoint brings to organizations and individuals and a general feel for some of the coolest features SharePoint offers. I think in general SharePoint is a great solution, ever evolving (SharePoint 2010 is Beta already). I'll try to cover more on SharePoint in future posts.

Thanks for reading!

1 Comment