Diskpart: Format USB with Command Prompt

Curtesy: http://www.disk-partition.com/diskpart/diskpart-format-usb-4125.html

“Windows was unable to complete the format”

Many users would meet the error: “Windows was unable to complete the format” when they try to format their USB drive to FAT 32 or NTFS in Windows Explorer. But why would this happen?

Unable Format USB

There are many causes that can lead Windows format USB drive failed such as virus infection, the storage device damage, or there has bad sectors on the USB drive, or the USB drive is write-protected. Well, how can you format USB drive successfully under those circumstances?

Ways to format USB drive successfully

You may have a lot of problem about those questions, and you may take a lot of measures to overcome those bad situations like kill virus, check bad sectors, or release the write protection, and so on. Actually, there are many easier solutions.

Solution 1: Disk Management format USB drive

When you cannot format USB drive in Windows Explorer, or the USB drive not shows in My computer or Windows Explorer, you can go to the Windows Disk Management to format USB drive.

Step1. Open Windows Disk Management by typing “diskmgmt.msc” and pressing Enter in the search box.

Step2. Right-click the USB drive and select Format at the menu.

Disk Management Format USB

Step3. Then, select a file system to format USB drive into FAT 32, or NTFS, or others. Click OK to start.

However, if the USB drive is shown as unallocated space in Disk Management, here you need right-click the unallocated space, select “New Simple Volume” to create new partition for the USB drive. After creating partition on the USB drive, you will find that it has been formatted and it can be recognized by Windows Explorer.

Solution2: Diskpart format USB drive

Mostly, when the computer cannot recognize a USB drive, you can try to use Diskpart to format USB drive. Diskpart is a built-in tool that manage your hard drives. You can use it to format disk including internal or external hard drive. Diskpart format USB drive is much more effective than Windows Explorer. Here we’ll take an example of how to format USB drive with Diskpart while it is not shown in Windows Explorer.

1. Open the command prompt by typing “cmd” at the search box, right-click the program and select Run as Administrator.

Open CMD

2. Then,type “diskpart” and press enter to launch the program.

3. Next, type “list disk” to display all disks on your computer.

4. Type “select disk 2” and press Enter. Here disk 2 is the USB drive.

5. Type “clean” and press Enter.

6. Type “create partition primary”, press Enter.

7. Type “format fs=fat32 quick” or “format fs=ntfs quick” and press Enter to format USB drive to FAT 32 or NTFS as you want.

Diskpart Format USB

Finally, type “exit” to end up this, and you have already finished the task about Diskpart format USB. Then, you can active the partition and assign drive letter for the USB drive. For all this, Diskpart is dangerous for people who do not familiar with Diskpart cause all the operations cannot be revoked once the progress launched. Thus, if there is one mistake, you may get into a big trouble. Fortunately, there is another easy way to format USB drive that even a noob can do it alone.

Solution3: Format USB drive with AOMEI Partition Assistant

AOMEI Partition Assistant Standard is a remarkable free software that can manage your hard drive in Windows 7/8/10. You can use it to create/resize/delete/format/move/merge partitions in a few simple mouse-clicks in its intuitive interface. Format USB drive could be much simpler than Windows Disk Management or Diskpart format USB.

Step1. Plug in your USB drive to your computer. Download the freeware, install and launch it. All disks on your hard dive will be shown on its concise main interface.

Main Interface

Step2. Right-click your USB drive, select Format Partition at the drop-down menu.

PA Format USB

Step3. Here you can select the file system you need, edit the partition label and the cluster size. Here we format USB from FAT 32 to NTFS.

Select File System

Step4. Finally, click Apply at the toolbar to submit the operations.

Format USB Drive

Even though, AOMEI Partition Assistant still provides you the way to partition hard drive from command prompt including format USB drive with command prompt. AOMEI Partition Assistant format USB drive is a good alternative to Diskpart format USB drive. Besides, you can use it to do many other things for managing your hard drive better.

How to Use the Diskpart Utility to Assign and Remove Drive Letters

The Disk Management tool in Windows gives you an easy-to-use graphical interface to dealing with partitions and drive letters, but what if you want to just quickly change a drive letter on the command prompt? The diskpart utility makes it easy.

You’ll need to start by opening an administrator mode command prompt — type cmd into the search box, and then right-click and choose Run as administrator, or use the CTRL + SHIFT + ENTER keyboard shortcut.

Once there, run the diskpart command, and then type in the following to list out the volumes on your system.

list volume

You’ll want to note the volume number next to the drive that you want to change the letter of. In our case, that number is 3.

Now we’ll use the select volume command to tell diskpart to make changes to that volume. If your drive number is different, you’ll want to replace the 3 with the number in your configuration.

select volume 3

You should see a message that the volume is now selected.

