Get source code via dnu sources : A New born MVC command

Today while surfing i got to know interesting very new born command by MVC which is called dnu sources.

Suppose you are extra enthusiastic person and who is willing to get code of particular package of MVC then .Net team is making it easier for you.

Now very first question that appears in mind is:

What is dnu sources?

dnu sources will retrieve the source code for the package.


Write below command :

dnu sources get <package-name>

this will retrieve the source code for the package named <package-name>

How can i try it?

Below are few steps to follow:

  1. First of all add refference of Microsoft.Framework.OptionsModel in your project.json file
  2. Run dnu restore command to restore the packages
  3. Run dnu sources get Microsoft.Framework.OptionsModel command in the project’s folder.

Ok, what are the conditions for running dnu sources?

  1. Package must be installed locally.
  2. The reference of the package(which you are looking for) must be added in the project.

Great, Any limitations?

Well currently it is new born baby so it is quite understable to have limitations which are as below:

  • Only Git is supported.
  • If you application references multiple versions of the same package, you will not be able to use dnu source.
  • Each version of a package will create a new folder under %userprofile%\.dnx\sources. That folder is never cleaned up.
  • There is no first class Visual Studio support (Yet).
  • If you don’t have the dev feed ( as a NuGet source and the package references any of the *.Sources packages (like Microsoft.Framework.NotNullAttribute.Sources), you will not be able to compile the new sources. The workaround is to add the feed to NuGet.config.
  • Currently, only the packages shipped by the ASP.NET and EF teams have source information. The CLR packages (System*), Roslyn or any other packages does not have source information. You will get an error message if you try to source them.
  • dnu sources works only for packages produced in beta6 or later. Any beta5 or earlier packages do not have source information in them.

Lastly have a look here to know how to add repository information to a package.

This command is at its very first stage and .Net team is asking for the feedback and i will update here once it is updated by the team.

Stay tuned for more updates.


2 thoughts on “Get source code via dnu sources : A New born MVC command

  1. I’ve been surfing online more than three
    hours today, yet I never found any interesting article like yours.
    It is pretty worth enough for me. In my view, if all site owners and bloggers made good content as you did,
    the net will be a lot more useful than ever before.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s