Quantcast
Channel: Category Name
Viewing all 10804 articles
Browse latest View live

Publishing ASP.NET Core 1.1 applications to Azure using git deploy

$
0
0

I took an ASP.NET Core 1.0 application and updated its package references to ASP.NET 1.1 today. I also updated to my SDK to the Current (not the LTS - Long Term Support version). Everything worked great building and running locally, but then I made a new Web App in Azure and did a quick git deploy.

Deploying ASP.NET Core 1.1 to Azure

Basically:

c:\aspnetcore11app> azure site create "aspnetcore11test" --location "West US" --git
c:\aspnetcore11app> git add .
c:\aspnetcore11app> git commit -m "initial"
c:\aspnetcore11app> git push azure master

Then I watched the logs go by. You can watch them at the command line or from within the Azure Portal under "Log Stream."

The deployment failed when Azure was building the app and got this error:

Build started 11/25/2016 6:51:54 AM.
2016-11-25T06:51:55         1>Project "D:\home\site\repository\aspnet1.1.xproj" on node 1 (Publish target(s)).
2016-11-25T06:51:55         1>D:\home\site\repository\aspnet1.1.xproj(7,3): error MSB4019: The imported project "D:\Program Files (x86)\dotnet\sdk\1.0.0-preview3-004056\Extensions\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the  declaration is correct, and that the file exists on disk.
2016-11-25T06:51:55         1>Done Building Project "D:\home\site\repository\aspnet1.1.xproj" (Publish target(s)) -- FAILED.
2016-11-25T06:51:55    

See where it says "1.0.0-preview3-004056" in there? Looks like Azure Web Apps has some build that isn't the one that I have. Theirs has the new csproj/msbuild stuff and I'm staying a few steps back waiting for things to bake.

Remember that unless you specify the SDK version, .NET Core will use whatever is the latest one on the box.

Well, what do I have locally?

C:\aspnetcore11app>dotnet --version
1.0.0-preview2-1-003177

OK, then that's what I need to use so I'll make a global.json at the root of my project, then move my code into a folder under "src" for example.

{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-1-003177"
}
}

Here I'm insisting on the same SDK version. Now I'll redeploy with a git add, commit, and push.

I think this should be easier, but I'm not sure how it should be easier. Does this mean that everyone should have a global.json with a preferred version? If you have no preferred version should Azure give a smarter error if it has an incompatible newer one?

The learning here for me is that not having a global.json basically says "*.*" to any cloud build servers and you'll get whatever latest SDK they have. It could stop working any day.


Sponsor: Do you deploy the same application multiple times for each of your end customers? The team at Octopus have taken the pain out of multi-tenant deployments. Check out their latest 3.4 release!



© 2016 Scott Hanselman. All rights reserved.
     

More Productive JavaScript in Visual Studio 2017 RC

$
0
0

We know you choose Visual Studio for JavaScript editing because it provides tools that make them the most productive. In Visual Studio 2017 RC, we’ve been focusing on improving the things you use most so that you can spend even more time focusing on coding. In this post, we will highlight some of the most exciting improvements to IntelliSense and code navigation that are available today in Visual Studio 2017 RC.

Richer IntelliSense

JavaScript IntelliSense in Visual Studio 2017 RC will now display much more useful information on parameter and member lists. This additional information is provided by TypeScript, which uses static analysis behind the scenes to better understand your code. TypeScript uses several sources to build up this information.

Rich IntelliSense on jQuery ajax() function

IntelliSense based on JSDoc

When the default type inference does not provide the desired type information, type information may be provided explicitly via JSDoc annotations. For example, to give a partially declared object a specific type, you can use the @type tag as shown below:

This is also very useful for specifying parameter information. Using the JSDoc @param tag you can add types to function parameters like so:

See this doc on github for the JSDoc annotations currently supported.

IntelliSense based on TypeScript Declaration Files