At this point you can easily assign a new drive letter. Just type in this command, substituting R for the drive letter you’d like to use:

assign letter=R

Make sure to hit enter once you’re done, of course.

Once you’ve made that change, your drive should show up again as a new device, and be available for browsing immediately.

If you want to unassign a drive letter in order to hide the drive, you can also use the remove letter command in the same way. We wouldn’t necessarily advise doing this, of course.

Don’t bother trying to change your C: drive, because that’s not going to work.

 

How to Offline/Online a disk using Diskpart

Introduction:

If your computer has multiple disks, you may want to turn off one or more of your disks.

Requirements:

A computer with multiple disks, access to Windows command line, and Windows operating system.

Procedure:

From the task-bar, open the start menu. Search for cmd. In the command line, enter the command

diskpart

Allow the Diskpart program to run. Enter the command

list disk

Example output:

DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 119 GB 0 B

The Status column lists the Online/Offline status. Enter the command:

select disk 1

but replace the ‘1’ with the desired disk number. Enter either the command

offline disk

or

online disk
Advertisements

Running VS Code on Linux

Curtsy/ Original post: https://code.visualstudio.com/docs/setup/linux

Running VS Code on Linux

Installation

  1. Download Visual Studio Code for your distribution, .deb for Debian-based distributions such as Ubuntu or .rpm for Red Hat-based distributions such as Fedora or CentOS. Note that 32-bit binaries are also available on the download page.
  2. Install the package through a GUI package manager by double clicking on the package file, or through the command line:
 # For .deb
 sudo dpkg -i <file>.deb
 # install dependencies
 sudo apt-get install -f

 # For .rpm (Fedora 21 and below)
 sudo yum install <file>.rpm

 # For .rpm (Fedora 22 and above)
 sudo dnf install <file>.rpm
  1. VS Code should now be available to run through the launcher or the command line by running code.

Tip: Run code . in any folder to start editing files in that folder.

Note:

Visual Studio is tightly integrated with Windows and Developing a .NET application using any language (C# or VB) takes more than just having Wine, and since Wine is not capable enough to provide complete development runtime as .NET in Linux.

If you want to develop software specifically in C#, on Linux, you can use MonoDevelop

Since, you’re asking for Visual Studio 2010 (.NET 4.0), with MonoDevelop, you’ll not be able to develop an app that particularly uses .NET 4, as of now MonoDevelop is in version 3.0.2 (somewhat equivalent to .NET 3.0).

You can still use Windows virtually within Ubuntu, using VirtualBox. And then install Visual Studio there, but still a serious app development is not recommended to be done in Virtualized environment.

Download Visual Studio Code

https://code.visualstudio.com/download

http://www.monodevelop.com/download/

 

Data Storage Schemes in Android-Shared preferences (Setting Font Size)

To Setting Dynamic Fonts Size in Android Activity Use “Shared Preferences”

1. Create a project SharedPreference and add the bellow code

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

    <SeekBar
        android:id="@+id/SeekBar01"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/TextView01"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

    <EditText
        android:id="@+id/EditText01"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <Button
        android:id="@+id/btnSave"
        android:text="Save"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>

package com.jetbrain.nazim.sharedpreferences;
//[changeable as your project package]

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.Toast;

public class SharedPreferencesActivity extends Activity {

    private SharedPreferences prefs;
    private String prefName = "MyPref";
    private EditText editText;
    private SeekBar seekBar;
    private Button btn;

    private static final String FONT_SIZE_KEY = "fontsize";
    private static final String TEXT_VALUE_KEY = "textvalue";

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shared_preferences);

        editText = (EditText) findViewById(R.id.EditText01);
        seekBar = (SeekBar) findViewById(R.id.SeekBar01);
        btn = (Button) findViewById(R.id.btnSave);

        btn.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {

                //---get the SharedPreferences object---
                //prefs = getSharedPreferences(prefName, MODE_PRIVATE);
                prefs = getPreferences(MODE_PRIVATE);

                SharedPreferences.Editor editor = prefs.edit();

                //---save the values in the EditText view to preferences---
                editor.putFloat(FONT_SIZE_KEY, editText.getTextSize());
                editor.putString(TEXT_VALUE_KEY, editText.getText().toString());

                //---saves the values---
                editor.commit();

                //---display file saved message---
                Toast.makeText(getBaseContext(),
                        "Font size saved successfully!"+editText.getTextSize(),
                        Toast.LENGTH_SHORT).show();
            }
        });

        //---load the SharedPreferences object---
        //SharedPreferences prefs = getSharedPreferences(prefName, MODE_PRIVATE);
        prefs = getPreferences(MODE_PRIVATE);

        //---set the TextView font size to the previously saved values---
        float fontSize = prefs.getFloat(FONT_SIZE_KEY, 12);

        //---init the SeekBar and EditText---
        seekBar.setProgress((int) fontSize);
        editText.setText(prefs.getString(TEXT_VALUE_KEY, ""));
        editText.setTextSize(seekBar.getProgress());

        seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
            }

            @Override
            public void onProgressChanged(SeekBar seekBar, int progress,
                                          boolean fromUser) {
                //---change the font size of the EditText---
                editText.setTextSize(progress);
            }
        });
    }
}

