DCSIMG
August 2008 - Posts - IHateSpaghetti {code}

IHateSpaghetti {code}

VSX, DSL and Beyond by Eyal Lantzman

Syndication

Coding / Architecture

Extensibility /DSL

Projects

Articles

August 2008 - Posts

ASP.NET

  • A solution for the partial rendering issue:
  • CS1502: The best overloaded method match for 'System.IO.TextWriter.Write(char)' has some invalid arguments error

The correct code would be:

<% Html.RenderPartial("somecontrol.ascx",  SomeDataEntity )  %>

Read all about it

 

Visual Studio Extensibility

 

Architecture / Software design

 

F#

I've decided to collect interesting posts on various topics and when reach critical mass publish them in a single post.

Visual Studio Extensibility and DSL Tools

Refactoring

ADO.NET Data Services (Astoria)

ASP.NET MVC

ASP.NET

Software Design and Architecture

Screen Casts

Just run the following in cmd:

DevEnv.exe /installvstemplates

note: if you have Visual Studio 2005 and 2008 installed use full path to devenv.

Posted by Eyal | with no comments

Well, finally after 3 months delay I moved to UK (with my wife)UK.

The weather - well, I assume no sunglasses will be needed.

The food - a lot of people told me that the food is horrible in compare to Israel, well I disagree - the food is very good (not excellent, but  very good non the less).

The prices - naturally, as every foreigner, I divide and multiply all the time and the outcome is usually in favor of UK.

The people - I visited the bank, the police and various shopping centers - all the people were very very nice (even the policeman !) - my wife and I are really surprised in comparison to service-oriented-people in Israel.

I'm starting in Microsoft on Monday and I'm really exited about it! (need to get used to fact that the week starts from Monday)

 

Regarding the blog - I'll continue to write as usual, perhaps more about Visual Studio extensibility and DSL tools, but other topics as well.

Posted by Eyal | 3 comment(s)

How do I save a project via API in silent mode

Interfaces and classes needed

 

 

And the guids needed to handle menus:

Menus

Microsoft.VisualStudio.Shell.VsMenus, Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0

Commands

Microsoft.VisualStudio.VSConstants.VSStd2KCmdID, Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0

Microsoft.VisualStudio.VSConstants.VSStd97CmdID, Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0

Project kinds

VSLangProj.PrjKind, VSLangProj, Version=7.0.3300.0

VSLangProj2.PrjKind2, VSLangProj2, Version=7.0.5000.0

Project item kinds

EnvDTE.Constants.vsProjectItemKindMisc, EnvDTE, Version=8.0.0.0

EnvDTE.Constants.vsProjectItemKindPhysicalFile, EnvDTE, Version=8.0.0.0

EnvDTE.Constants.vsProjectItemKindPhysicalFolder, EnvDTE, Version=8.0.0.0

EnvDTE.Constants.vsProjectItemKindSolutionItems, EnvDTE, Version=8.0.0.0

EnvDTE.Constants.vsProjectItemKindSubProject, EnvDTE, Version=8.0.0.0

EnvDTE.Constants.vsProjectItemKindVirtualFolder, EnvDTE, Version=8.0.0.0

Logical views

Microsoft.VisualStudio.Shell.Interop.LogicalViewID, Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0

Output window panes

Microsoft.VisualStudio.VSConstants.GUID_BuildOutputWindowPane, Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0

Microsoft.VisualStudio.VSConstants.GUID_OutWindowDebugPane, Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0

Microsoft.VisualStudio.VSConstants.GUID_OutWindowGeneralPane, Microsoft.VisualStudio.Shell.9.0, Version=2.0.0.0

Toolwindows

Microsoft.VisualStudio.Shell.Interop.ToolWindowGuids, Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0

Microsoft.VisualStudio.Shell.Interop.ToolWindowGuids80, Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0

Contexts

Microsoft.VisualStudio.Shell.Interop.UIContextGuids, Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0

Microsoft.VisualStudio.Shell.Interop.UIContextGuids80, Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0

VSLangProj80.vsContextGuids, VSLangProj80, Version=8.0.0.0

 

Check the post to get updates regarding the various guids.

Posted by Eyal | with no comments