In the TypeScript world, most popular JavaScript libraries have their APIs described by .d.ts files, and the most common repository for such definitions is on DefinitelyTyped. Behind the scenes, Visual Studio will use these .d.ts files to enrich your IntelliSense.
Visual Studio will detect which JavaScript libraries are in use and automatically download and reference the corresponding .d.ts files. These files are downloaded to a cache located under the user folder at %LOCALAPPDATA%\Microsoft\TypeScript. (Note: This feature is disabled by default if using a tsconfig.json configuration file

Currently auto-detection works for dependencies downloaded from npm (via reading the package.json file), Bower (via reading the bower.json file), or loose files in your project that match a list of roughly the top 400 most popular JavaScript libraries. For example, if you have jquery-1.10.min.js in your project, the file jquery.d.ts will be fetched and loaded. This .d.ts file will have no impact on your project other than providing better completions, signatures, and contextual help.

ES6 and JSX Syntax Support

The JavaScript language is constantly evolving and Visual Studio will now help you keep up with language changes by supporting syntax updates much faster. Every year TC39, the ECMAScript standards body, releases official updates to the language. These updates bring new syntax such as classes, arrow functions, and template strings, that provide alternative, more productive ways to write JavaScript. In Visual Studio 2017, syntax through ES7 (ECMAScript 2016) including modules, classes, and arrow functions are fully supported.

ES6 syntax in Visual Studio 2017 RC

In addition to official language updates, there are also unofficial language extensions like JSX, an XML-like extension that is popular in React development, that call for more flexible syntax support. Visual Studio 2017 supports both jsx and tsx file extensions as well as JSX syntax dropped directly in JS and TS files.

JSX syntax in Visual Studio 2017 RC

General Improvements

In addition to language specific improvements, you will also benefit from several general code navigation improvements. Go To, a completely new navigation feature, allows you to quickly perform complete searches to find types, functions, files, and more. Results can be filtered down based on category, to provide a single location for fast code navigation.

Navigation with Go To (ctrl + t or ctrl + ,)

When working with large projects or libraries, often the number of results in completion lists can get quite large. To help you quickly cut down the size of these lists, you can now filter the completion lists by categories such as functions and properties. All of these filters can be quickly toggled with logical hotkeys, which can be easily discovered by hovering over the filter button icons in IntelliSense.

IntelliSense filtering on functions (alt + m)

To read more about the above improvements and get an overview of all the general productivity improvements coming in Visual Studio 2017, check out this post by Mark Wilson-Thomas on Productivity Improvements in VS 2017 RC.

Send Feedback

We hope you’re excited to take your JavaScript development productivity to a new level in Visual Studio 2017 RC. Check out this quick video to see some of the above features in more detail, but we encourage you to download it yourself and give it a spin. Feel free to log any problems using the Report a Problem tool in the upper right corner of the IDE or the installer. You can also submit any suggestions through UserVoice.

Happy hacking!

Bowden Kelly, Program Manager, VS Client
@bowdenk7 

Bowden works on the JavaScript editing experience with a focus on helping developers be more productive in Visual Studio. Outside of work he enjoys playing soccer, teaching the basics of programming, and attempting to be a triathlete.

Productivity in Visual Studio 2017 RC

$
0
0

We know that many developers choose Visual Studio because of its powerful, yet natural, productivity features that help you stay “in the zone”. Visual Studio 2017 RC brings many improvements in this regard, helping you stay even more focused on your program rather than on the tools you use to build it. Download it now to see how you can save time and effort on the tasks that you do day-in, day-out.

We’ve focused our improvements in three main areas where we know most developers spend their time: code editing, navigation and debugging. In this post I’ll go into details highlighting features in each area.

Code Editing

IntelliSense filtering

IntelliSense makes exploring a new API faster by allowing you to narrow down the set of values by category. This means if it’s a variable you need, you don’t need to wade through lots of types to get to it. As an example, the screenshot below shows using the filter to just show variables and constants in the IntelliSense results for a C++ code file:

All the filters have convenient keyboard shortcuts as you’d expect. For example as you’re typing C# code you can quickly press Alt+P to filter down to Properties, or Alt+M to filter out extension methods. Just hover the filter bar to discover all the shortcuts that are relevant to your current situation.

Match highlighting

When you use techniques like camel case matching to home in on a result faster, it can sometimes be hard to tell why an item is matching. That’s why IntelliSense in C#,VB, JavaScript and TypeScript now lets you see why an item is matching your search by bolding the matching letters as shown below. Match highlighting is an extensibility point, so any language can add support for this; you can expect to see more languages supporting this over time.

If you don’t like the filtering or match highlighting features, you can easily turn them off in the IntelliSense settings for your language. Look in Tools-Options-Text Editor, under the language you are using. For instance Tools-Options-Text Editor- C# – IntelliSense will let you control these features for C#.

Better IntelliSense behaviors

Many Visual Studio languages have made big strides this release in getting you better results when using IntelliSense. For instance:

  • C# and VB have “smart preselection”. This determines the target type you are likely to need, and preselects the items in the IntelliSense list that match that type, speeding your typing flow and removing the burden of figuring out what type you need. It’s applied without hitting any special keystroke on your part. Check out this video for an overview of all the new C# and VB productivity features.
  • XAML now has IntelliSense for namespace completion, lightbulb quick fix for missing namespace, sorting and removing unnecessary namespaces, and rename refactoring support for namespace prefixes. In addition, XAML IntelliSense has been improved to help you bind quickly and correctly when binding events, paths and functions with x:Bind; better filtering so that you see only relevant information; and camel case matching support (for example, “RTB” will complete as “RichTextBox”). Watch these features in action in this video.
  • C++ has an experimental Predictive IntelliSense feature that shows a filtered list of IntelliSense results. This means you don’t have to scroll through a long list of irrelevant matches. Only items of the expected type are listed based on need-based probability. You can turn on this feature in Tools > Options > Text Editor > C/C++ > Experimental. See this article on the C++ blog for more details on how this works.
  • The JavaScript language service has been completely revamped to improve its IntelliSense. Previously, as you typed, a JavaScript engine continuously executed your code to provide runtime-like completion lists and signature help. This was great for dynamic JavaScript code, however it often provided an inconsistent editing experience. The new language service uses static analysis powered by TypeScript to provide more detailed IntelliSense, full ES6/ES7 coverage, and a more consistent editing experience. See more details in this post by Bowden Kelly on more productive JavaScript in VS 2017 RC.

Coding Convention Support via .editorconfig

You’ve told us that keeping consistent coding standards in your codebases is a boon to team productivity. It makes it easier to read code written by all team members, but it’s hard work to enforce these standards. To help you achieve consistent formatting on your projects, we’ve introduced built-in support for the public editorconfig convention file format. This lets you define formatting rules that travel with your codebase wherever it goes. This means the code that gets checked in follows the codebase’s conventions and preferences rather than the individual developer’s. You can even supply different conventions for different parts of your codebase, such as when you have some legacy code that follows a different formatting style that you might not wish to change. The format is a standard recognized by a wide range of other editors and IDEs. To get started, just add an editor config file (.editorconfig) to your project. See more details in the documentation here.

Code Analysis for C# and Visual Basic

In C# and Visual Basic, we have gone a step further in coding convention support. We’ve expanded the reach of live code analysis to include code style enforcement—empowering developers to enforce consistent code style and naming conventions across their repo or team. We also are continuously working to help you clean up and move your code forward with new refactorings and code fixes. The coolest ones added in the RC are: Move Type to Matching File, Sync File and Type Name, and Convert to Interpolated String. Check out Kasey Uhlenhuth’s article on C# and Visual Basic Productivity Improvements to learn more.

Live Editing experiences

Improving code quality as early as possible in the development process matters – finding issues sooner is better. Visual Studio 2017 RC makes useful data available at the time of editing, instead of much later in the process, so you can code with even more confidence. Live Unit Testing (a new feature available for C# and VB users on the .NET Framework) gives you the ability to instantly tell whether your unit tests are still passing as you write your code! Check out Joe Morris’s article on Live Unit Testing to get lots more details.

Navigation

Many of you tell us that you spend much of your time working with large existing bodies of code. Having the ability to quickly and easily navigate your code is immensely powerful and can dramatically improve productivity . Whether you’re drilling into a bug, finding the implications of a refactoring, or just figuring out an unfamiliar codebase, tools that get you around quickly and confidently, and help you know where you are will make a big difference. That’s why we’ve added several new navigation features to help:

Go To

Go To (Ctrl + , or Ctrl + T) is a fast, complete search that lets you quickly find files, types, methods, and other kinds of symbols in your code. It gives you a one-stop way to go to any kind of item you need, which is a particular benefit when working in larger code bases.

The new GoTo feature also lets you filter down easily, and choose to look just for one kind of item. You can do this via keyboard shortcut (check out the Edit-GoTo menu to find those shortcuts), mouse clicking on the filter icons in the Go To panel, or by using the speedy query syntax as shown in the example here. Notice the “t” before the search term which tells the search to filter down to just types. So it’s easy to change filter mid-flow as you figure out what you’re looking for.

As you move through your search list, you’ll see a preview of the selected location in a temporary pane. You can riffle through the results quickly to get to just the one you need without leaving a lot of clutter in your wake, as shown below.

GoTo is customizable too – hit the gear icon in the toolbar to change the preview behavior for instance.

Find All References

Find all references (Shift+F12) now helps you get around fast even in really complex codebases. It does so by providing advanced grouping, filtering, sorting, and searching within your results. For some languages, such as C#, the results are colorized just like they are in the editor. C++ lets you see which references are read and which are write. All this gets you a clear understanding of your references and gets you to that line of code you need with confidence.

For an example of how this can speed you to the right code, take a look below. Here I’m looking to understand the consumers of my BaseViewModel class. I can see structural detail on where those dependencies lie because I’ve selected a grouping that includes the path. This means I can quickly see that I have six viewmodels and one helper class that refer to it, and I can hover to see exactly what code is making that helper reference.

The “Group By” dropdown provides useful preset groupings, and you can even create your own by right clicking within the FAR results and using the Grouping context menu. You can also see multiple reference search result sets. This is great for those times when you’re in the middle of using a reference list to check code before refactoring, but find you need to drill on a different reference as you go. Just hit “Keep Results” to freeze the results you have and you’ll get a brand new references window to work with when you next find references.

Structure Visualizer

It’s important to have a clear sense of where you are structurally in your code when reading. To that end, we’ve added a favorite feature from the Productivity Power Tools extension into Visual Studio: Structure Visualizer. This draws structure guide lines (aka indent guides) on your code so you can easily visualize and discover what block of code you’re in at any time without needing to scroll. Hovering the lines shows tooltips that let you see the opening of that block and its parents. This is particularly useful when those blocks are scrolled off-screen. The guides are also handy for checking whether your code is at the right indent level!

In Visual Studio 2017 RC, Structure Visualizer works for XAML, C# and VB files, and for all the languages supported via TextMate grammars, as shown in the screenshot below of a Ruby file. You can expect to see more languages add support later. For some languages (like C#, VB), the tooltips are colorized just like the code they reflect too.

If you prefer not to see the lines, you can easily turn them off in Tools-Options-Text Editor-General-“Show structure guide lines”. You can also alter their color via the Text Editor “Block Structure Adornments” display item in Fonts and Colors.

Debugging

Run to Click

You can now more easily skip ahead without setting a breakpoint to stop on the line you desire. When stopped in the debugger, simply click the icon that appears next to the line of code your mouse is over. Your code will run and stop on that line the next time it is hit in your code path.

New Exception Helper

Use the new Exception Helper to view your exception information at a glance in a compact non-modal dialog with instant access to important information:

  • See what is null: Quickly see what is null right inside the Exception Helper when diagnosing your NullReferenceException in C# and access violation in C++. When you break on a line of code caused by a null value, read the message and look at the bolded variable in the Exception Helper to clue you in to what was actually null.
  • See Inner Exceptions: If the exception you break on has any inner exceptions, you can immediately see their details in the Exception Helper and use the arrows to navigate through the tree of inner exceptions.
  • Ignore exceptions from certain modules: In the Exception Settings section of the Exception Helper, you can now check a box to ignore that exception type when thrown from that current module. That way, the next time you debug that code path, you won’t break on that exception. You can reset these conditions from the Debug > Exception Settings window.

Attach to Process Filter and Reattach

Easily search in the “Attach to Process” dialog to quickly find the process you want to attach the debugger to. After you have attached to a process and stopped debugging or detached from it, you can use the new “Reattach to Process… (Shift + Alt +P)” command in the Debug menu to attach again. Use this feature to save you time and the hassle of always needing to open the “Attach to Process…” dialog when you are debugging a similar process repeatedly.

Keyboard Shortcuts

Power users of Visual Studio tell us that they feel more productive when they use keyboard shortcuts; you can get a useful concise guide to the shortcuts you’ll want to know for many of the features above here.

Send Us Feedback

I hope this has given you a flavor of how Visual Studio 2017 will help you get even more productive in your everyday development work. If you want to learn more about the full set of new features in the product, check out the overview on visualstudio.com, and of course the release notes.

Please try the Visual Studio 2017 Release Candidate today, and send us your feedback; we’d love to hear how the new features are working for you. If you see issues, please be sure to report them using the Report-a-problem tool in the upper right corner either in the IDE or the installer. Track your feedback on the developer community portal. And if you have suggestions, let us know through UserVoice. Thanks!

Mark Wilson-Thomas – Senior Program Manager, Visual Studio IDE Team
@MarkPavWT

Mark is a Program Manager on the Visual Studio IDE team, where he’s been building developer tools for nearly 10 years. He currently looks after the Visual Studio Editor. Prior to that, he worked on tools for Office, SQL, WPF and Silverlight.

Getting the most out of Git

$
0
0

Posted on behalf of guest blogger: Tobias Günther, CEO Fournova . Git Tower and Team Services together provide an awesome Git solution for your team, on Mac and (now!) Windows. 

In the last few years, millions of developers have started to use Git. But just a fraction of them are using it confidently and productively: Git’s large feature set and its even larger number of parameters and flags make it hard to master.

The question, therefore, is not if you are using Git in your team. The question is if it helps you become a more professional and productive developer.

 

Making Git Easier to Use

We faced this question in our own team, too, and decided on a rather radical solution: we developed Tower, a desktop GUI that makes Git easier – for us and over 80,000 customers like Google, Amazon, Salesforce and IBM. After being a Mac-only application for the last 7 years, it is now finally available on Windows, too.

We were eager to make our lives easier and not surrender in the face of Git’s steep learning curve. Let’s look at a couple of situations that we found particularly frustrating – and how we tackled them in Tower.

 

Managing Remote Repositories

A particularly tedious part of developers’ everyday work is repository management: you can spend hours fiddling with remote URLs, passwords, usernames, and authentication tokens. After connecting e.g. your Visual Studio Team Services or Team Foundation Server account in Tower’s “Services Manager”, cloning and creating repositories become a matter of a single click!

Git Tower windows client

Undo & Conflict Wizard

The possibility to undo mistakes is one of Git’s greatest advantages. However, knowing all the commands and parameters to be able to use these undo functions is quite a different story. Tower makes these helpful features easily accessible through a well-designed UI.

For example when a merge conflict occurs, Tower helps you understand and solve it by presenting it in a visual way, via its unique “Conflict Wizard” interface.

Git tower conflict wizard

Usability & Workflows

Since our main goal is to make our users more productive, many usability and workflow improvements found their way into Tower:

  • Auto-Fetch: New changes are automatically fetched in the background for you.
  • Unsynced Commits: Instantly see commits that haven’t been pushed or pulled, yet.
  • Auto-Stashing: In appropriate situations, Tower asks you to stash any lingering local changes for you – and thereby reduce the risk of conflicts.

Git tower windows working copy

Try Tower Free for 30 Days

We created Tower to make Git easier to use. To let people access Git’s powerful feature set without shooting themselves in the foot.

Of course, you don’t have to take our word for granted: you can download & try the new Tower for Windows free for 30 days. We’re eager to hear what you think!

Standard C++ and the Windows Runtime (C++/WinRT)

$
0
0

The Windows Runtime (WinRT) is the technology that powers the Universal Windows Platform, letting developers write applications that are common to all Windows devices, from Xbox to PCs to HoloLens to phones.  Most of UWP can also be used by developers targeting traditional desktop applications.

WinRT APIs are easily accessible from managed languages like C#, however for native C++ developers, using WinRT either requires a lot of complex COM code, or the use of Visual C++ component extensions, better known as C++/CX.  These language extensions allow C++ to understand the metadata describing WinRT objects, provide automatic reference counting of WinRT objects, and a variety of other things, but are not part of the standard C++ language.

Now there’s an easier way for native C++ developers to use the standard, modern C++ language with no extensions, and target the Windows Runtime.  C++/WinRT is a standard C++ language projection for the Windows Runtime implemented solely in header files.  It allows developers to both author and consume Windows Runtime APIs using any standards-compliant C++ compiler.  C++/WinRT is designed to provide C++ developers with first-class access to the modern Windows API.

Let’s look at a simple “Hello World” code sample to better understand this new library:


struct App : ApplicationT
{
    void OnLaunched(LaunchActivatedEventArgs const &)
    {
        TextBlock block;

        block.FontFamily(FontFamily(L"Segoe UI Semibold"));
        block.FontSize(72.0);
        block.Foreground(SolidColorBrush(Colors::Orange()));
        block.VerticalAlignment(VerticalAlignment::Center);
        block.TextAlignment(TextAlignment::Center);
        block.Text(L"Hello World!");

        Window window = Window::Current();
        window.Content(block);
        window.Activate();
    }
}

And now, the C++/CX version of the same code:


ref class App sealed : public Application
{
    protected:
        virtual void OnLaunched(LaunchActivatedEventArgs^ e) override
        {
            TextBlock^ block = ref new TextBlock();
            block->FontFamily = ref new FontFamily("Segoe UI Semibold");
            block->FontSize = 72.0;
            block->Foreground = ref new SolidColorBrush(Colors::Orange);
            block->VerticalAlignment = VerticalAlignment::Center;
            block->TextAlignment = TextAlignment::Center;
            block->Text = "Hello World!";

            Window^ window = Window::Current;
            window->Content = block;
            window->Activate();
        }
};

As you can see, compared to the second snippet using C++/CX, the first snippet using C++/WinRT contains no “hats” (^) and no other language extensions.  It is 100% pure, modern C++ code.

If you have ever done any WinRT development, you already know that there are many APIs which are asynchronous and are required to be called as such.  With C#, this is easily done with the async/await construct.  With the C++/WinRT framework, this becomes just as easy using C++ coroutines (co_await). Here’s an example:


fire_and_forget Async(TextBlock block)
{
    FileOpenPicker picker;
    picker.FileTypeFilter().Append(L".png");
    picker.SuggestedStartLocation(PickerLocationId::PicturesLibrary);
    auto file = co_await picker.PickSingleFileAsync();

    if (file == nullptr)
        return;

    thread_context ui_thread;
    co_await resume_background();

    auto stream = co_await file.OpenAsync(FileAccessMode::Read);
    auto decoder = co_await BitmapDecoder::CreateAsync(stream);
    auto bitmap = co_await decoder.GetSoftwareBitmapAsync();
    auto engine = OcrEngine::TryCreateFromUserProfileLanguages();
    auto result = co_await engine.RecognizeAsync(bitmap);

    co_await ui_thread;
    block.Text(result.Text());
}

But what about performance?  As it turns out, C++/WinRT performs better and produces smaller binaries than C++/CX with identical code.  For example, the code sample above produces binaries sized as shown in the table below:

C++/WinRTC++/CXC#
Smallest Binary53KB + 594KB86KB + 594KB261KB + 3.31MB

But, in addition to size savings, code runs faster as well.  Here are two examples contrasting the performance of C#, C++/CX, and C++/WinRT:

picture1_revised

picture2_revised

C++/WinRT is an open source project and ready for use today with Visual Studio 15 Preview and Windows 10 Anniversary Update.  Here are some important links to get you started.

In the future, C++/WinRT will be expanded to allow WinRT component authoring as well as XAML designer support.  Stay tuned for those features, but in the meantime, get started with modern, pure C++ development with the Windows Runtime today!

The post Standard C++ and the Windows Runtime (C++/WinRT) appeared first on Building Apps for Windows.

TFS/Team Services Q4 Roadmap update

$
0
0

A few days ago we published our Q4 update to the TFS/Team Services roadmap.  We should have done it 6 weeks ago but, Connect(); in mid-November had us really busy and it just fell through the cracks.  Sorry about that.  We should be updating it again in mid-January.

As a reminder, everything on here is just our best estimates and things change.  We try to give about a 6 month time horizon so that you know what we are working on/planning now.  Beyond that, it really is just a backlog review exercise with no real ability to predict much concretely.

I’m working on getting a few blog posts written to drill into some detail on the more provocative ones.

If you have any questions, let me know.

Brian

DevOps at Connect();

$
0
0

A little late on this, but the video of my presentation (with Jamie Cool) is on Channel9 now: https://channel9.msdn.com/Events/Connect/2016?sort=status&direction=desc&c=Brian-Harry&term=

I’ve been saying for a couple of year that TFS and Team Services are a great DevOps solution for your whole team – regardless of the technology or platforms they work on.  I decided to finally put my money where my mouth is and do a big talk where the center of it is a DevOps story for a Java app running on Linux, deployed to a Docker container.  There’s a few other cool demos too.

Check it out.

Brian

Harness the Power of the Redesigned Start Page

$
0
0

In Visual Studio 2017 RC, we brought you a faster installation, better performance, and new productivity features. One of these productivity features is a redesigned Start Page that prioritizes the actions that help you get to code and start working faster.

Most Recently Used (MRU) List

We’ve heard from you that the MRU is the most valuable part of the Start Page so we thought it was time to give it the prominence it deserves. To help you quickly find what you’re looking for, each MRU item now displays an icon denoting it as a project, solution or folder, a file path for local items, and a remote URL for remote items not yet on disk. With the addition of open folder functionality, we’ve added support for recently opened folders. The new MRU also brings you grouping by date, a longer history and a pinned group that lives at the top of the MRU to give you easy access to your most important items.

To help you be more productive across multiple machines, we’ve also added a roaming element to the MRU. If you clone a repository hosted on a service, such as Visual Studio Team Services or GitHub, Visual Studio will now roam this item to any Visual Studio instance that is associated with the same personalization account. You can then select the roamed item from the MRU to clone it down and continue your work in that code base.

MRU with pinned remote repository, folder and projects

Create New Project

Whether you’re new to Visual Studio or a seasoned user, chances are you’ll want to create a new project at some point. In our research, we found that the “New Project…” command was one of the most used features of the Start Page but after talking with many of you, we discovered you often created the same few projects for experimentation. To help speed up this process, the Start Page now allows you to search for the specific project type you’d like to create. With this change, we eliminated the need to click around the New Project dialog to find what you’re looking for. As well, the Start Page will remember what you’ve recently created and allows you to create your project directly from the Start Page. This will bypass the steps of finding and selecting this template in the New Project dialog. If you sign into Visual Studio, this list will also roam with you across your devices.

Recent Project Templates

Search for web project templates

Open

Whether your code lives locally, on an on premise TFS server, hosted in VSTS or shared on GitHub, we wanted to simplify finding, downloading and opening that project.

We’ve added the ability to Open Folder, as well as preserving the Open Project/Solution command, to enable you to open a code base with or without a solution file from within VS.

For code on TFS or hosted in VSTS, you have support out of the box. You can clone a repository simply by clicking on the Visual Studio Team Services item underneath the “Checkout from” header. This area is also third-party extensible. GitHub is one service provider that has already taken advantage of this extension point. For those of you who install the updated GitHub extension, you’ll notice GitHub will appear with VSTS. We’re working to onboard more service providers so that you can easily connect to your code, regardless of the service you use to host your projects.

Open from VSTS, GitHub or from local disk

Developer News

We’ve worked on making sure the news stays fresh and relevant with fewer gaps between posts. While some users read Start Page news to start their day, we heard it wasn’t for everyone. To let you reclaim space and focus on your code, you can now collapse the news section. Don’t worry about missing the latest post; a little badge will appear whenever something new comes in to keep you up to date on all our latest news.

Collapsed Developer News with Alert Badge

Show Start Page

From early feedback, we’ve heard some confusion over where the command to show the Start Page moved. We envision the Start Page will become a starting point for your experience and so we’ve moved this command into the File menu for quicker access.

Thank you

With our latest Start Page, we aim to make your experience more productive, more functional and more personalized, drawing value from quick access to key actions, ability to roam important elements like repositories and project templates, and a new design that allows you to focus on getting to your code.

Download Visual Studio 2017 RC today and share your feedback. For problems, let us know via the Report a Problem option in the upper right corner, either from the installer or the Visual Studio IDE itself. Track your feedback on the developer community portal. For suggestions, let us know through UserVoice.

Allison Buchholtz-Au, Program Manager, Visual Studio Platform

Allison is a Program Manager on the Visual Studio Platform team, focusing on streamlining source control workflows and supporting both our first and third party source control providers.


The week in .NET – Cosmos on On.NET, GongSolutions.WPF.DragDrop, Transistor

$
0
0

To read last week’s post, see The week in .NET – .NET Core, ASP.NET Core, EF Core 1.1 – Docker – Xenko.

On .NET

Last week, Chad Z. Hower, a.k.a. Kudzu was on the show to talk about Cosmos, a C# open source managed operating system:

This week, we’ll speak with Xavier Decoster and Maarten Balliauw about MyGet. The show is on Wednesday this week and begins at 10AM Pacific Time on YouTube. We’ll take questions on the video’s integrated chat.

Package of the week: GongSolutions.WPF.DragDrop

The GongSolutions.WPF.DragDrop library is an easy to use drag & drop framework for WPF. It supports MVVM, multi-selection, and visual feedback adorners.

WPF.DragDrop

Game of the week: Transistor

Transistor is a sci-fi action RPG that follows the story of Red, a famous singer who is under attack. Even though Red manages to escape, it is not without losses. Fortunately, Red immediately comes into possession of a weapon known as the Transistor. As foes are defeated, new Functions are unlocked for the weapon, giving players the ability to configure thousands of possible combinations. Transistor features a unique strategic approach to combat, beautiful graphics and a rich story.

Transistor

Transistor was created Supergiant Games using C# and their own custom engine. It is currently available on Steam, PlayStation 4 and the Apple App Store.

User group meeting of the week: Electrical Engineering for Programmers in NYC

Tonight, Tuesday November 29 at 6:00PM at the Microsoft Reactor in NYC, the Microsoft Makers and App Developers group hold a meeting on Electrical Engineering for programmers.

.NET

ASP.NET

F#

New F# language proposals:

Check out F# Weekly for more great content from the F# community.

Xamarin

Azure

And more Azure links on Azure Weekly, by Chris Pietschmann.

Data

Games

And this is it for this week!

Contribute to the week in .NET

As always, this weekly post couldn’t exist without community contributions, and I’d like to thank all those who sent links and tips. The F# section is provided by Phillip Carter, the gaming section by Stacey Haffner, and the Xamarin section by Dan Rigby.

You can participate too. Did you write a great blog post, or just read one? Do you want everyone to know about an amazing new contribution or a useful library? Did you make or play a great game built on .NET? We’d love to hear from you, and feature your contributions on future posts:

This week’s post (and future posts) also contains news I first read on The ASP.NET Community Standup, on Weekly Xamarin, on F# weekly, and on Chris Alcock’s The Morning Brew.

Docker on a Synology NAS - Also running ASP.NET and .NET Core!

$
0
0

Docker on Synology is amazingI love my Synology NAS (Network Attached Storage) device. It has sat quietly in my server closet for almost 5 years now. It was a fantastic investment. I've filled it with 8TB of inexpensive Seagate Drives and it does its own flavor of RAID to give me roughly 5TB (which, for my house is effectively infinite) of storage. In my house it's just \\SERVER or http://server. It's a little GNU Linux machine that is easier to manage and maintain (and generally deal with) that just chills in the closet. It's a personal cloud.

It also runs:

  • Plex - It's a media server with over 15 years of home movies and photos. It's even more magical when used with an Xbox One. It transcodes videos that then download to my Windows tablets or iPad...then I watch them offline on the plane.
  • VPN Server - I can remotely connect to my house. Even stream Netflix when I'm overseas.
  • Surveillance Station - It acts as a DVR and manages streams from a dozen cameras both inside and outside the house, scanning for motion and storing nearly a week of video.
  • Murmur/Mumble Server - Your own private VOIP chat service. Used for podcasts, gaming, private calls that aren't over Skype, etc.
  • Cloud Sync/Backup - I have files in Google Drive, Dropbox, and OneDrive...but I have them entirely backed up on my Synology with their Cloud Sync.

51FvMne3PyL._SL1280_Every year my Synology gets better with software upgrades. The biggest and most significant upgrade to Synology has been the addition of Docker and the Docker ecosystem. There is first class support for Docker on Synology. There are some Synology devices that are cheaper and use ARM processors. Make sure you get one with an Intel processor for best compatibility. Get the best one you can and you'll find new uses for it all the time! I have the 1511 (now 1515) and it's amazing.

ASP.NET Core on Docker on Synology

A month ago Glenn Condron and I did a Microsoft Virtual Academy on Containers and Cross-Platform .NET (coming soon!) and we made this little app and put it in Docker. It's "glennc/fancypants." That means I can easily run it anywhere with just:

docker run glennc/fancypants

Sometimes a DockerFile for ASP.NET Core can be as basic as this:

FROM microsoft/aspnetcore:1.0.1
ENTRYPOINT ["dotnet", "WebApplication4.dll"]
ARG source=.
WORKDIR /app
EXPOSE 80
COPY $source .

You could certainly use Docker Compose and have your Synology running Redis, MySql, ASP.NET Core, whatever.

Even better, since Synology has such a great UI, here is Glenn's app in the Synology web-based admin tool:

Docker on Synology - Node and ASP.NET Core Apps 

I can ssh into the Synology (you'll need to SSH in as root, or you'll want to set up Docker to allow another user to avoid this) and run docker commands directly, or I can use their excellent UI. It's really one of the nicest Docker UIs I've seen. I was able to get ASP.NET Core and the Node.js Ghost blog running in minutes with modest RAM requirements.

image

Once Containers exist in Docker on Synology you can "turn them on and off" like any service.

ASP.NET Core on Docker on Synology

This also means that your Synology can now run any Docker-based service like a private version of GitLab (good instructions here)! You could then (if you like) do cool domain mappings like gitlab.hanselman.com:someport and have your Synology do the work. The Synology could then run Jenkins or Travis as well which makes my home server fit nicely into my development workflow without use any compute resources on my main machine (or using any cloud resource at all!)

The next step for me will be to connect to Docker running on Synology remotely from my Windows machine, then setup "F5 Docker Debugging" in Visual Studio.

image

Anyone else using a Synology?

* My Amazon links pay for tacos. Please use them.


Sponsor: Big thanks to Octopus Deploy! Do you deploy the same application multiple times for each of your end customers? The team at Octopus have taken the pain out of multi-tenant deployments. Check out their latest 3.4 release!


© 2016 Scott Hanselman. All rights reserved.
     

VS Team Services Update – Nov 28

$
0
0

This week we are deploying our sprint 109 payload.  You can read the release notes for details.

There’s a few things I’m particularly excited about.

Build task versioning– We had a live site incident a few months ago because we rolled out an update to a build task on our hosted pools and it broke pretty much everyone’s builds.  That caused me to go dig in a bit to understand how we were managing validation and rollout of build tasks.  What I learned is that we really just didn’t have a sufficient mechanism to manage this.  With this deployment, we are rolling out a new build task versioning capability that enables an author to rollout a new version of their task without affecting people currently using their task.  Specifically, we introduced the notion of major and minor versions of tasks.  You can lock your build definition to a major version.  An author can create a new major version without affecting existing builds.  Build definitions can be updated to the new major version when ready to test it.  You cannot currently disable minor version updates.  The primary reason is we want, for instance, a way to forcibly push security fixes, etc.  We’re still exploring options for further lock down for very controlled environments.

Following a pull request– We added following work items a while back and now we have following pull requests.  I’ve found that to be an awesome way to track a PR conversation.

Linux hosted build pool– I’m really excited to be providing 1st class Linux support – including Docker.

As I mentioned last time, this is our last deployment for 2016.  This deployment should finish up by Dec 2nd.  We will skip the sprint 110 deployment (because it would run into Christmas) and pick back up with the 111 deployment in mid January.

Thanks,

Brian

 

APIs for Developers Series - Bing Search APIs

$
0
0
Coming out of the MVP Global Summit 2016 earlier this month, we were happy to see the excitement and enthusiasm around our Bing Search APIs and how they could help enhance our partners’ experiences. To broaden this conversation, we’ve created this series where we’ll delve into the details of the Bing APIs to answer any unknowns and help you get started.

In this blog post we will discuss some of the new additions to the Bing Search APIs and show how they can be lit up in new scenarios to help enrich your apps and experiences.

For those unfamiliar, Bing Search APIs (including Web Search, Image Search, Video Search, News Search as one collection) give developers the ability to bring the knowledge and intelligence of web search right into their experiences, and intelligence is always at the forefront of our conversations with partners.

Built on the same technology stack as Bing.com, developers benefit from the security, scalability, relevance and ranking improvements that hundreds of millions of monthly users rely on. We are committed to supporting this ecosystem and will be pushing out regular feature improvements as part of the API lifecycle on an ongoing basis with a new version planned every 12 months.

This collection of APIs is also a great starting point for developers creating mobile apps. They are REST APIs that follow the latest structured data standards (Schema.org, JSON-LD), making them easy to implement and allow your users to find relevant results from billions of webpages, images, videos and news with one call and a few lines of code.

Bing Web Search API

With the Bing Web Search API, you can provide search results for billions of web pages, images, videos and news with a single API call.  Web results include the most commonly clicked links on the destination website. These deep links help users complete their tasks more quickly and navigate to where they want to go with one click. The news answer, image answer, video answer and related searches are also part of the API.
 


For example, app developer WildWorld uses the intelligence of the Bing APIs to power search for their online social-shopping community where people passionate about outdoor recreation can browse users’ photos, identify the tagged products, and then search for them online at the best prices. The scalability of the Bing APIs helps WildWorld deliver the comprehensive and relevant results their users expect and need.

Other Bing Web Search API features include the adult intent signal to help determine if a query will deliver adult content and customize the safe search level of the results, filtered answers, pagination, bolding, query alteration and spell suggestions where commonly misspelled terms are automatically corrected.

Bing Image Search API

The Bing Image Search API offers powerful image search capabilities and can provide results that span from a narrow search topic to trending images to visually similar images and more. Extra filters and parameters are available, such as size, license, style, freshness, and color. The license filter helps users find images in the public domain or under licenses that permit them to use the image.

Image insights allow you to get deeper information about a specific image based on machine learning and entity recognition. Safe search is another powerful feature that allows you to adjust image insight settings to help filter out inappropriate search results, such as explicit adult and racy content.


 
There are also new features such as merchants and recipes that expose a list of retailers that sell a given product in an image. With images of food, we have tagged a number of different sources where there is a recipe with instructions on how to make that specific item.

These updates open up a lot of new scenarios. Mobile app maker Cardinal Blue is taking advantage of the flexibility, power and safe search capabilities of the Bing Image Search API in their PicCollage app, which allows users to combine their photos, videos, captions, stickers and special effects to create unique collages and images to share with friends.

Bing Video Search API

With the Bing Video Search API, you can add advanced video search features, including video previews, trending video results, filters for free or paid options and other useful metadata, such as creator, encoding format, video length and view count.



Motion thumbnails (i.e., video preview) are a new addition that help drive engagement. You can create an experience for your users that is similar to Bing.com where they can view a short preview of a video by hovering over the thumbnail. As a result, users may stay longer as they preview the results, and this feature helps them quickly find the video they are looking for.

 
Bing News Search API

The Bing News Search API allows you to help users find relevant news results by topic, geographical location and rich article metadata. News articles can be searched by category/market and trending news (top results in the relevant topic).



Bing Search API is another example of how we at Bing are continuing to build and improve APIs that allow developers to harness knowledge and intelligence around the web for their users.

To get started for free or purchase via Azure, please visit the Bing for Partners website. If you have feedback or questions about our APIs, please comment on Bing Listens.

- The Bing Team
 

Evolving the Test Platform – Part 3: .NET Core, convergence, and cross-plat

$
0
0

[This is the 3rd post in the series on evolving the Visual Studio Test Platform. You can read the earlier posts here:
Evolving the Visual Studio Test Platform – Part 2,
Evolving the Visual Studio Test Platform – Part 1]

As .NET Core draws an ever-growing community of developers with existing assets and experiences, it is essential to support a consistent tools ecosystem. Thus, the “alpha” release of the MSBuild-based .NET Core Tools shipping with Visual Studio 2017 RC introduces support for the MSBuild build system and the .csproj project format – both familiar and key components of the .NET tools ecosystem. The need for a consistent testing experience follows naturally. Thus, the .NET Core testing experience/ecosystem is now converged with the Visual Studio Test Platform.

Concretely, this means the following:
(1) Evolved test platform: vstest is now fully cross-plat (Windows/Linux/Mac). dotnet test now leverages this evolved Visual Studio Test Platform.
(2) Converged adapters: Adapter writers can maintain a converged adapter that can serve Visual Studio, the vstest.console.exe CLI and the dotnet CLI.
(3) Converged user experience: the experience of using vstest.console.exe (the same options and capabilities) on the .NET Framework will be available on .NET Core as well.

Let’s see how …

Evolved test platform

The evolved vstest engine is presently named Microsoft.TestPlatform.V2 and is packaged as a vsix extension. Launch Tools | Extensions and Update… and you will notice that this is already bundled with Visual Studio.

5
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions is the folder where extensions are installed.

Converged Test Adapter for .NET Framework and .NET Core

When we first introduced MSTest V2 support there were 2 adapters – dotnet-test-mstest to target .NET Core, and MSTest.TestAdapter to target the .NET Framework. The dotnet-test-mstest adapter understands the project.json based project format. With .NET Core now supporting .csproj, that adapter is no longer required! Instead, the MSTest.TestAdapter can be used!

Launch Visual Studio 2017 RC, and create a Unit Test Project (.NET Core). This creates an MSTest V2 based solution targeting .NET Core. Now, look at the references.

1

The solution is self-contained – it refers the vstest engine, the MSTest V2 test framework, and the MSTest.TestAdapter to discover/run such tests using the engine. And it is targeting .NET Core.

The same approach can be used by other test frameworks as well. For e.g., xUnit.net too has 2 adapters – dotnet-test-xunit to target .NET Core, and xunit.runner.visualstudio to target the .NET Framework, but with .NET Core now supporting .csproj, the dotnet-test-xunit is no longer required either. Instead, the xunit.runner.visualstudio adapter can be used. Here is a .NET Core unit test solution using the xUnit.net test framework:

2

The solution is self-contained – it refers the vstest engine, the xUnit.net test framework, and the xunit.runner.visualstudio test adapter to discover/run such tests using the engine. This same adapter is used when targeting both the .NET Framework and .NET Core.

[Note: the evolved test platform has the notion of a translation layer that enables interfacing with IDEs to perform common tasks like discover tests, run tests, get the results to display, etc. This will be released soon on NuGet. In the meantime, we worked closely with the xUnit.net team to implement this support using early bits. We look forward to working with the community to extend this support.]

Let’s continue with this solution in our brief tour of the functionality.

Testing using the Visual Studio IDE

The below figure illustrates testing from within the Visual Studio IDE.

34new

This is same experience provided in the case of tests targeting the.NET Framework.

Testing using vstest.console.exe

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions is the folder where extensions are installed, remember? Locate vstest.console.exe under this folder.
Navigate to the folder containing the xUnit.net test project, and use vstest.console.exe to run the tests as shown:6newNotice that vstest.console.exe takes the DLL(s) as input – just like it does in the case of tests targeting the .NET Framework. Go ahead, try this out and see what other switches can be used!

Testing using the .NET Core CLI

You can try these steps with latest dotnet-cli builds, since a critical bug fix couldn’t make it to RC release.
Install the latest .NET Code SDK Preview build from here:  https://github.com/dotnet/core/blob/master/release-notes/preview3-download.md. I downloaded it to the folder D:\temp\dotnet on my machine.
Use dotnet test to run the tests as shown:7new
The command automatically picks up the .csproj file(s) and discovers and runs the appropriate tests using the referenced xunit.runner.visualstudio adapter.

Testing using VSTS

To run the tests using VSTS, I setup a local build agent with Visual Studio 2017, and these same .NET Core SDK bits.
Here is the build definition:8new

Queue up a build and you should see the report.9new

Summary

The .NET Core testing experience/ecosystem is now converged with the Visual Studio Test Platform. This is a huge benefit to everyone – same adapters, common invocation model, much broader feature set than CLI). As mentioned earlier, we will release the translation layer to NuGet soon, and look forward to working with you to get more adapters interfacing with the test platform.

Stay tuned!

Increasing the size limit of Sitemaps file to address evolving webmaster needs

$
0
0

For years, the sitemaps protocol defined at www.sitemaps.org stated that each sitemap file (or each sitemap index file) may contain no more than 50,000 URLs and must not be larger than 10MB (10,485,760 bytes). While most sitemaps are under this 10 MB file limit, these days, our systems occasionally encounter sitemaps exceeding this limit. Most often this is caused when sitemap files list very long URLs or if they have attributes listing long extra URLs (as alternate language URLs, Image URLs, etc), which inflates the size of the sitemap file.

To address these evolving needs, we are happy to announce that we are increasing sitemaps file and index size from 10 MB to 50MB (52,428,800 bytes).
  Webmasters can still compress their Sitemap files using gzip to reduce file size based on the bandwidth requirement; however, each sitemap file once uncompressed must still be no larger than 50MB. The update file size change is now reflected in the sitemap protocols on www.sitemaps.org.

This update only impacts the file size; each sitemap file and index file still cannot exceed the maximum of 50,000 URLs ( attributes).

Having sitemaps updated daily, listing all and only relevant URLs is key to webmaster SEO success. To help you, please find our most recent sitemaps blog posts

·         Sitemaps Best Practices Including Large Web Sites

·         Sitemaps – 4 Basics to Get You Started

 
Fabrice Canel
Principal Program Manager
Microsoft - Bing

Live Dependency Validation in Visual Studio 2017

$
0
0

Last month we announced that Visual Studio “Dev15” Preview 5 now supported Live Dependency Validation. In this blog post,

On demand video about dependency validation

During the connect 2016 event, we’ve proposed an on-demand video which explains in detail why you’d want to use Dependency Validation and how to do so Validate architecture dependencies with Visual Studio. The video contains a quick review of the topic – unwanted dependencies are part of your technical debt. Then I remind you of what the experience was in previous versions of Visual Studio Enterprise, and show how this could be improved, I demo the new-real time dependency validation experience that you, as a developer, will benefit from in Visual Studio 2017. I also demo how easy it is to create a dependency diagram. Finally, I describe how users using the current experience can migrate to the new one
I encourage you to watch this 10 mins video, which will give you a good overview of the scenario and the feature.

Updates on the experience improvements

The demos in the video were done with Visual Studio 2017 RC. We had fixed a number of bugs since “Preview 5” and improved the user experience:

  • When upgrading projects to enable live validation, a dialog now expresses progress,
      clip_image001
  • When updating a project for live dependency validation, the version of the NuGet package is now upgraded to be the same for all projects (and is the highest version in use),
  • VB.NET is now fully supported on par with C#,
  • The addition of a new Dependency Validation project now triggers a project update,
  • The dependency validation Roslyn analyzer is now better:
    • It’s less verbose as we no longer report when you declare an implicitly-typed variable (var in C#). Because the type of the variable is guaranteed to be the same as the type on the right-hand side we were effectively reporting the same error twice
    • It now reports on delegate invocations.
  • You are now advised to enable “full solution analysis” when using live dependency validation: a gold bar appears in the Error List, and opens the options page pointing you at the option to enable or disable the “full solution analysis” (for C#, and VB). You can permanently dismiss this gold bar if you are not interested in seeing all the architectural issues in your solution.
    clip_image003 
    If you don’t enable “full solution analysis” the analysis will only be done for the files being edited (this behavior is common to all Roslyn analyzers).

Known issues

We were not able to fix everything for RC but we are still working on it. The experience will be even better for RTW. In Visual Studio 2017 RC:

  • saving a dependency Validation diagram no longer triggers the analysis. This is annoying because if you want to see immediately the effect on the issues in the code, of changing the diagram, the only workaround is to close and reload the solution.
  • the experience is not very good when you enable the “Lightweight Solution load” option.
  • deleting a dependency validation diagram does not remove the corresponding links from C# and VB projects.

These have all been fixed for RTW.

Real time Dependency Validation error messages

It’s now possible to click on the error code for a dependency validation error message and get an explanation of the issue. The figure below shows the default severity of the rules in the ruleset editor

clip_image005 For your convenience, I’ve summarized, in the table below, in which condition you will have which error.

Error Code

When is it reported?

DV0001

Invalid Dependency. This issue is reported when a code element (namespace, type, member) mapped to a Layer references a code element mapped to another layer, but there is no dependency arrow between these layers in the dependency validation diagram containing this layers. This is a dependency constraint violation

DV1001

Invalid namespace name. This issue is reported on a code element associated with a layer which “Allowed Namespace Names” property does not contain the namespace in which this code element is defined. This is a naming constraint violation.

Note that the syntax of “Allowed Namespace Names” is to be a semi-colon list of namespaces in which code elements associated with are layer are permitted to be defined.

DV1002

Dependency on unreferenceable namespace. This issue is reported on a code element associated with a layer and referencing another code element defined in a namespace which is defined in the “Unreferenceable Namespace” property of the layer. This is a naming constraint violation.

Note that the “Unreferenceable Namespaces” property is defined as a Semi-colon separated list of namespaces that should not be referenced in code elements associated with this layer

DV1003

Disallowed namespace name. This issue is reported on a code element associated with a layer which “Disallowed Namespace Names” property contains the namespace in which this code element is defined. This is a naming constraint violation.

Note that the “Disallowed namespace name” property is defined as a Semi-colon separated list of namespaces in which code elements associated with this Layer should not be defined.

Differences between Layer validation in Visual Studio 2010-2015 and Live Dependency Validation in Visual Studio 2017

Old layer validation issues vs new Dependency Validation issues

As we have explained last month, the Dependency Validation experience leverages the existing Layer diagram format with some improved terminology for the layer properties. The error messages generated by the Roslyn analyzers are similar, but we have used different error code because the results can be slightly different. The old issues have an error code starting with AV (Architecture Validation errors) whereas the new issues have an error code starting with DV (Dependency Validation errors).

Why can there be differences?

To be fair, you might not notice these differences, however, there is a case where you will. This is the case where you have a Visual Studio 2015 solution where you had enabled the legacy Layer validation. Then you migrate this solution, with Visual Studio 2017 Enterprise, to enable live dependency validation. You commit you changes. Later if you, or someone in your team, opens this solution with Visual Studio 2015, and build it, Visual Studio 2016 will start showing both the old issues (AV) and the new issues (DV). In most cases, they will be the same, but not always, so we thought it would be good to explain a bit more about the differences. The underlying reason for these differences is that the legacy validation (Layer) was being performed against the binary code, whereas the new validation is performed against source code. In the same way that you sometimes must add a reference to an assembly declaring a base interface for a class you use (whereas you don’t yourself reference this base interface), the compiler sometimes generates constructs which are not effectively used, but were drawing a dependency in binary, which is not visible in source code. So, the binary caught legacy validation issues which logically should not be there, whereas the new real time dependency validation won’t. This is a bit subtle, and cases are quite rare. (One case I met is when calling a method passing as a parameter a delegate which had an offending return type).

What dependency issues are caught in Live Dependency Validation?

Live Dependency Validation for assemblies, types, and namespaces is pretty simple: either they are allowed or they are disallowed. The case of generic types is more complex, but makes sense: it’s enough to have at least one unwanted generic type argument to report an issue on the generic type.

As far as members are concerned:

  • Method declarations: we check the return type and the parameter types
  • Method invocations:
    • we check the parent type of the method being called
    • we check the return type, even if it is ignored i.e. is not assigned to anything
    • we do not check the types of parameters to a method
    • However, we do check the values of arguments that are passed to a method. This means that if you pass an object which type is not allowed by at least one of the dependency diagrams in the solution, you will get an error. You won’t, however get an error if you pass null.
  • Property reads and writes: we check the containing type and the return type i.e. they are a kind of method invocation
  • Fields: we check the field type

For delegates, things get a little more complicated as sometimes we want to validate them as if they were a type, in others we want to validate them as is they were a method invocation.

Tips to author a Dependency Validation diagram

I’ll finish this blog post by sharing a tip on how to author Dependency Validation diagrams. You can, of course, add layers though the toolbox and map them to code elements using the Layer Explorer. But if you have an existing solution, you can do it quicker by Dragging and from Visual Studio explorers and dropping to a Dependency Validation Diagram. You might not know though that this can also be done by Copy/Paste or Drag and Drop from a Code Map

Drag and Drop from explorers

As shown in the video, a recommended way to add layers to a dependency validation diagram is to drag and drop assemblies, references, types and members from the solution explorer, the Class View or the Object Browser. It’s also possible to drag and drop namespaces from the Class View or the Object Browser (they are the only explorers showing namespace).

Drag and Drop or Copy / Paste from a Code Map

You might also be interested in creating a Dependency Validation diagram as corresponds to the solution. To do that you can:

  • Generate a Code Map for Solution (from the Architecture menu)
  • Personally, I use the Code Map Filter Windows to filter out solution folders and “Test Assets” (as I mostly care so about enforcing dependencies in product code).
  • On the generated Code map, you may also remove the “External” node (or expand it to show external assemblies) depending on what you want to do. In the figure below I removed “External”. If you are interested in enforcing namespace dependencies as I did, you can expand the assemblies you care about (delete the other ones from the Code Map)
  • Then finally when you are happy that you have the content you care about on Code Map, you can create a new Dependency Diagram (from the Architecture menu) select all the nodes from the Code Map (either by Ctrl+A, or by the rubber band selection, which you trigger by pressing the shift key before you click / drag / release the selection), and do a drag and drop or a copy paste to the new Dependency Validation diagram. You will (in RTM, and after doing a bit of manual layout) get the diagram as in the picture below.
  • Note that in Visual Studio 2017 RC, you’ll need to press the Shift key to get one layer per Code Map node when doing the drag and drop. And you won’t see the dependencies. This was fixed for RTM.
  • From there you have the current architecture, and you can decide what you want the architecture to be and modify the Dependency Validation diagram accordingly

clip_image007

In closing

As usual we’d love to hear your feedback. Don’t hesitate to send feedback directly from Visual Studio (Help | Send Feedback) to report a problem or provide a suggestion.


I suck at vacation - What I did this week

$
0
0

Well, it seems I'm lousy at vacation. I'm still learning what I'm supposed to do. My wife is working and the kids are still in school so here was my week.

3D Printed Brackets for my new HTC Vive

I treated myself to an HTC Vive Room-Scale VR system. I'll blog extensively about this later but let me just tell you. It's AMAZING. I've used Google Cardboard, I've used Gear VR, I've used Oculus. Vive is it. Full Room-scale VR with something like the Doom 3 VR Mode is amazing. This fellow has a version of Doom 3 coded up at GitHub that modifies your existing purchased version and adds a REALLY compelling VR experience. I will say spent less time fighting demons and more time looking closely at wall textures. I admit it.

There's a joke about folks who have 3D Printers. We just end up printing brackets to hold stuff.  Well, I got a Vive so I wanted a nice way to mount it. Problem solved.

I dig #3Dprinting because you can make EXACTLY the brackets you need in a few hours!

A photo posted by Scott Hanselman (@shanselman) on

3D Printed a Rifle Stock for the Vive

There's a popular VR game called Onward. It's basically a Call of Duty-type squad shooter with a focus on squad teamwork and realism. However, holding two VR controllers up to your cheek and pretending they are a rifle doesn't really work. Fortunately an intrepid maker named SGU7 made a prototype you can 3D Print.

I made one first in Yellow but it broken because it lacked enough infill. I made it again in black (because I had a lot of black. I wish it looked less aggressive, though) and it works great. Note that the part in my hand is a controller and the other controller is attached to the front. The front one can pop off and act as your left hand to reload and throw grenades.

It was a challenging print with five large pieces and two small along with screws and nuts to hold it together. However, it was super fun and it makes the game WAY more realistic. More on this later. I've also been experimenting with some new exotic filaments.

37b7b79b793db7b489b50496b1f5787a_preview_featured

Made an AdaFruit Cupcade Raspberry Pi MAME Arcade

My teenage nephew and I worked on a Cupcade a few months ago but it was his. I 3d printed and made a PiGrrl (Raspberry Pi GameBoy) last year, so I figured I'd make a Cupcade (Raspberry Pi tiny Multi-Arcade Machine Emulator) as well. It's also somewhat challenging but I never really had the time until vacation. You can get the plans and source many of the parts locally, or you can get a complete kit from Adafruit. I did the partial kit for cheaper without the plastic case, then had a local makerspace lasercut a $5 piece of clear acrylic.

Set up Alexa to talk to my Nightscout-based Blood Sugar system

I got a few Amazon Alexa "Echo Dot" devices, so now we have three around the house. I upgraded my Nightscout Site (this is the Azure-based system that that allows remote management and viewing of my blood sugar as a Type 1 Diabetic.

The most recent update of Nightscout added Alexa support. I headed over to https://developer.amazon.com and made a dev account and got it all working. It's pretty slick. I can ask it all kinds of things (as can my kids. They love to know about how I'm doing when I'm out of town.)

image

Here's a video of it working!

"Alexa, what's my blood sugar?" #Diabetes @nightscoutproj #video

A video posted by Scott Hanselman (@shanselman) on


Basically I've been just making stuff and fixing stuff around the house. I even sat in a café and read the news. Madness.

I wonder if I could do this full time? I guess that's called retirement. ;)


Sponsor: Big thanks to Octopus Deploy! Do you deploy the same application multiple times for each of your end customers? The team at Octopus have taken the pain out of multi-tenant deployments. Check out their latest 3.4 release



© 2016 Scott Hanselman. All rights reserved.
     

What’s new in Git for Windows 2.11?

$
0
0

Git for Windows v2.11.0 is out! Download it here (homepage is here).

The new version corresponds to Git v2.11.0 (release notes are here, and our friends over at GitHub blogged about it, too). Apart from the improvements inherited from the “upstream Git” project, Git for Windows also updated some libraries to address security concerns, and dropped support for Windows XP.

Performance improvements

The new Git version features speed improvements all over the place. It is my pleasure to say that some of these improvements originate in the Git for Windows project itself, such as the acceleration of git rebase‘s startup phase by making the patch ID generation smarter.

A few more speedups went into Git for Windows specifically

Even if Git for Windows does not ship with Git LFS (due to size concerns), the new Git for Windows has support for substantially faster clones when using many binary files managed by Git LFS.

Experimental, faster difftool

One of the factors contributing to Git for Windows “feeling” slower than, say, Git on Linux, is the fact that some Git functionality is actually not implemented in native code, but as shell or Perl script. As neither a shell nor a Perl are provided by default in a regular Windows setup, Git for Windows ships with a “pseudo POSIX” environment called MSYS2 (which is in turn based on Cygwin). The need for this POSIX emulation layer slows things down considerably.

That is the reason why the Git for Windows converts scripted parts into native code, as was done with the interactive rebase in Git for Windows v2.10.

In Git for Windows v2.11, there is now a difftool that is a “builtin”, i.e. native code. As the new builtin difftool needs more wide-spread testing, it is an opt-in feature; by default, git difftool will still call the original script.

Visual Studio support

By far the most effort in the v2.11 cycle has gone into building Git for Windows’ master branch with Visual Studio. In fact, there are two ways to build via Visual C: using the command-line, and in Visual Studio. Both options work using Visual Studio’s Community edition, by the way.

I would like to indulge in enumerating just a couple of the goodies now available to us:

  • Code navigation! The Ctrl+, keyboard shortcut to navigate to declarations, definitions, and files, is easily my most favorite tool here.
  • Refactoring tools! Visual Studio comes with a couple of functions that make refactoring much more painless.
  • Debugging! Visual Studio’s integrated debugger offers nifty features such as inspecting code, single-stepping, and hot-patching changed code. It is hard not to love having those options.
  • Profiling tools! These tools already helped identify a couple of bottlenecks.

It was far from easy to get to that point, and I cannot thank enough all the people involved with this effort, in particular Jeff Hostetler and Philip Oakley, for their tenacity and code contributions. Git for Windows already had a script to generate Visual Studio project definitions since 2009, with a recent effort to bring the script up-to-date and to fix Git’s source code to build correctly.

The official Git for Windows will still be built with GNU C (“GCC”), simply because you should never change a winning team. Oh, and the Git project itself uses GCC, too, hence we avoid battling unnecessary fights by sticking to GNU C for the official releases.

But it is really nice to have the option to simply clone, check out the vs/master branch, immediately start playing with the source code, and then run the test suite from a regular Git Bash (no Git for Windows SDK required).

A New Input Paradigm in Windows – The Surface Dial

$
0
0

With the debut of Windows Ink in the Windows Anniversary Update, we introduced simultaneous pen and touch as the dawn of a revolutionary change in interacting with Windows. In our blog post, we discuss how you can use the APIs that you are already familiar with for touch to handle both touch and pen processing at the same time. Now with the recent Microsoft hardware announcements, we’re happy to share another innovation in input with you – the Surface Dial.

picture1

The Surface Dial introduces a new paradigm for input in Windows. The Surface Dial is a new category of input device, which we refer to as a radial controller, and is a revolutionary new tool for the creative process. With tools and shortcuts at your fingertips, the Surface Dial allows you to remain focused on what matters most. You can manipulate images, adjust volume, change color hues and much more, all with simple gestures. With the Surface Dial in one hand and Surface Pen in the other, the creative process is made more productive and more enjoyable. Additionally, you can place your Surface Dial directly on the screen of the Surface Studio and have favorite tools – like a color picker or ruler – at hand and easily accessible on your digital drafting table.

When paired over Bluetooth with a Windows 10 Anniversary Update PC, the Surface Dial delivers a breadth of new experiences to users and opens a world of possibilities. The goal of this blog is to walk you through how you can build your own experiences on the Surface Dial in your application.

Introducing the Radial Controller

For Windows, the Surface Dial represents a totally new type of input device in the system, which we refer to as a radial controller. To go along with this brand-new type of input, Windows has delivered an integrated experience that makes it easier and faster for users to customize and do the things they love – all with a turn of the Dial.

The Surface Dial has a simple set of gestures: It can be rotated, it can be pressed like a button and it can be placed on the screen of the Surface Studio. These gestures are instantly familiar to users and easy to learn. When you press and hold the Surface Dial, a menu experience shows up that presents a selection of tools that can be controlled. These tools offer a variety of functions designed to improve the user’s workflow and keep them immersed in their creativity – from scrolling and zooming, changing volume and controlling media playback, undo and redo, custom keyboard shortcuts and more. It also integrates further with a broad and growing set of in-box and 3rd party apps, unlocking new tools when used with the Windows Ink Workspace, Office, Maps, Groove Music, Sketchable, Bluebeam Revu, Moho 12, Drawboard PDF and more. With the Surface Dial, unlocking new functions for users across every Windows app, they’ll be excited to explore how the Dial can help them in their favorite apps. With the extensibility available through the Windows universal platform, it’s easy for your app to bring that delightful Surface Dial experience they’re searching for!

The first and simplest way to add value with Surface Dial is to use Windows inbox components that come with the Surface Dial integration built-in. For developers who leverage the Windows Ink platform to give their users the power to write, draw, and create with their pen, the InkCanvas and InkToolbar XAML controls populate the Surface Dial’s menu with new tools, allowing users to quickly modify the attributes of their ink, change the thickness of their ink as they write and control the on-screen ruler. This gives you the same great Surface Dial integration available in the Sketchpad and Screen Sketch apps in the Windows Ink Workspace.

picture2

When the InkToolbar and InkCanvas are used, Surface Dial integration is automatically included!

picture3

When the on-screen ruler is visible, the Surface Dial can control its angle and position.

For media players, integrating with the SystemMediaTransportControls will give the same ability to pause, play and skip tracks with the Dial as Groove Music and Spotify.

For developers who want to go beyond the default integration built into the system and create something truly unique, Windows makes it easy for you to add your own tools to this menu through the RadialController platform. The RadialController universal APIs allow you to build your own custom tools for the Surface Dial’s menu and handle Dial input from both Universal Windows Platform apps and classic Win32 apps. You have the option to respond to the button and rotation input available on all Windows devices, or go one step further and build immersive UI experiences for when the Surface Dial is used on-screen on the Surface Studio.

Let’s start by looking at what it takes to build a custom tool experience for the Surface Dial!

Building a Custom Tool for the Surface Dial

Custom tools for the Surface Dial are the best way to deliver a deep and engaging Dial experience for your users. Since a custom tool is personal to your application’s needs, you can identify the shortcuts and functions that matter most to the user and put it right at the user’s fingertips. By optimizing the user’s workflow and integrating with the app’s UI, your custom tool can help the user stay engaged and feel more productive as they work, play, or create with Dial.

To start creating a custom tool for the Surface Dial, the first step is to create an instance of the RadialController interface used to represent the device and interact with the Surface Dial’s menu for the lifetime of your application. Through your instance of the RadialController, you can access the RadialControllerMenu, which gives you the ability to add and remove your own application-specific tools in the Surface Dial’s menu. The RadialController also gives you access to all the input events for the Surface Dial, allowing you to create compelling experiences for your custom tool.

Let’s take a look at building a custom tool inside a sample application. Here we’ll start with a simple inking application using the InkCanvas and InkToolbar controls, which already provide Surface Dial integration for modifying inking attributes and the ruler.

Now, let’s add deeper integration with the RadialController APIs and have the Surface Dial control the color of our background. We’ll start by adding a custom tool to the menu:


        RadialController myController;

        public MainPage()
        {
            this.InitializeComponent();
            UpdatePreview();
            highlightedItem = RValue;

            //Hide our custom tool's UI until it is activated by the Dial
            ToolPanel.Visibility = Visibility.Collapsed;

            // Create a reference to the RadialController.
            myController = RadialController.CreateForCurrentView();

            // Create a menu item for the custom tool.
            RadialControllerMenuItem myItem =
              RadialControllerMenuItem.CreateFromKnownIcon("Background", RadialControllerMenuKnownIcon.InkColor);

            //Add the custom tool's menu item to the menu
            myController.Menu.Items.Add(myItem);

            //Create a handler for when the menu item is selected
            myItem.Invoked += MyItem_Invoked;

            //Create handlers for button and rotational input
            myController.RotationChanged += MyController_RotationChanged;
            myController.ButtonClicked += MyController_ButtonClicked;

            //Remove Scroll/Zoom/Undo tools as app doesn't support them
            RadialControllerConfiguration config = RadialControllerConfiguration.GetForCurrentView();
            config.SetDefaultMenuItems(new RadialControllerSystemMenuItemKind[] { RadialControllerSystemMenuItemKind.Volume });

            …
        }

        #region Handling RadialController Input
        private void MyItem_Invoked(RadialControllerMenuItem sender, object args)
        {
            //Make RGB panel visible when the custom menu item is invoked
            ToolPanel.Visibility = Visibility.Visible;
        }

picture4

Since we used the InkToolbar, the menu comes pre-populated with inking tools!

picture5

You can see the new tool we added

The RadialController API provides simple events for handling the input coming from the Dial, from button click, to rotation to the on-screen position. In the previous snippet, we set event handlers for the RotationChanged and ButtonClicked input events from the Surface Dial. Using these events, we can have the input from the Dial modify the red, green, or blue values of our background:


    Slider selectedItem = null;
        FrameworkElement highlightedItem = null;

        private void MyController_ButtonClicked(RadialController sender, RadialControllerButtonClickedEventArgs args)
        {
            if(highlightedItem == Preview)
            {
                //Click on the Preview, update the background
                UpdateBackground();
            }

            else if (selectedItem != null)
            {
                //Click on a selected slider, unselect the slider
                selectedItem = null;
                UpdateHighlight(highlightedItem);
                //decrease sensitivity to make it more comfortable to navigate between items
                myController.RotationResolutionInDegrees = 10;
            }

            else if (selectedItem == null)
            {
                //No selection, select a slider
                UpdateSelection(highlightedItem as Slider);
                //increase sensitivity to make it easier to change slider value
                myController.RotationResolutionInDegrees = 1;
            }
        }

        private void MyController_RotationChanged(RadialController sender, RadialControllerRotationChangedEventArgs args)
        {
            if (selectedItem != null)
            {
                //Change the value on the slider
                selectedItem.Value += args.RotationDeltaInDegrees;
                UpdatePreview();
            }
            else if(args.RotationDeltaInDegrees > 0)
            {
                //Rotation is to the right, change the highlighted item accordingly
                if (highlightedItem == RValue)
                {
                    UpdateHighlight(GValue);
                }
                else if (highlightedItem == GValue)
                {
                    UpdateHighlight(BValue);
                }
                else if (highlightedItem == BValue)
                {
                    UpdateHighlight(Preview);
                }
            }
            else if (args.RotationDeltaInDegrees < 0)
            {
                //Rotation is to the left, change the highlighted item accordingly
                if (highlightedItem == GValue)
                {
                    UpdateHighlight(RValue);
                }
                else if (highlightedItem == BValue)
                {
                    UpdateHighlight(GValue);
                }
                else if (highlightedItem == Preview)
                {
                    UpdateHighlight(BValue);
                }
            }
        }

        private void UpdateHighlight(FrameworkElement element)
        {
            StackPanel parent;

            //Remove highlight state from previous element
            if (highlightedItem != null)
            {
                parent = highlightedItem.Parent as StackPanel;
                parent.BorderThickness = new Thickness(0);
            }

            //Update highlight state for new element
            highlightedItem = element;

            parent = highlightedItem.Parent as StackPanel;
            parent.BorderBrush = new SolidColorBrush(Windows.UI.Colors.Black);
            parent.BorderThickness = new Thickness(2);
        }
        
        private void UpdateSelection(Slider element)
        {
            selectedItem = element;

            //Update selection state for selected slider
            StackPanel parent = element.Parent as StackPanel;
            parent.BorderBrush = new SolidColorBrush(Windows.UI.Colors.Cyan);
            parent.BorderThickness = new Thickness(4);
        }
        
        private void UpdatePreview()
        {
            Windows.UI.Color selectedColor = new Windows.UI.Color();
            selectedColor.A = 255;
            selectedColor.R = (byte) RValue.Value;
            selectedColor.G = (byte) GValue.Value;
            selectedColor.B = (byte) BValue.Value;

            Preview.Background = new SolidColorBrush(selectedColor);
        }

        private void UpdateBackground()
        {
            CanvasGrid.Background = Preview.Background;
        }

picture6

When our custom tool is selected, the tool UI becomes visible. Rotation navigates the menu, and clicking a color value allows you to change it.

picture7

When you’ve found a color that you like, clicking on the preview image will change the background color to the one you’ve customized.

In addition to configuring how rotation interacts with the application, the RadialController APIs also give the ability to modify how rotation is delivered to your app and felt by the user. You can use the RotationResolutionInDegrees property to configure how fine the sensitivity or resolution is, and the UseAutomaticHapticFeedback property to set whether haptic feedback is enabled or disabled. In the previous example, setting the rotation to be more sensitive when changing one of the RGB values made much it easier to manipulate the slider. When not specified, the default value for rotational sensitivity is 10 degrees.

Handling On-Screen Input for Surface Studio

As we called out above, there are 2 modes which a radial controller device can be used in: off-screen and on-screen. When the Surface Dial is placed on the screen of the Surface Studio, the RadialController API gets the location and the bounds of the contact so that you can build richer and more immersive experiences for the user.

Using the Surface Dial’s on-screen position, you can build beautiful UI which centers around the Dial and gives the user richer information about the interactions that they can drive with the Dial. This allows the user to just focus on the control and placement of their hands and not have to worry about other additional menus or controls. As an example of this, take a look at the rich color palette developed by the engineers at Sketchable, or the quick insert menu developed by StaffPad which allows users to quickly add common musical notation markups.

picture8picture9

Going one step further, you also can get context for the intent of the user’s interaction from the on-screen position which can help make your custom tools more compelling. You can see this in the way the Surface Dial guides and drives the on-screen ruler in the Windows Ink Workspace’s Sketchpad, and the engineers at Bluebeam and Drawboard take this same approach with their respective Split Zoom and Ruler features.

Working from the previous example, let’s take advantage of the on-screen position to make it easier for the user to see the results of their color change manipulations, and draw the relevant UI near our Surface Dial’s on-screen position instead of in the corner of the display. Using the ScreenContact* events, we can determine where the Surface Dial is and update our UI accordingly:


  bool isRightHanded;

        public MainPage()
        {
            …

            //Query the user’s handedness
            Windows.UI.ViewManagement.UISettings settings = new Windows.UI.ViewManagement.UISettings();
            isRightHanded = settings.HandPreference == Windows.UI.ViewManagement.HandPreference.RightHanded;

            //Create handlers for when RadialController provides an on-screen position
            myController.ScreenContactStarted += MyController_ScreenContactStarted;
            myController.ScreenContactContinued += MyController_ScreenContactContinued;
            myController.ScreenContactEnded += MyController_ScreenContactEnded;

        }

        private void MyController_ScreenContactStarted(RadialController sender, RadialControllerScreenContactStartedEventArgs args)
        {
            UpdatePanelLocation(args.Contact);
        }

        private void MyController_ScreenContactContinued(RadialController sender, RadialControllerScreenContactContinuedEventArgs args)
        {
            UpdatePanelLocation(args.Contact);
        }

        private void MyController_ScreenContactEnded(RadialController sender, object args)
        {
            ResetPanelLocation();
        }

        private void UpdatePanelLocation(RadialControllerScreenContact contact)
        {
            //When an on-screen position is provided, apply a transform to the panel
            TranslateTransform x = new TranslateTransform();
            if (isRightHanded)
            {
                //Render to the right of the RadialController
                x.X = contact.Position.X + contact.Bounds.Width / 2 + 50;
            }
            else
            {
                //Render to the left of the RadialController
                x.X = contact.Position.X - contact.Bounds.Width / 2 - 50 - ToolPanel.Width;
            }
            x.Y = contact.Position.Y - 200;
            ToolPanel.RenderTransform = x;
            ToolPanel.HorizontalAlignment = HorizontalAlignment.Left;
        }
        private void ResetPanelLocation()
        {
            //When an on-screen position is not provided, clear the transform on the panel
            ToolPanel.RenderTransform = null;
            ToolPanel.HorizontalAlignment = HorizontalAlignment.Right;
        }

When dealing with on-screen input, it’s also important to be aware of whether your application has focus for Surface Dial input. When your application is minimized, another application is moved into the foreground, or the Surface Dial’s menu is opened, your application will lose focus for input and you’ll need to make sure your on-screen UI responds accordingly. On the other hand, when your app is brought into the foreground and focus is restored Surface Dial may already be on the screen of the Surface Studio, and a ScreenContactStarted event won’t be provided. Here’s an example of how to handle focus changes with Surface Dial:


        public MainPage()
        {
            …

            //Create handlers for when RadialController focus changes
            myController.ControlAcquired += MyController_ControlAcquired;
            myController.ControlLost += MyController_ControlLost;
        }


        private void MyController_ControlAcquired(RadialController sender, RadialControllerControlAcquiredEventArgs args)
        {
            //Ensure tool panel is rendered at the correct location when focus is gained
            if (args.Contact != null)
            {
                UpdatePanelLocation(args.Contact);
            }

            ToolPanel.Visibility = Visibility.Visible;
        }

        private void MyController_ControlLost(RadialController sender, object args)
        {
            //Hide tool panel when focus is lost
            ToolPanel.Visibility = Visibility.Collapsed;
            ResetPanelLocation();
        }

Start Creating with Surface Dial

Using what you’ve learned so far about the RadialController APIs, you can now integrate the Surface Dial into your application, handle input and configure the system menu to meet your needs. You can build a huge range of delightful features for your users, ranging from simple modification of values and properties, to driving complex onscreen UI for Surface Dial users on the Surface Studio.

For more information on UX design and best practices with Dial, please consult our Surface Dial development overview, and you can find the full source code used in this project on GitHub.

Surface Dial and the RadialController platform is a new area of investment for Microsoft, and one of the keys to improving the platform and making it more flexible and powerful is getting feedback from our great community of developers! If you have any questions or comments while developing for the Surface Dial, please feel free to send them via email to RadialController@microsoft.com.

The post A New Input Paradigm in Windows – The Surface Dial appeared first on Building Apps for Windows.

Symlinks in Windows 10!

$
0
0

Overview

Symlinks, or symbolic links, are “virtual” files or folders which reference a physical file or folder located elsewhere, and are an important feature built in to many operating systems, including Linux and Windows.

The Windows’ NTFS file system has supported symlinks since Windows Vista.  However, it hasn’t been easy for Windows developers to create symlinks.  In our efforts to continually improve the Windows Developer experience we’re fixing this!

Starting with Windows 10 Insiders build 14972, symlinks can be created without needing to elevate the console as administrator. This will allow developers, tools and projects, that previously struggled to work effectively on Windows due to symlink issues, to behave just as efficiently and reliably as they do on Linux or OSX.

Background

A symlink is essentially a pointer to a file or folder located elsewhere, consumes little space and is very fast to create (compared to copying a file and its contents).

Because of this, developers often replace duplicate copies of shared files/folders with symlinks referencing physical files/folders. Replacing redundant copies of files can save a great deal of physical disk space, and significantly reduce the time taken to copy/backup/deploy/clone projects.

In UNIX-compatible operating systems like Linux, FreeBSD, OSX, etc., symlinks can be created without restrictions.

However, for Windows users, due to Windows Vista’s security requirements, users needed local admin rights and, importantly, had to run mklink in a command-line console elevated as administrator to create/modify symlinks. This latter restriction resulted in symlinks being infrequently used by most Windows developers, and caused many modern cross-platform development tools to work less efficiently and reliably on Windows.

Now in Windows 10 Creators Update, a user (with admin rights) can first enable Developer Mode, and then any user on the machine can run the mklink command without elevating a command-line console.

What drove this change?

The availability and use of symlinks is a big deal to modern developers:

Many popular development tools like git and package managers like npm recognize and persist symlinks when creating repos or packages, respectively. When those repos or packages are then restored elsewhere, the symlinks are also restored, ensuring disk space (and the user’s time) isn’t wasted.

Git, for example, along with sites like GitHub, has become the main go-to-source code management tool used by most developers today.

picture1

Figure 1: SCM Tool Trends 2004-2016 (Source, Google)

The use of package managers in modern development has also exploded in recent years. For example, node package manager (npm) served ~400 million installs in the week of July 1st 2015, but served more than 1.2 billion installs just one year later – a 3x increase in just one year! In late June 2016, npm served more than 1.7 billion node packages in just seven days!

Figure 2: npm served 1.2Bn downloads in the first week of July 2016

Figure 2: npm served 1.2Bn downloads in the first week of July 2016

There are clear drivers demanding that Windows enables the ability to create symlinks to non-admin users:

  • Modern development projects are increasingly portable across operating systems
  • Modern development tools are symlink-aware, and many are optimized for symlinks
  • Windows developers should enjoy a development environment that is at least the equal of others

How to use Symlinks

Symlinks are created either using the mklink command or the CreateSymbolicLink API

mklink

  • There is no change in how to call mklink.  For users who have Developer Mode enabled, the mklink command will now successfully create a symlink if the user is not running as an administrator.

CreateSymbolicLink

  • To enable the new behavior when using the CreateSymbolicLink API, there is an additional dwFlags option you will need to set:
ValueMeaning
SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
0x2
Specify this flag to allow creation of symbolic links when the process is not elevated

Example Use

In the example below:

  • A subfolder folder called “animals” containing three files (cat.txt, dog.txt, and fish.txt)
  • (green) The mklink command is executed to create a symlink called “pet.txt” pointing at the “animals\dog.txt” file
  • (blue) When the contents of the current folder are listed, the symlink can be seen (yellow)
  • (purple) When contents of pet.txt are queried, the content of the referenced file (“dog.txt”) is displayed

picture3

Once created, symlinks can be opened, loaded, deleted, etc., just like any other file. Here, the pet.txt symlink is being opened in Notepad (red):

picture4

How do I try it?

This new symlinks support first shipped in Windows 10 Insiders Build 14972, and will be formally delivered in Windows 10 Creators Update. We are also working with the owners of open-source community tools such as Git and npm so they know symlink improvements are coming and can make the necessary changes to better support symlinks on Windows.

We encourage you to take this new feature for a spin and be sure to let us know via the Windows 10 Feedback hub or on Twitter etc. (see below). Please sign up for the Windows Insiders program if you haven’t already to try out symlinks!

Neal, Yosef (@yosefdurr), Rich (@richturn_ms), and Gilles (@khouzam).

The post Symlinks in Windows 10! appeared first on Building Apps for Windows.

ICYMI – Animations, C++/WinRT, Surface Dial and Symlinks

$
0
0

Did you miss us over the long weekend? We missed you, too.

Here’s what you might’ve missed this past week!

Symlinks

Symlinks haven’t always been easy to access or create for Windows developers. Starting with Windows 10 Insider Preview Build 14972, devs can create symlinks without needing to elevate the console as administrator. Essentially, this is just one of many steps towards making the Windows platform more efficient and easier for developers.

C++/WinRT

C++/WinRT allows developers to both author and consume Windows Runtime APIs using any standards-compliant C++ compiler.  C++/WinRT is designed to provide C++ developers with first-class access to the modern Windows API. Check it out by clicking below!

Animations

This week we ran a series of GIFs showing the possibilities of the Windows.Composition.UI, which you can see below. Check out all of the code samples here on GitHub if you want to get started.

And, if you weren’t already convinced, one of our Twitter followers @JuniperPhoton did it: https://twitter.com/JuniperPhoton/status/798414583899844608

Getting Started with the Surface Dial

It’s a lot easier than you think. Check out how to get started by clicking the below post.

Windows 10 Insider Preview Build 14977 for Mobile

And last but certainly not least, a new Windows Insider Preview BUILD! Check it out here.

Download Visual Studio to get started.

The Windows team would love to hear your feedback.  Please keep the feedback coming using our Windows Developer UserVoice site. If you have a direct bug, please use the Windows Feedback tool built directly into Windows 10.

The post ICYMI – Animations, C++/WinRT, Surface Dial and Symlinks appeared first on Building Apps for Windows.

Viewing all 10804 articles
Browse latest View live