now run your project


Restore SQL Server 2012 backup to a SQL Server 2008 database

You have couple of options :

Option A : Script out database in compatibility mode using Generate script option :

Note : If you script out database with schema and data, depending on your data size, the script will be massive and wont be handled by SSMS, sqlcmd or osql (might be in GB as well).

DjVa5

Option B:

First script out tables first with all Indexes, FK’s, etc and create blank tables in the destination database – option with SCHEMA ONLY (No data).

Use BCP to insert data

  1. bcp out the data using below script. set SSMS in Text Mode and copy the output generated by below script in a bat file.
    -- save below output in a bat file by executing below in SSMS in TEXT mode
    
    -- clean up: create a bat file with this command --> del D:\BCP\*.dat 
    
    select '"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\bcp.exe" ' /* path to BCP.exe */
        +  QUOTENAME(DB_NAME())+ '.' /* Current Database */
        +  QUOTENAME(SCHEMA_NAME(SCHEMA_ID))+'.'            
        +  QUOTENAME(name)  
        +  ' out D:\BCP\'  /* Path where BCP out files will be stored */
        +  REPLACE(SCHEMA_NAME(schema_id),' ','') + '_' 
        +  REPLACE(name,' ','') 
        + '.dat -T -E -SServerName\Instance -n' /* ServerName, -E will take care of Identity, -n is for Native Format */
    from sys.tables
    where is_ms_shipped = 0 and name <> 'sysdiagrams'                       /* sysdiagrams is classified my MS as UserTable and we dont want it */
    /*and schema_name(schema_id) <> 'unwantedschema'    */                             /* Optional to exclude any schema  */
    order by schema_name(schema_id)
  2. Run the bat file that will generate the .dat files in the folder that you have specified.
  3. Run below script on the destination server with SSMS in text mode again.
    --- Execute this on the destination server.database from SSMS.
    
    --- Make sure the change the @Destdbname and the bcp out path as per your environment.
    
    declare @Destdbname sysname
    set @Destdbname = 'destinationDB' /* Destination Database Name where you want to Bulk Insert in */
    select 'BULK INSERT ' 
    /*Remember Tables must be present on destination database */ 
    + QUOTENAME(@Destdbname) + '.' 
    + QUOTENAME(SCHEMA_NAME(SCHEMA_ID)) 
    + '.' + QUOTENAME(name) 
    + ' from ''D:\BCP\' /* Change here for bcp out path */ 
    + REPLACE(SCHEMA_NAME(schema_id), ' ', '') + '_' + REPLACE(name, ' ', '') 
    + '.dat'' with ( KEEPIDENTITY, DATAFILETYPE = ''native'', TABLOCK )' 
    + char(10) 
    + 'print ''Bulk insert for ' + REPLACE(SCHEMA_NAME(schema_id), ' ', '') + '_' + REPLACE(name, ' ', '') + ' is done... ''' 
    + char(10) + 'go'
       from sys.tables
       where is_ms_shipped = 0
    and name <> 'sysdiagrams' /* sysdiagrams is classified my MS as UserTable and we dont want it */
    and schema_name(schema_id) <> 'unwantedschema' /* Optional to exclude any schema */
        order by schema_name(schema_id) 
  4. Run the output using SSMS to insert data back in the tables.

This is very fast bcp method as it uses Native mode.

How do I generate insert statements/ script (including data) with Sql server 2012

  • Right click on your database and select Tasks -> Generate Scripts
  • Click Next to move past the intro screen and onto the next page, then select the objects you want to script. Note that you can script all SQL objects here, not just tables. This is because this wizard allows you to script schema and data. Importantly, schema only is the default, which you’ll need to change on the next page. Click Next.
  • Now you’ll be presented with a set of options mainly relating to how the script is going to be output, however there is an unassuming button labelled Advanced. Clicking this button will give you a dialog with a list of options. The last option under the General section is “Types of data to script”, which you should change from “Schema only” to “Data only”, or “Schema and data”.
  • Finally, decide where you want the script to do and you should be able to generate your INSERT statements.

Curtsy: https://raresql.com/2012/09/30/generating-insert-statements-in-sql-server-2012/

Generating INSERT statements in SQL Server 2012

Recently, I wrote an article on “Generating Insert statements, data & schema using SQL Server Publishing Wizard”. It is a very nice tool to generate insert into statement from table data.

