Tag Archives: visual studio

Visual Studio 2013 update 1: avoid the RC if you use C++

Microsoft has released Visual Studio 2013 Update 1 RC which I installed for a look. It has a “go-live” license, which means you can use it in production, and when the final version comes out you will be able to install it over the top, so it sounded safe enough.

Update 1 is only a bug-fix release – the fixes are listed in the link above. “When you edit multiple resources in Resource Editor, Visual Studio crashes randomly,” is one, so if that affects you, you might want to install it.

Unfortunately the RC introduces a new problem. The syntax highlighting in the C++ editor is broken. Here is a snippet of code before the update:

image

and after

image

Microsoft is aware of the issue and apparently the RTM update will be OK.

While investigating this, I discovered another issue. Visual Studio 2013 was crashing whenever I tried to open a C++ project. If I tried to debug Visual Studio with a new instance, the new instance would crash too. I uninstalled Update 1 RC but that did not fix it. This post on StackOverflow does not describe exactly the same issue, but did lead me to suspect Xamarin, an add-on for Android and iOS development with C#. I uninstalled Xamarin and the problem disappeared; Visual Studio seems to start up more quickly too. A shame as I like the product.

Update: the final Update 1 is now available. What’s in Update 1: http://support.microsoft.com/kb/2911573

Download: http://go.microsoft.com/fwlink/?LinkId=301714

Visual Studio goes online, kind-of

Microsoft held its official launch for Visual Studio 2013 today, at an event in New York, although the product itself has been available since mid-October. VP Soma Somasegar nevertheless made some new announcements, in particular the availability in preview of an online Visual Studio editor, codenamed Monaco. “Developers will now be able to edit their sites directly from the web, from any modern browser, on any device,” said Somasegar on his blog.

Monaco is not intended as a replacement for the desktop IDE. Instead, it parallels what Microsoft has done with Office, which is to provide a cut-down online editor for occasional use. Monaco currently targets only web applications running on Azure, Microsoft’s public cloud platform. The technology is not altogether new, since it is built on the same base as “Napa”, the online editor for Office 365 applications.

image

At the launch, Monaco was demonstrated by Erich Gamma, of Design Patterns and Eclipse fame, who says he uses it for real work. He assured us that it is built on web standards and compatible with iOS and Android tablets as well as desktop browsers.

Online editing with Monaco is only one part of what Microsoft now calls Visual Studio Online. The product also includes a hosted version of Team Foundation Server, offering source code control, collaboration tools, and an online build service. These features were already available as part of Team Foundation Service, which is now replaced by Visual Studio Online. If you are happy with the cut-down Visual Studio Express, or already have Visual Studio, then subscription is free for teams of up to five users, with additional users costing $10 per user/month for an introductory period, and rising to $20 per user/month.

Microsoft is also offering Visual Studio Online Professional, which bundling desktop Visual Studio Professional with these online services, for teams of up to 10 users, at $22.50 per user/month rising to $45.00 per user/month. This follows the same model which Adobe adopted for its Creative Cloud, where you get cloud services bundle with tools that run on the desktop.

Pay even more and you can get Visual Studio Online Advanced, which oddly does not include the Professional IDE, but supports unlimited users and has additional reporting and collaboration features, for $30 rising to $60 per user/month.

When does the introductory offer expire? It’s until further notice – 30 days’ notice will be provided before it ends. Confusing.

Somasegar also announced the preview of a new online service called Application Insights. This service analyses and monitors data from .NET or Java applications running on Windows Server or Windows Azure, and .NET applications on Windows Phone 8, reporting on availability, performance and usage.

Another new service is Elastic Load Test (not to be confused with Amazon’s Elastic Compute Cloud), which simulates multiple concurrent users for testing the performance and behaviour of an application under stress. This requires the expensive Visual Studio Ultimate with MSDN subscription, and offers 15,000 virtual user minutes per month, with additional virtual user minutes at $.001 each.

Finally, he announced a partnership with Xamarin to enable development for iOS and Android in C# and Visual Studio, extending the existing Portable Class Libraries so that non-visual code can be shared across different Windows platforms as well as the new mobile target platforms.

I spoke to Xamarin’s Nat Friedman about this and wrote it up on the Register here.

Microsoft’s strategy here is to persuade existing Windows developers, familiar with C#, Visual Studio, and both desktop and ASP.NET applications, to stick with Microsoft’s platform as they migrate towards cloud and mobile. In this context, the heart of Microsoft’s platform is Windows Azure and Office 365, which is why the company can tolerate iOS or Android clients.

