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:
- First of all add refference of Microsoft.Framework.OptionsModel in your project.json file
- Run dnu restore command to restore the packages
- Run dnu sources get Microsoft.Framework.OptionsModel command in the project’s folder.
Ok, what are the conditions for running dnu sources?
- Package must be installed locally.
- 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 (myget.org/aspnetvnext) 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.