In SQL server 2012, the feature of this tool plus additional features are provided. Lets proceed step by step to generate insert into statement from table data in SQL server 2012.

Step 1 :

In the first step, you need to right click on Databases >> Tasks >> Generate Scripts…

Step 2 :

This is the welcome screen. If you don’t need this screen again and again you can check on “Do not show this page again”.

Step 3 :

In this step, you need to generate the script for one object or all objects available in the database. You can further drill down if you need to generate any table. For example :

Setup 4 :

The next step is to define the script location, clip board or in a new window. In the same step, if you click on Advanced button, it will give you further control on scripting.

This is the advance screen, in this screen you can choose whether you need data, schema or data and schema scripts.’

But if you need only Insert into statement from table data, you must select data only. By default it is schema only.

It also allows you to select the SQL version.

Step 5 :

In this step it will display the summary of your selection. If you need you can go back and change the settings.

Step 6 :

In this step, it will display the result.

How to Install Xcode on Windows 10, 8 or 8.1and 7 for iOS SDK

Original Post/ Curtsy: 

https://www.alltechbuzz.net/install-xcode-on-windows-for-ios-sdk/

 

Developing apps for Linux and Windows on any platform is an easy task while building software for Mac is not so easy compared to other platforms. For building apps on Mac requires a SDK called Xcode. Xcode is an integrated development environment (IDE) that consists of set of software development tools which are designed by Apple specifically for developing software on Mac OS X and iOS. The app development kit, Xcode is not available for any other operating systems except Mac OS X and iOS. There are many reasons and compatibility issues behind this unavailability. If you are quite firm to install Xcode on your Windows PC (7, 8.1 and 10) and check the working process of SDK framework/development kit on Windows OS, then here is a detailed way on how to install Xcode on Windows 7 and 8/8.1 and Windows 10 pC.

Xcode – App Development Kit

Xcode is an application development kit or simply SDK containing set of software development tools designed for Mac OS X. Xcode is an interface builder which can also be considered as a testing application and an asset management toolkit. Here is a method on how to install Xcode on Windows PC (7, 8 or 8.1 and 10) using Oracle VirtualBox. Hence, by installing this Xcode SDK on your Windows OS, you can create and develop basic apps on Windows PC.

Requirements to Install Xcode on Windows 7/8/10 OS

In this article, we are going to explain you in a detailed way on how to install Xcode on Windows 7, 8 or 8.1 and 10. Before initiating the installation process, you need to have the following system requirements:

  •  A working Mac OS X virtual machine on VMware or VirtualBox.
  • Downloaded Xcode package from Apple site. You need to have Apple ID in order to download Xcode from Apple store.
  • Dual Core Intel processor
  • Minimum 2GB of RAM (Recommended: 4 GB+)
  • Hardware Virtualization

If you are a professional app developer, you have to purchase Apple hardware with OS X and app developer ID. You need to use Xcode on your Apple hardware at the time of testing the app on a real Apple device.  As we are using Virtual Box to install Xcode on Windows, make sure that you have a working Mac OS X virtual machine. If you don’t have a copy of an installed Virtual Box, then you can download it here as it is free and open source.

Download VirtualBox

Steps to Install Xcode on Windows 10, 8/8.1 and 7 PC or Laptop

Follow the below steps so as to install Xcode on Windows 10, 8 or 8.1 and Windows 7 desktop or Laptop for iOS SDK.

Step 1: Initially, download and install VMware or VirtualBox on your Windows computer from the above link.

Step 2: Now, you need to download and install OSX Mavericks ISO as a virtual machine.

Step 3: You have to create the virtual machine on your oracle virtual box. For that, you need to open Virtual Box and click New.

Step 4: Now, you will get a new window asking for the name of the new operating system. Enter Name as OSX, Type of the OS as Mac OS X and also enter the Version as Mac OS X (32 bit). Click Next.

Create New Virtual Machine

Step 5: You need to select the size of RAM for the virtual machine. The sufficient size of memory for Android to run on your Windows computer requires 1024 MB (1 GB). Select the memory size and then click Next.

Create Virtual machine - memory size

Step 6: Now, Select and create the type of virtual hard drive file.

Step 7: Select the type of Hardware file as VDI (VirtualBox Disk Image). It is always recommended to go for VDI in terms of ISO image. Click Next.

Create virtual hard drive

Step 8: Select the physical hard drive as Dynamically allocated. Now, you need to allocate the file loaction and size of Android from physical hard drive on your device. Then, Click on Create.

virtual hard drive - File location and size

Step 9: Now, you have successfully created virtual machine on your virtual box. You need to mount the iso file which is downloaded before. For that, Go to Settings >> Storage >> Load iso File >> Click Ok >> Start.

