Posts tagged visual studio

Remove unused references to assemblies in Visual Studio

0

One of the most important aspect of programming is reuseability. We, as developers, tend to reuse code a lot. Sometimes ours and sometimes code off the internet. This sometimes requires us to download and install assemblies available on internet. But most of are not careful about code optimization until at the end of the project and before deployment where our goal is to ensure a least error-prone product.

This requires us to remove references to plethora of code we may have included in our project during development. Most of us at this point of stage remembers which code was part of which assembly or where they copied it from. If the code was part of Copy-Paste or Inclusion of code files then its simple to just use “Find All References” option of Visual Studio and check whether a particular code is being used of not.

A more simpler and effective way is a ingenious tool called “ReSharper“. Jet Brains defines it as “The most intelligent extension for Visual Studio” and I concur. Period.

ReSharper is a renowned productivity tool that makes Microsoft Visual Studio a muchbetter IDE. Thousands of .NET developers worldwide wonder how they’ve ever lived without ReSharper’s code inspections, automated refactorings, blazing fast navigation, and coding assistance.

In respect to this blog post, ReSharper can help you identify them, but you have to remove them yourself.

To do this, open up the References in the Solution Browser, right mouse click on each referenced assembly, and pick “Find Dependent Code”. See:

http://www.jetbrains.com/resharper/features/navigation%5Fsearch.html#Find%5FReferencedDependent%5FCode

You will either get:

  1. A list of the dependencies on that Reference in a browser window, or
  2. A dialog telling you “Code dependent on module XXXXXXX was not found.”.

If you get the the second result, you can then right mouse click the Reference, select Remove, and remove it from your project.

While you have to to this “manually”, i.e. one reference at a time, it will get the job done. If anyone has automated this in some manner I am interested in hearing how it was done.

You can pretty much ignore the ones in the .Net Framework as they don’t normally get copied to your build output (typically – although not necessarily true for Silverlight apps).

If you want to know: “How do I remove using clauses (C#) from a source code file that are not needed to resolve any references within that file”.

You could simply right click in the Editor window of Visual Studio and select Organize Usings > Remove unused usings

In this case, ReSharper also does help in a couple ways:

  1. Identifies unused using clauses for you during on the fly error detection. They appear as Code Inspection Warnings – the code will appear greyed out (be default) in the file and ReSharper will provide a Hint to remove it:http://www.jetbrains.com/resharper/features/code%5Fanalysis.html#On-the-fly%5FError%5FDetection
  2. Allows you to automatically remove them as part of the Code Cleanup Process:http://www.jetbrains.com/resharper/features/code%5Fformatting.html#Optimizing%5FNamespace%5FImport%5FDirectives

Finally, realize that ReSharper does static code analysis on your solution. So, if you have a dynamic reference to the assembly – say through reflection or an assembly that is dynamically loaded at runtime and accessed through an interface – it won’t pick it up. There is no substitute for understanding your code base and the project dependencies as you work on your project. I do find the ReSharper features very useful.

Next Visual Studio going multi-screen?

0

Microsoft has again hinted at changes in the next major release of Visual Studio allowing developers to spread out across different monitors.

Noah Coad, Microsoft program manager for the Visual Studio platform, has confirmed changes are in the works that will help developers build applications in some kind of split-screen mode on different monitors.

Coad was speaking almost a year after he first raised the subject, when he began taking feedback on improvements to the next major Visual Studio release, version 10.

While Coad made no specific commitments, it does seem Microsoft has taken an early round of feedback seriously enough to factor it into Visual Studio 10.

The changes are part of an expected package that’ll see major changes to the interface. Also expected: another round of improvements to IntelliSence, support for SQL Server Compact databases, and – as ever – tighter integration with Visual Studio Team Server. There’s no release date yet for Visual Studio 10.

.NET 3.5 Enhancements Training Kit

0

Microsoft has recently released an updated training kit with presentations, hands-on labs, demos and event materials describing features found in .NET 3.5 SP1 and Visual Studio 2008 SP1. Here you will find over 100 MB of information with tips on using MVC, Ajax, the Entity Framework, Visual Studio 2008 SP1 and other tools. Materials used world wide in the .NET 3.5 SP1 training tour are also included. You can read more details here. In the download section shown below, I also include a link to the VS 2008 training kit released last Fall.

Downloads

VS2008 and .Net 3.5 SP1 Download!

0

Visual Studio Service Pack 1 and .NET 3.5 Service Pack 1 are now available for download. A new feature for C# developers called squiggles provides better error messages while you are typing your code. There are several important LINQ performance enhancements, including one that should yield a 50% speed increase in some common scenarios. There are also thousands of other bug fixes.

A general description of these releases is available here. It describes Visual Studio and .NET 3.5 changes such as:

  • Improvements to the WPF designers, and core WPF performance.
  • SQL 2008 support
  • Entity Framework support.

Download

A download page is available here, or you can just follow these links:

VS 2008 Service Pack 1:

VS 2008 Express Editions with Service Pack 1:

VS Team System 2008 Team Foundation SP 1:

.NET Framework 3.5 Service Pack 1:

VS2008 SP1 is a “pretty big milestone”

1

First, it was Windows XP SP1. Then Windows Vista SP3. Now it’s the Visual Studio and .NET Framework 3.5 SP1, due by the end of summer. The connection? Microsoft’s service packs keep growing in importance as a means of updating key products between official releases.

Promoting the first SP for Visual Studio 2008 and .NET Framework 3.5, officially launched just six months ago, Microsoft has said SP1 – like its predecessors – is no ordinary SP.

Ian Ellison-Taylor, general manager for Microsoft’s presentation platforms and tools team, called SP1 a “pretty big milestone” because it quickly connects web-side applications to databases through a new framework. SP1 also cuts the size of the .NET Framework 3.5, which was tailored for Windows Vista, by 85 per cent to make it easier to download and run on Windows XP machines.

“This is a big inflection point,” Ellison-Taylor promised The Reg. “The traditional SP is a bunch of bug fixes – good stuff but not headline stuff.”

SP1 is Microsoft’s attempt to make Visual Studio more suited to web-side development, and see off Adobe Systems’ Dreamweaver. “It’s much easier than using Dreamweaver 2004 for SQL Server connections,” Ellison-Taylor claimed.

What can we expect this time?

According to Ellison-Taylor, the SP introduces an ADO entity framework that lets you program using high-level objects, picking your database and tables, and that does the heavy lifting by connecting to and sucking in data. The framework talks to the database and pulls in the objects for connection to an ASP.NET template.

You edit data on the site, and changes will be updated inside the database. SP1 will reduce the amount of time spent manually coding and linking to connect, and then synchronize changes between the website and the server, so you can get on with scripting the interface.

Out of the box, SP1 will connect to SQL Server 2008, MySQL, IBM’s DB2 and Oracle, and there’s a pluggable framework for connection to other databases.

Go to Top