The company will also hope that a proliferation of apps which integrate and extend SharePoint online will help drive subscriptions to Office 365.

The latest Visual Studio includes a new Cloud Business App project type, which is an app that sits on Windows Azure and integrates with SharePoint in Office 365. Coding in Visual Studio and deploying to Azure, both for Cloud Business apps and ordinary web applications, is now an easy process, reducing friction for developers deploying to Azure.

More information on Visual Studio Online is here.

Visual Studio 2013 is released. What’s new?

Microsoft released Visual Studio 2013 yesterday:

VS 2013 can be installed side by side with previous versions of Visual Studio or, if you have a VS 2013 pre-release, it can be installed straight over  top of the pre-release.

I installed over the top of the pre-release and I’m happy to say that this worked without incident. This is how it should be.

image

Oddly, the launch of Visual Studio 2013 is not until November 13th, proving that in Microsoft’s world products can “launch” before, at or after general release.

So what’s new in Visual Studio 2013? Tracking Visual Studio is difficult, because many important features show up as updates and add-ons. After all, at heart Visual Studio is just a shell or platform in which development sit. The Visual Studio LightSwitch HTML client, for example, which made LightSwitch into a strong tool for rapid application development of mobile web apps, appeared as part of Visual Studio 2012 Update 2. Now in Visual Studio 2013 we have LightSwitch support for Cloud Business Apps, though the new project type is shown under Office/SharePoint rather than under LightSwitch:

image

A Cloud Business App is an add-on for SharePoint typically running on Office 365. In the new model SharePoint apps do not really run on SharePoint, but are web apps that integrate with SharePoint. This is great in an Office 365 context, since you can write a web app that is accessible through the Office 365 site and which is aware of the logged-on user; in other words, it uses Azure Active Directory automatically. There’s more on the subject here.

What else is new? Here are some highlights:

  • Better ISO C/C++ compliance in Visual C++
  • Upgraded F# with language tweaks and improved performance
  • .NET Framework 4.5.1 with minor enhancements
  • Support for new Windows 8.1 controls and APIs in Windows Store apps – these are extensive.
  • “Just my code” debugging for C++ and JavaScript, and Edit and Continue for 64-bit .NET apps
  • Graphics diagnostics for apps running remotely
  • Sign into Visual Studio with a Microsoft account. Microsoft pulls developers further into its cloud platform.
  • Windows Azure Mobile Services – build a back end for an app running on Windows, Windows Phone, iOS, Android or web

Does that amount to much? Compared to the changes between Visual Studio 2010 and 2012, no. That is a good thing, since what we have is a refinement of what was already a capable tool, rather than something which gives developers a headache learning new ways to work.

Anders Hejlsberg says C# 6.0 to use Roslyn compiler, coming in next Visual Studio after VS 2013

A disappointment at Microsoft’s Build conference last month was lack of news about the next version of C#, version 6.0. C# architect Anders Hejlsberg did present a session, but it was on TypeScript, a language which compiles to JavaScript.

Aside: Hejlsberg talks about the new Xbox music app in Windows 8.1 (and Xbox One) which is written in JavaScript. It is a large app with 500,000  lines of code, and new features are now implemented in TypeScript (30,000 lines so far).

However, Hejlsberg did also talk about C# 6.0 at Build, during this Channel 9 Q&A, though you have to scroll through to reach the C# content (about 34 minutes in).

image

He confirmed that C# in Visual Studio 2013 is the same as before, but there will be new previews of the forthcoming “Roslyn” compiler soon, and that C# 6.0 will be in the “next Visual Studio after” which suggests Visual Studio 2014, presuming Microsoft sticks to its annual release cycle.

“We are at a point where the Roslyn compilers are done,” he said.

Roslyn, Hejlsberg explained, is the new compiler for “C#, and VB, and the language services in the IDE.”

Roslyn performance will be at least as good as the existing native compiler, says Hejlsberg. It is better suited to parallel processing so will take advantage of multi-core machines, “particularly for large projects.”

You can read more about Roslyn here. Microsoft describes it as “opening up the Visual Basic and C# compilers as APIs.” Practical benefits include features like instant porting of VB code to and from C#, and the use of C# and VB as macro languages within a .NET application.

Hejlsberg also says that Roslyn will enable a faster pace of evolution for C# in future.

Another aside: Xamarin, which provides a compiler for C# targeting iOS and Android, gets a nod of approval from Hejlsjberg. “I’m a great fan of their work,” he says.