Create VM on Oracle

Step 10: Later, you just follow the on-screen steps of OSX boot as Wizard and then OSX will be installed in Oracle Virtual.

Install Xcode on Windows PC

Step 11: Now, go to safari browser in your Virtualbox and open official Apple App store. Sign in using your Apple ID into the App store. You need to enter the Apple ID and password as shown in the image below:

sign in - Apple App store

Step 12: After signing, type xcode in the search box in order to get the complete package. It shows you various related apps. Locate Xcode from different apps and click on Free and Download. Then, click OK to download the kit.

Download xcode from apple store

Step 13: After completing the installation process, open it from the applications. Now, you need to provide your root credential in order to get access privilege to install Xcode components and also for modifying your system settings. Enter your name and password and press OK.

Install Xcode

Step 14: That’s it,. We have now successfully installed the latest Xcode version on your Windows 10, 8/8.1 and 7 PC using desktop virtualization software VMware workstation.

Xcode - SDK
This way you can install Xcode, app development software on your Windows PC or Laptop. Now, you can create new projects and better apps using this interface. As you are running this software on Windows, the performance and speed of Xcode won’t be extremely high.

However, it can be used for educational purpose, but not for professional app developers. Now it’s time to use Xcode on our PC. So in this way you can easily download and install Xcode on your any windows Personal computer or laptop and you can create better apps as per your need. Hope this tutorial helps you in the best way to install Xcode on Windows 10, 8/8.1 and 7 OS running PC or Laptop.

ASP.NET vNext on OSX and Linux

Original post/curtsy: http://graemechristie.github.io/graemechristie/blog/2014/05/26/asp-dot-net-vnext-on-osx-and-linux/

So what is ASP.NET vNext ?

Microsoft have recently released a preview of the next iteration of their ASP.NET platform. I’m not going to go into the details here, people like Scott Hanselman have already done a fantastic job of that. I will however say that the changes, both technical and cultural, are huge. Two of those changes are particularly relevant to this blog post.

Firstly, ASP.NET vNext is fully open source. People like you and me are able to get in on the ground floor, try out the bits and pieces and even contribute – pretty much from the project’s inception.

Secondly, ASP.NET vNext is cross platform, and embraces non Windows hosts as first class citizens. Microsoft are fully integrating Mono and Linux into their build environment and test matrix, and are actively working with the community to make Mono a top class platform for hosting ASP.NET. That being said, these are early days, and the team is still ironing out issues with the Mono environment.

Getting ASP.NET vNext up and running on OSX and Linux

There are two main steps to getting to the point where we can run ASP.NET vNext applications on our non Windows system.

The first is to install Mono. Normally this would be a no brainer; however as all this stuff is very shiny and new there are fixes and features that are currently only in the bleeding edge source code of Mono and have not been released as a package as yet. In order to get these fixes we are going to need to build mono from the latest source code located in the mono git repository.

The second step is to install the “K Runtime Environment” or KRE. This is the command line environment that will build and run (not that there is really a distinction anymore) projects from their new project.json project files.

Installation of the KRE is handled by the “K Version Manager” (KVM). This is a simple app that can install multiple versions of the KRE side by side, and allow you to easily switch between them.

Building Mono

I don’t want to go into too much detail here. There are plenty of guides around the internet on installing mono from source.

  • Install Mono as per the instructions at The Mono Github page.
  • You will need an earlier mono release installed in order to build Mono from source (Mono uses Mono to build itself)
  • You will need autoconf, libtool and and a few other common dev tools installed on your system.
  • On some linux systems you may need to run the following before you run the mozroots command below.
1
2
3
 sudo certmgr -ssl -m https://go.microsoft.com
 sudo certmgr -ssl -m https://nugetgallery.blob.core.windows.net
 sudo certmgr -ssl -m https://nuget.org
  • If you are on linux, you will need to run mozroots --import --sync after installing mono to avoid certificate/trust issues down the line
  • If you are on OSX you will want to edit /private/etc/paths and move the line /usr/local/bin before the line /usr/bin so the system finds the new mono version on the path before the old one.

caveat: This may totally break your system if you have lots of crazy stuff in /usr/local/bin. If your not sure about this, wait for a supported official release of Mono

Once all this is done, run mono --version. You should see that you are running Mono version 3.4.1 or newer.

mono --version

If you do not, check your $PATH variable and go back over the mono install steps.

Installing KVM and the K Runtime Environment

Installing KVM is super simple. If you like you can go to the Readme for the AspNet Home project and follow the “Getting Started” instructions there, however that involves cloning the Home Repository which is only required for that quick start demo.

KVM can be installed on any Linux or OSX system (that has bash or zsh and curl installed) with a single line.