Tim posted a great post and in that post he implements the PRG pattern (it's basically a way to overcome the annoying "...resend data..." message box)

Posted by Eyal | 1 comment(s)

In the last weekend there were number of tools/frameworks that were published/upgraded/etc

  • FxCop 1.36 - .NET Code Analysis Tool for Microsoft .NET Framework Design Guidelines - documentation and download
    • 200+ bug fixes that reduce noise, missing analysis and rule crashes
    • Support for analyzing anonymous methods and lambda expressions
    • New option for skipping analysis over tool generated code
    • Spell checker libraries now ship in the box
    • Changes in the way references are resolved and located
    • Better support for C++/CLI and the Compact Framework
    • Language 'friendly' API names in the UI and resolutions (ie Visual Basic syntax if running over a Visual Basic binary)
    • New globalization, design and usage rules
    • New rule for targeting specific versions of the Framework (I'll talk about this in a future post)
    • Performance improvements that cut analysis by 2x and use half as much memory

 

  • StyleCop 4.3 - Microsoft Source Code Style and Consistency Tool - download
  • new rules:

    • Enforce sort order for using directives. This aligns with the Organize Usings functionality in VS 2008
    • Require standard summary text for constructors and destructors
    • Require parenthesis in arithmetic and comparison expressions for added clarity
    • Require String.Empty rather than “”
    • Require explanation message text in debug asserts
    • Require justification text in Code Analysis suppressions
    • Enforce use of built-in type aliases for int, string, float, etc.
    • Require a blank line between elements
    • Disallow blank lines at the top or bottom of documentation headers
    • Disallow regions within method bodies (enabled by default)
    • Disallow the use of regions anywhere within the code (disabled by default)
    • Disallow empty static constructors
    • Disallow empty unsafe, lock, checked, and unchecked statements
    • Disallow unnecessary or empty try\catch\finally

 

  • Unity 1.2 First Drop - download
    • Fix for a CLR bug that we hit that caused issues when running in release mode without a debugger attached
    • Refactorings to support an easier Silverlight port
    • Support for Generic Decorator Chains

 

  • NHibernate 2.0 - download
  • With NHibernate, you do not need to-

    • decorate your entities with any attributes
    • inherit your business objects from any base classes
    • implement an interface on your entities

David Chaplel has publish a document about Cloud Platforms - you can read in here.cloud

Posted by Eyal | 1 comment(s)

Source files rebasing enables a common CI scenario where the code is compiled in one location and analyzed in another one.

ndepend-copmare1

One useful scenario is during 2 builds comparison. Usually, analysis results are done the same way and thus, source files paths are the same both in older and newer analysis results. In this condition, when trying to compare 2 versions of a source file NDepend tells that because the 2 paths are the same, it can’t compare the source files.

ndepend-copmare2

A solution to this problem is to fetch the older and the newer source files hierarchy from the source code repository and rebase both the older and newer application in VisualNDepend. This way, 2 versions of a source file can be compared properly.

ndepend-copmare3

more info...

Posted by Eyal | with no comments

Pablo publishes another how do I, this time DSL related

How do I get a model element name property without using reflection / TypeDescriptor

Interfaces and classes needed

Posted by Eyal | with no comments
תגים:, , ,

DSL Related: How do I get the model element associated to a shape and vice versa

Interfaces and classes needed

 

VS Related: How do I flush content to the Visual Studio output window

Interfaces and classes needed

Posted by Eyal | with no comments
תגים:, , , ,

I collected several posts in this matter.

 

* Who Is An Architect And What Do They Do?

* What does a Technical Architect do next?

* What does a Chief Architect do next?

* Get out there!

* How to become an enterprise architect ?

 

 

What do you think - what do you need in order to become an architect?

Do the road map that Praba Siva is the one you thought of?

Posted by Eyal | 5 comment(s)
תגים:, ,

The Visual Studio 2008 SDK 1.1 compliments the Service Pack 1 release of Visual Studio 2008. The SDK contains several new features such as:

· Significant size reduction for Visual Studio Shell redistributable packages. The Visual Studio Shell Isolated and Visual Studio Shell Integrated redistributables are now approximately 150 megabytes smaller. The redistributables no longer carry the full .NET Framework 3.5 payload. However, they contain a bootstrapper that automatically downloads the .NET Framework 3.5 runtime if it is not installed on the target computer.

· Support for progress feedback in a chained installation. The Visual Studio Shell Isolated and Visual Studio Shell Integrated redistributables can now pass installation progress back to the chaining process. This lets developers display accurate progress in their setup programs.

· Visual Studio Shell development now supports normal user. Developing and deploying a Visual Studio Shell application no longer requires the developer to be an administrator on a Windows XP computer or to have elevated privileges on a Windows Vista computer.

· DSL Print Preview. The ability to preview a DSL before printing has been added to the DSL designer.

· New XML Tree Editor sample. The SQL Server team has provided a new XML Tree Editor sample. The earlier sample has been removed.

· New TFS Samples. Two new TFS samples have been added.

o VSExtensibilitySample

o This new TFS sample provides an example of creating a Visual Studio add-in that interacts with the Version Control user interface of Team Explorer.  The sample comes with a detailed Word doc that provides insight into the requirements of such an add-in.

o RichClientCustomControl

o This new TFS sample provides an example of creating Work Item Tracking custom controls that work within Team Explorer.  The sample comes with a detailed Word doc that provides insight into the requirements of custom controls as well as a separate document that describes how to write custom controls that can be used within the Team Server Web Access environment .

· Updated Shell documentation. Documentation about the Shell has been added.

In order to use the Visual Studio 2008 SDK 1.1, you will need to install Visual Studio Service Pack 1. The Visual Studio Service Pack is available here.

Once you have Service Pack 1 installed, you can download the Visual Studio 2008 SDK 1.1 from here.

If you run into any issues, check out our online readme here.

Posted by Eyal | with no comments
תגים:, ,

Although these tools are not that new but I want to remind all of you about their existences because they are very powerful and must part of the developers productivity toolkit.

Below is a list of the included in PowerCommands for Visual Studio 2008 version 1.1.


Enable/Disable PowerCommands in Options dialog
This feature allows you to select which commands to enable in the Visual Studio IDE.  Point to the Tools menu, then click Options.  Expand the PowerCommands options, then click Commands.  Check the commands you would like to enable.
Note: All power commands are initially defaulted Enabled.

Format document on save / Remove and Sort Usings on save
The Format document on save option formats the tabs, spaces, and so on of the document being saved.   It is equivalent to pointing to the Edit menu, clicking Advanced, and then clicking Format Document. The Remove and sort usings option removes unused using statements and sorts the remaining using statements in the document being saved.
Note: The Remove and sort usings option is only available for C# documents.
Note:  Format document on save and Remove and sort usings both are initially defaulted OFF.

Clear All Panes
This command clears all output panes. It can be executed from the button on the toolbar of the Output window.

Copy Path
This command copies the full path of the currently selected item to the clipboard. It can be executed by right-clicking one of these nodes in the Solution Explorer:
The solution node; A project node; Any project item node; Any folder.

Email CodeSnippet
To email the lines of text you select in the code editor, right-click anywhere in the editor and then click Email CodeSnippet.

Insert Guid Attribute
This command adds a Guid attribute to a selected class.  From the code editor, right-click anywhere within the class definition, then click Insert Guid Attribute.

Show All Files
This command shows the hidden files in all projects displayed in the Solution Explorer when the solution node is selected.  It enhances the Show All Files button, which normally shows only the hidden files in the selected project  node.

Undo Close
This command reopens a closed document , returning the cursor to its last position.  To reopen the most recently closed document, point to the Edit menu, then click Undo Close.  Alternately, you can use the Ctrl+Shift+Z shortcut.
To reopen any other recently closed document, point to the View menu, click Other Windows, and then click Undo Close Window.  The Undo Close window appears, typically next to the Output window. Double-click any document in the list to reopen it.


Collapse Projects
This command collapses a hierarchy in the solution explorer starting from the root selected node. It can be executed from three different places: solution, solution folders and project nodes respectively.


Copy Class
This command copies a selected class entire content to the clipboard. It can be executed from a single project item or a project item with dependent sub items.


Paste Class
This command pastes a class entire content from the clipboard. It can be executed from a project or folder node.


Copy References
This command copies a reference or set of references to the clipboard. It can be executed from the references node, a single reference node or set of reference nodes.


Paste References
This command pastes a reference or set of references from the clipboard. It can be executed from different places depending on the type of project. For CSharp projects it can be executed from the references node. For Visual Basic and Website projects it can be executed from the project node.


Copy As Project Reference
This command copies a project as a project reference to the clipboard. It can be executed from a project node.


Edit Project File
This command opens the MSBuild project file for a selected project inside Visual Studio. It can be executed from a project node.


Open Containing Folder
This command opens a Windows Explorer window pointing to the physical path of a selected item. It can be executed from a project item node


Open Command Prompt
This command opens a Visual Studio command prompt pointing to the physical path of a selected item. It can be executed from four different places: solution, project, folder and project item nodes respectively.


Unload Projects
This command unloads all projects in a solution. It can be executed from the solution node.


Reload Projects
This command reloads all unloaded projects in a solution. It can be executed from the solution node.


Remove and Sort Usings
This command removes and sort using statements for all classes given a project. It can be executed from a solution node or a single project node.
Note: The Remove and Sort Usings feature is only available for C# projects since the C# editor implements this feature as a command in the C# editor (which this command calls for each .cs file in the project).


Extract Constant
This command creates a constant definition statement for a selected text. It can be executed from the code window over a selected text.


Clear Recent File List
This command clears the Visual Studio recent file list.


Clear Recent Project List
This command clears the Visual Studio recent project list.


Transform Templates
This command executes the associated custom tool with text templates items. It can be executed from a DSL project node or a folder node.


Close All
This command closes all documents. It can be executed from a document tab.

 

You can download the PowerCommands from here, and check this 7:18min demo.

Posted by Eyal | 2 comment(s)

Pablo continues his series on various how to scenarios in VS Extensibility - How do I intercept a Visual Studio command execution and  How do I know if Visual Studio is running in elevated mode.

Posted by Eyal | with no comments
More Posts Next page »