Blogger (and former Microsoft Excel developer) Wesner Moise provides a transcript of the key points.

Visual C++ will implement all of C++ 11 and C++ 14, some of C99 says Microsoft

Microsoft’s Herb Sutter spoke at Microsoft Build in San Francisco on the future of C++.

image

Microsoft has been criticised for being slow to implement all the features of ISO C++ 11. Sutter says most features are now included in the public preview of Visual Studio 2013 – which has a “Go Live” license so you can use it in production – including the oft-requested variadic templates. The full list:

  • Explicit conversion operators
  • Raw string literals
  • Function template default arguments
  • Delegating constructors
  • Uniform int and initializer_lists
  • Variadic templates

More features are coming in the RTM (final release) of Visual Studio 2013 later this year:

  • Non-static member initializers
  • =default
  • =delete
  • ‘using’ aliases

A technical preview will then follow and Sutter listed possible features of which there will be a subset. Full conformance will follow at an unspecified time.

Microsoft is also promising a full implementation of C++ 14, the next update to the standard, even though the exact specification is not yet fully agreed. Some C++ 14 features will be implemented ahead of C++ 11 features, if they are considered to add high value.

Two other points of interest.

Async/await (familiar to C# developers) will be implemented in the post-RTM CTP because it is such a useful feature for Windows Runtime app developers, even though it is not part of the ISO standard.

Finally, Microsoft will also several C99 features in the RTM of Visual Studio 2013:

  • Variable decls
  • C99_Bool
  • compound literals
  • designated initializers

The reason for implementing these is that they are needed to compile popular open source libraries like FFmpeg.

I asked Sutter why Microsoft is not planning full conformance to C99. He said it was a matter of priorities and that work on C++ 11 and C++ 14 was more important. If there are particular additional features of C99 developers would like to see implemented, contacting Sutter with requests and rationale might eventually yield results.

image

Build Mac and iOS apps in Visual Studio: Oxygene for Cocoa

Remobjects has released Oxygene for Cocoa, which lets you build apps for Mac and iOS using Visual Studio and the Oxygene language.

Oxygene is a Delphi-like language, making this an easy transition for Delphi developers. Until the most recent release, a version of Oxygene, called Prism, was bundled with Delphi, though this targeted .NET rather than Cocoa. Oxygene can also build apps for the Java runtime, making it a three platform solution.

The cross-platform approach is different from that taken by Embarcadero with FireMonkey, a cross-platform framework for Delphi itself. FireMonkey abstracts the GUI as well as the non-visual code, and in many cases controls are drawn by FireMonkey rather than using the native controls on platforms such as iOS. By contrast, Oxygene works directly with the Cocoa frameworks, so you will build the GUI in code or using the Xcode tools on the Mac.

More like Xamarin then? “We do work together with Mono and with Xamarin,” says Remobjects chief Marc Hoffman. “Oxygene for .NET works with the regular Mono framework for desktop or server apps. But when you get to the devices, the benefit with Oxygene is that you get much closer to the framework, you don’t have the weight of providing an abstraction for the classes you want to use.  If you write a UITableViewController to define a view, then you really write a UITableViewController, the same as you would in Objective-C, just the language is different, whereas in Xamarin you write a different class that sits on top and Mono does the mapping.”

Why not just use Xcode? This is in part a language choice. Remobjects says that Oxygene is “better than Objective-C” thanks to features like automatic boxing of integers, floats and strings, and generic arrays. There is more about the language here. Perhaps more important, if you know Pascal or Delphi it will look more familiar. You also get the ability to share code between Windows, Android, Mac and iOS, though this will be the non-visual code. Developers can also work mainly in Visual Studio rather than in Xcode.

The disadvantage is that you need two machines, or a VM running Windows on a Mac, and a remote connection to a Mac in order to debug.

I plan to try out Oxygene for Cocoa soon and of course will report on the experience.

Microsoft’s Visual Studio and Team Foundation Server get Git integration

Microsoft has announced Git integration in both the Visual Studio IDE and the Team Foundation Service hosted source code management system. According to Technical Fellow Brian Harry:

1. Team Foundation Server will host Git repositories – and more concretely, Team Foundation Service has support for hosting Git repositories starting today.

2. Visual Studio will have Git support – and concretely, we released a CTP of a VSIX plugin for the Visual Studio 2012 Update 2 CTP today.

Git is an open source version control system originally designed by Linus Torvalds to support the development of the Linux operating system. It is a distributed version control system, which means every working directory is itself a full repository, enabling easy forking and offline work.

Team Foundation Service is a version of Team Foundation Server hosted by Microsoft.

Git integration was also recently added to Perforce, another version control system, in the form of the Perforce Git Fusion add-in, emphasising the fact that Git is now a mainstream, enterprise revision control system.

Visual Studio LightSwitch HTML: mainly for mobile

Microsoft’s Visual Studio LightSwitch is an innovative development tool that lets you build multi-tier database applications without ever designing the user interface directly. Instead, you work with defining the database and the the features you want on your screens. LightSwitch generates the user interface for you. You can also add code snippets, and advanced developers can create custom controls and extensions.

The thinking behind LightSwitch was to make it easy for non-developers to create database applications, though it is not the most intuitive of tools and in reality it is developers looking for rapid application development who are most likely to use it. There is a lot to like in the way it is designed, like the data-first approach and the easy to use database designer, but this is spoilt by some odd decisions. One is that the LightSwitch team are seemingly averse to reference documentation, preferring to deliver various how-to walkthroughs, which is frustrating if you want to find out in detail how it is meant to work.

The initial release of LightSwitch, as well as the new edition in Visual Studio 2012, generates only a Silverlight client, making it useless for mobile devices and somewhat annoying on desktop PCs since you have to install the Silverlight runtime. Microsoft has addressed this by creating an HTML client update, which lets you generate an HTML user interface. This is now at Preview two, and I downloaded it to have a look.

Since LightSwitch generates the user interface from metadata, you might hope that the HTML version would let you take a project created for Silverlight, and simply generate a functionally equivalent HTML application instead. Even if some touching up was needed, such as rewriting C# snippets in JavaScript, this would be a nice option. However that is not the approach Microsoft has taken. It has added an option to create an HTML client for a LightSwitch project, but you have to redo all the screens. In addition, the HTML client is intended mainly for mobile, and is designed for touch control, as explained by Microsoft’s Joe Binder here:

We are not expanding the HTML client’s scenario target to include desktop in our first formal release.  The first release will be based exclusively on JQueryMobile and be optimized for building touch-oriented apps.  We’ll stay tuned to your feedback to sort out where/when we go after that, but we still have some issues to sort out for our mobile story and we’ll remained focused until we feel confident that we have a viable mobile offering.

Of course it is still HTML, and will run on modern desktop browsers, though the generated user interface uses JQuery Mobile extensively. Another of the issues here is that HTML 5 may be better supported on smartphones running WebKit-based browsers than on desktops such as Windows XP running Internet Explorer 8, creating problems for LightSwitch. It is also hard to create a user interface that is equally well suited to touch control as to keyboard/mouse interaction; this issue is a common complaint about Windows Store apps on Windows 8.

The HTML client is still interesting, more so than the original LightSwitch with its Silverlight web or desktop clients. Rapid database app development for mobile devices is an key area, as businesses work to enable their mobile users to access company data.

After installing the preview, I built a quick HTML client app, based on a contact database.

image

It did not take long to build a working application, though there are some puzzles. My first effort at creating a contact list only displayed the firstname of each record. Apparently that is the “summary” layout, and I cannot see any quick way to change the summary definition to something more useful. Instead, I changed it to a Rows Layout which shows all the fields, but lets you delete those which are not required. Then I added an Edit contact button, though it appears as plain text without even an underline to show that it is a hyperlink, and I cannot see quickly how to change this:

image

The button’s “Appearance” properties are not helpful:

image

I also found an annoyance that may be a bug. I created several new contacts via a Contact details form (the first illustration above). I saved each contact with the tick button, whereupon they appear in the contact list. However they are not yet really saved. To save the contact to the database, you have to execute the save action, which is a built-in button on the BrowseContacts form. When I tried to save, the phone number fields (defined as Phone Number fields) failed validation, even though they would be valid phone numbers in the UK, and the records were not saved. Fair enough I suppose, but why did they pass validation in the Contact Detail form?

I am sure there are easy fixes for all these niggles, but I mention them to illustrate the point about this not being the most intuitive of tools.

The general approach also takes some mental adjustment. Here is a tool that makes web apps, but you cannot use a web design tool to customise the user interface.

As a tool for building mobile web apps, LightSwitch does show promise and I look forward to the final release. That said, it would be good if Microsoft could adapt the HTML output so you can make it suitable for desktop browsers as well.

Microsoft scraps Expression Web and Design, blends Blend with Visual Studio

Microsoft is giving up its long effort to compete with Adobe in the design tools space. The Expression range of products is being discontinued, in favour of enhanced design capabilities in its developer-focused Visual Studio. Blend for Visual Studio continues, as a design tool for Windows Store apps and Windows Phone apps. A future edition of Blend for Visual Studio, currently in preview, will add WPF (Windows Presentation Foundation), Silverlight, and SketchFlow support. The release version of this upgraded edition is promised for Visual Studio 2012 Update 2.

The new product plans are announced here:

Microsoft is consolidating our lead design and development offerings — Expression and Visual Studio — to offer all of our customers a unified solution that brings together the best of Web and modern development patterns.

Expression Web, the web design tool which evolved out of FrontPage, and Expression Design, a vector drawing tool, will be discontinued completely. Microsoft’s web design tool will now be Visual Studio.

One consequence of this decision is that Expression Web 4 and Expression Design 4 are now free downloads, though unsupported.

Expression Encoder, for converting media for streaming, is also being discontinued, though Expression Encoder Pro will remain on sale throughout 2013. Microsoft says it is still investing in format conversion as part of Windows Azure Media Services.

Is this a good decision? In one sense it is a shame, since Expression Web is a decent product. At least one longstanding user of the product is disappointed:

For Microsoft, the web is dying and the future lies in Windows 8 apps. When asked what we web developers should be doing the answer was the same: Make Windows 8 apps. Which is about as useful as telling a contractor to start erecting tents instead of houses because houses are no longer relevant. Anyone outside the reach of whatever reality distorting force field they have running at the Redmond campus can see how idiotic this is, but that hasn’t stopped the people in charge for pulling the plug on one of the few applications from the company that had something new to offer.

That said, Expression Web has been available for a number of years and made little impression on the market, so how much value is there in continuing with a tool that few use, irrespective of its merits?

The decision makes sense in that Microsoft is shutting down an unsuccessful product line in order to focus on a successful one, Visual Studio.

Further, the end of Expression illustrates the difficulty Microsoft has had in attracting designers to its platform, despite high hopes in the early days of WPF and Mix conferences in Las Vegas.

Adapting the Items Page template in a Windows Runtime app

A while back I adapted a sample application in order to create an app for Windows 8. I am mulling over putting it in the Windows Store, but it needed some work. In particular, I wanted to add a Twitter feed to the front page. There is plenty of space:

image

Sounds easy; but inspecting the layout code I realised that I did not understand it all that well at first.

It is based on the Items Page template in Visual Studio 2012, and there is a fair amount going on in that template:

image

  • The contents are data-bound, which is great at runtime but inconvenient at design time as the page is empty.
  • The contents are layout-aware which means that they account for the four views possible in a Windows Runtime app: landscape, portrait, snapped, and filled. The “filled” name is a little misleading; this is an app which occupies most (but not all) of the screen when another app is snapped to one side.
  • The page uses resources and templates for its element styling, which are defined either in the page itself, or in StandardStyles.xaml which resides in the Common folder in your project (added automatically in projects which use the ItemsPage template).

It’s worth adding some dummy data early on so you can see what the page really looks like:

image

For example, imagine that you want to use a smaller item size that the default 250 x 250 size. Proceed as follows:

  1. Copy the DataTemplate called Standard250x250ItemTemplate from StandardStyles.xaml. Place it in the Page.Resources section of ItemsPage1.xaml (or whatever you called your ItemsPage). Rename it to, say, “MyItemTemplate”.
  2. Modify it to use a smaller size. You will probably want to adjust the bound elements as well, plus change the references to the standard Brush elements like  ListViewItemPlaceholderBackgroundThemeBrush as well.

Here is how the page looks with the space for the image removed, the DataTemplate height set to 50, and the height of the bound Title field set to 20:

image

Note that this template is not used by the Snapped view. For that, you will need to copy and modify the Standard80ItemTemplate, or make your own template suitable for an item in the Snapped view.

The code that determines which templates are used in which state is in the VisualStateManager.VisualStateGroups element. This has a Storyboard animation for the Portrait and Snapped views. The way this works:

  1. The default view is landscape. This is why in the XAML there is a GridView called itemGridView which is visible, and a ListView called itemListView which is hidden (Visibility="Collapsed").
  2. In the Snapped view there is only room for a single-column list, not the grid. Therefore the Storyboard for the Snapped view sets the itemListView to visible and the itemGridView to hidden.
  3. When you change back to a non-Snapped landscape view, the layout reverts to the default. Code for this in in LayoutAwarePage.cs, also in the Common folder.

After working this out I was better able to adapt my own page. More on that another time!