1
curl https://raw.githubusercontent.com/aspnet/Home/master/kvminstall.sh | sh && source ~/.kre/kvm/kvm.sh && kvm upgrade

This will:

  • download kvm.sh and save it in ~/.kre/kvm/kvm.sh
  • add the command to run kvm.sh on every login to bash/zsh.
  • kvm.sh will then be run via the source command. This adds the kvm command to the current shell.
  • run kvm upgrade. This will download the latest KRE package, extract it to .kre/packages and add the bin folder to your path.

Once this is done, all of the KRE commands will be available from shell prompt. Primarily this will be the k command used to run ASP.NET vNext Projects, and the kpm command used to restore packages.

Additionally the kvm command can be used to install other version of KRE side by side for the user, switch between versions, list the installed versions and set up aliases. See the ASP.NET Home Project Readme for examples of the various kvm commands.

Okay, so I’ve got a Shiny New KRE ….

So let’s point it at something. We could download one of the many samples from the aspnet repository, however just to prove we have everything we need to build and run ASP.NET vNext apps on OSX and Linux, lets create a very basic project from scratch.

  • Create a folder called HelloKRuntime somewhere on your system and cd into that folder
  • Create a file called project.json and copy the following text into it. This is your ASP.NET vNext project file .. and not an angle bracket to be seen !
1
2
3
4
5
6
7
8
9
  {
    "dependencies": {
      "System.Console": "4.0.0.0"
    },
    "configurations": {
      "net45": {},
      "k10": {}
    }
  }
  • Create a file called Program.cs and copy the following text into it.
1
2
3
4
5
6
7
8
9
  using System;

  public class Program
  {
      public static void Main()
      {
          Console.WriteLine("Hello K Runtime !");
      }
  }
  • type kpm restore -s https://www.myget.org/F/aspnetvnext/ The K Package Manager will head off to the nuget repository and fetch System.Console and all its dependencies, based on the entry in your project.json file. Note that there is no need to use Nuget to install this package. The project.json entry is all the info kpm needs to fetch your dependencies.

Note: Because the ASP.NET vNext project is currently using their own nuget feed, we need to supply the nuget source on the command line. This can be provided in a NuGet.Config file in your Solution folder, and once the vNext is released you shouldn’t need one at all unless you are using your own private nuget feeds.

kpm restore

  • Now type k run from the command line. You should see your system burst to life and utter those immortal words

Hello K Runtime

  • As an example of how the new Configuration system ties into the environment, try typing export KRE_TRACE=1 and then k run again. You will see the compiler output as well as the “Hello K Runtime” message.

Hello Compiler Output

In Summary

Hopefully this post has demonstrated that cross platform ASP.NET vNext functionality is available now. There are still rough edges, but progress is being made daily and first class support for OSX and Linux environments is on the horizon. If you are having issues getting this working, feel free to drop into the aspnetvnext room on Jabbr and someone should be able to help you out.

UPDATE: If you’d like to try something more involved than the trivial console application above, the simple Hello World V Next web example might be a good next step.

The Next Generation of .NET – ASP.NET vNext

Original post/ curtsy: https://blogs.msdn.microsoft.com/dotnet/2014/05/12/the-next-generation-of-net-asp-net-vnext/

The Next Generation of .NET – ASP.NET vNext

Updated (July 2015): See Announcing .NET Framework 4.6 to read about the latest version of the NET Framework.

Today at TechEd North America, we announced the latest set of innovations that are part of the next generation of .NET. The biggest of those is ASP.NET vNext, which is an updated version of ASP.NET that been optimized for cloud Web development. We’ve continued to improve the core .NET technologies that we shared at Build last month, specifically the .NET Native ahead-of-time compiler and the .NET Next Generation JIT (“RyuJIT”). Both have new releases you can try out. We also have a set of smaller announcements to share.

At Build last month, we announced the .NET Foundation. We are currently talking to over 25 community-based .NET projects and organizations about joining the foundation. The interest in the foundation has exceeded our expectations and is off to a great start.

We also announced the .NET Compiler Platform (“Roslyn”) at Build. It includes new C# and VB compilers and a preview of new language features being considered for C# 6. The project is open source on codeplex and has accepted its first pull requests from the community.

The final release of Visual Studio 2013 Update 2 is now available. Update 2 brings dozens of significant new features to Visual Studio developers, including tools for Windows Phone 8.1 and universal Windows apps.

While we’re looking forward, it’s also good to look at one of the current strengths of .NET. There are currently 1.8 billion active installs of .NET. That’s a very large number by any measure and a great base of desktop and server machines on which to run your apps.

TechEd .NET Announcements

Here’s a quick rundown of the .NET announcements that we shared at TechEd.

.NET vNext

TechEd is the first time we’re talking about .NET vNext, as the next major release of the .NET Framework. At Build and TechEd, we’ve shared many of the features and components that you can expect in the next release. You will be able to compile C# 6 and VB with the Roslyn compilers, host ASP.NET vNext apps on the server or cloud, compile your Windows Store apps with the .NET Native ahead of time compiler, and enjoy faster desktop and server apps with the Next Generation JIT.

We’ve optimized .NET for the mobile-first and cloud-first development options that have become more common today. Device and cloud apps come with significant user expectations around performance, and also run in more specialized hardware/virtual environments. For Windows Store apps, we built the .NET native ahead of time compiler. For cloud apps, we’ve developed a cloud optimized mode.

.NET vNext will have a cloud optimized mode that enables you to deploy your apps with a copy of the .NET Framework libraries they need. Since the runtime and framework libraries are deployed on an app-basis, each app can run different versions of .NET vNext side-by-side and upgrade separately, all on the same machine. These libraries have been slimmed down significantly to reduce the footprint of the framework, and will be distributed via NuGet. Also, libraries such as WPF and Windows Forms have been removed from this mode.

We’re developing this with cross-platform in mind, including an active collaboration with Xamarin to ensure that cloud-optimized .NET applications can run on Mac or Linux on top of the Mono runtime. The great productivity of .NET and ASP.NET can be available to teams working in mixed development environments.

ASP.NET vNext

ASP.NET vNext is our big announcement at TechEd. We’ve updated many aspects of ASP.NET to make ASP.NET apps easier to build and perform significantly better. We’ve considered sites and services that get infrequent traffic and those that get bombarded by visitors all day long. We’ve also opened up new scenarios that were just not possible with ASP.NET before.

We’ve designed ASP.NET with a key set of design principles in mind:

  • Cloud-ready out of the box
  • A single programming model for Web sites and services
  • Low-latency developer experience
  • Make high-performance and high-productivity APIs and patterns available – enable them both to be used and compose together within a single app
  • Fine-grained control available via command-line tools and standard file formats
  • Delivered via NuGet
  • Release as open source via the .NET Foundation
  • Can run on Mono, on Mac and Linux

ASP.NET vNext includes updated versions of MVC, Web API, Web Pages, SignalR and EF. The key improvement with these frameworks is that MVC, Web API and Web Pages have been merged into a single programming model. For example, there’s now unified controller and routing concepts between all three. You can now have a single controller that returns both MVC views and formatted Web API responses, on the same HTTP verb.

ASP.NET vNext apps are cloud ready by design. Services such as session state and caching adjust their behavior depending on whether the app is running in the cloud or in a traditional hosting environment, while providing a consistent API. We use dependency injection behind the scenes to provide your app with the correct implementation for these services. Using this approach, it is really easy to move your app from on-premises to the cloud, since our code changes, not yours.

You will be able to make changes to your web applications and see the results after a browser refresh, with no separate build step needed. This significant productivity enhancement is based on improvements to load times in the underlying CLR, as well as use of the new .NET Compiler Platform (“Roslyn”).

You can see the ASP.NET vNext in action in the images below. The first image shows an ASP.NET vNext Hello World app hosted from the command-line and drive from browser. Any edits in Visual Studio will be compiled and executed when the browser is next refreshed. This app is using .NET vNext cloud optimized mode.

You can also use Visual Studio with a more traditional Visual Studio F5 workflow that automatically starts the webserver and launches the browser. This is the same app as shown in the image above.

In the image below, the app has been re-configured to run on the full .NET vNext framework, instead of the cloud optimized mode. That’s just a setting on the project. The app now has access to all of the APIs in the .NET Framework. The browser refresh feature is available in this configuration, too.

The table below outlines the ASP.NET vNext scenarios we’ve built and where they are available.

ASP.NET vNext Feature On .NET vNext On .NET vNext (Cloud Optimized)
Cloud Ready * *
Modular Design * *
Dependency Injection * *
Consistent Tracing / Debugging * *
Faster Development (browser refresh) * *
Open Source * *
Full Side by Side (runtime and framework
deployed with application)
*
Faster startup, Lower memory / Higher throughput (best of class) *
Uses a smaller set of framework libraries   *
Enabled on Mono, on Mac and Linux   *

 

ASP.NET vNext will be open source and will be contributed to the .NET Foundation. This shouldn’t come as a big surprise since the ASP.NET Web stack is already open source. All of ASP.NET vNext will be delivered via NuGet, will be open source and will take contributions. Read ASP.NET vNext: the future of .NET on the Server to learn more.

Our announcement at TechEd is the first stop for .NET vNext and ASP.NET vNext. We’ll share much more in the months to come before we release the final versions. We’re looking forward to shipping pre-release versions in order to get your feedback.

Additional .NET Framework Updates and Improvements

We recently announced the .NET Framework 4.5.2. It including significant improvements in ASP.NET and Windows Forms and other areas of the product. You can start incorporating 4.5.2 features into your apps now.

We released several key improvements to ASP.NET Web Forms. These include support for ASP.NET Identity 2.0, Entity DataSource control for Entity Framework 6 and Roslyn support.

We have also added new features and scenarios to both .NET Native and the Next Generation JIT. .NET Native now support x86, in addition to ARM and x64 apps. The Next Generation JIT now supports Windows 7 and later for x64 apps. Both of these technologies are a critical part of our .NET vNext roadmap. Expect to hear more about both of them in the coming months.

Targeting Multiple Platforms

We’ve been working for several years to make it easier to write code for multiple platforms, both as apps and libraries. We started by enabling our PCL reference assemblies for Xamarin, who quickly moved forward with that change. More recently, we’ve been working closely with Xamarin to make our .NET NuGet packages work better with Xamarin tools, to make it easier to build .NET apps for iOS and Android. There’s still work to do, but the experience has gotten much better and will continue to improve.

At TechEd, we announced a new portability analysis tool, called ApiPort. It provides you with two main pieces of data: the platforms that you can easily/reasonably target with your code, and the dependencies that are preventing you from targeting additional platforms.

The command line tool generates an Excel report that provides you with two views of its portability analysis. It provides a high-level color-coded view for a given set of platforms. It also provides a very detailed list of all the types and members used within your code, and whether they are supported, per platform. Given that the report is in Excel, it is very easy to filter the list, build pivot tables and do whatever else you want to perform further analysis.

The image below shows a small sample of the high-level portability analysis view. Only one assembly is shown, but there can be multiple. Check out this sample portability analysis to get a first-hand view.

The tool has another function, too. All of the dependency data (not the assemblies) are uploaded to an Azure service that the .NET team maintains. The data that the tool uploads is the list of assemblies and APIs that your code relies on. We do not record where the data came from or by whom. We do not upload any of your actual code or binaries. We want to know which functionality we need to bring to each platform to make it easier to target all platforms.

If you are finding it difficult to target a particular platform, please “vote” for the APIs you want added to a particular platform by running the tool on your app and libraries. It’s really easy to run the tool on a whole directory.

This first release of tool is missing a few features that we are in the process of adding. The Xamarin/Mono platforms are currently missing from the tool. It also doesn’t yet take into consideration NuGet packages that make .NET Framework APIs available on other platforms, counting them as missing APIs.

Client Libraries for Microsoft Services

You’ve probably heard that Microsoft is both a “services first” and “devices first” company. At the nexus of those statements are client libraries that make it easy to target Microsoft services from apps. While Client libraries for Microsoft services are not new, we are more recently working to provide support for more platforms. We’ve started with Office 365 services, and intend to add more services over time.

At TechEd, we announced a preview release of a new set of client libraries for Office 365, for .NET and JavaScript. You can read the announcement for the new Office 365 client libraries on the Office Developer Blog. The .NET Client libraries support WPF, Windows Forms, Windows Store, Xamarin.iOS, Xamarin.Android and ASP.NET apps and Portable Class Libraries, and are delivered via NuGet.

We have also provided an integrated experience for adding these libraries to your apps within Visual Studio. Services require app registration, permission selection and a platform-specific user authentication experience. You also need to add the right client libraries to your app. The Visual Studio experience takes care of all of that for you, as part of the Connected Services Manager, displayed below.

You can learn how to start using this experience from the Office Developer blog. We are using StackOverflow as the community forum for this project, under the Office365APIs tag. Please tell us what you think about the client libraries and the new Visual Studio integration. Do note that these libraries, and the Office services they are targeting, are in Preview and don’t yet support production apps.

Summary

On the .NET team, we’re excited to be sharing the Next Generation of .NET. As you can see from this post and the one we published at Build, we are lining up a significant set of technologies, features and scenarios that will be part of .NET vNext, our next major release of the .NET Framework. In this post, we focused on ASP.NET vNext, our next generation Web and services platform.

For .NET vNext, we’ve been talking about major features and asking for feedback before we even announced the larger release. We’ve been actively engaging with experts and enthusiasts in our preview and pre-release programs to validate our ideas and product directions. It’s turned out to be a great approach. The feedback has been incredible. Thanks to everyone that has participated in our CTPs, developer previews, pre-releases and any other program we ran to collect feedback. We’ve also received great feedback in blog comments. It’s all been very helpful. Do expect multiple additional preview releases over the coming months, particularly for ASP.NET vNext. It’s going to be a fun time.

You can see how these technology investments come together into a single .NET Framework release, in the following slide that we showed at TechEd. Open Source is also an important part of our plans, as you can see with our ASP.NET vNext contribution plans with the .NET Foundation. The future looks very bright for .NET.