First of all I would forward you to the part of documentation, which describes global.json
.
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta5",
"runtime": "clr",
"architecture": "x86"
}
}
The version
(and optionally runtime
and architecture
) are important because your computer have multiple versions of dnx.exe
. You can examine %USERPROFILE%.dnx
untimes
directory to see all the installed runtimes. The "sdk"
part of global.json
defines the version of dnx.exe
from one of the runtimes which you installed.
It's important to understand about "projects"
part of global.json
that it will be scanned all sibling folders on any level under every from the directory. Every project.json
, which will be found, will be interpreted as the project of the solution.
You can for example download some part of ASP.NET and place it in the new subfolder of your solution hierarchy. For example you can download RC1 source of Entity Framework 7 (the file) any extract the zip-file in new ef
folder inside of src
folder of your project. You will see that, short time after reopening of the solution, the list of your project will be longer and longer and all Entity Framework 7 components will be included in your solution. In the same way you can extract the downloaded sources in separate directory C:aspnetEF7
and to use
{
"projects": [ "src", "c:/aspnet/EF7" ],
"sdk": {
"version": "1.0.0-rc1-update1"
}
}
You will have the same effects. If you later decide to remove debugging the sources of Entity Framework 7 then you should just exclude "c:/aspnet/EF7"
from global.json
and then remove in Visual Studio previously added projects by selection in Solution View and click Del key.
I think that it should clear the possibilities which you have in the folder structures.
One more very important optional file, which could exist in the solution hierarchy, is NuGet.config
file. It defines NuGet feed, where the packages will be loaded. The problem is that there are many NuGet repositories (see the answer), which have different preliminary versions of ASP.NET 5 components. If you use the exact dependencies like
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final"
then one need just have the explicit version in the NuGet repository. The problem is that sometimes one uses the dependency like
"EntityFramework.MicrosoftSqlServer": "7.0.0-*"
to load the latest build of the package. If you would use wrong NuGet feed then you can get early RC2 builds, which are incompatible with other RC1 packages (at least because of renaming of many components between beta versions). To be sure that your solution (all your projects) uses RC1 you can place the following NuGet.config
in your solution folder (on top of all projects) for example the following content
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageRestore>
<clear /> <!-- ensure only the sources defined below are used -->
<add key="automatic" value="False" />
</packageRestore>
<packageSources>
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetmaster/api/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<activePackageSource>
<add key="AspNetVNext" value="true" />
<add key="NuGet" value="true" />
</activePackageSource>
</configuration>
See the documentation. I recommend you to open command line in some project folder and to execute
dnu feeds list
command. It will shows that all the NuGet.config
from the current and the parent folders and the global file %appdata%NuGetNuGet.Config
will be combined. NuGet will be search for packages in on all active repositories. It will be https://api.nuget.org/v3/index.json and https://www.myget.org/F/aspnetmaster/api/v3/index.json in the above case.
Possible conflicts could be if multiple NuGet.config
exist, points different NuGet feeds or enable/disable some feeds. The command dnu feeds list
helps here. You should always scan for all NuGet.config
files in your project hierarchy to prevent/resolve the conflicts. The resolution of many conflicts consist mostly in usage of correct feeds or the usage of explicit versions for resolution of packages.
I recommend you to read the article, which describes NuGet Configuration Inheritance.
I hope that you could decide which structure would be better for your existing environment. I would you recommend to hold the standard structure
solution
src
project
folderWithProjects
and to place global.json
and NuGet.config
in the solution directory. The default place for the test-projects: separate from the main projects:
solution
src
project
folderWithProjects
test
testproject1
testproject2
(you can examine the structure of Entity Framework 7 on GitHub or MVC6 here). You can follow the structure or to choose another location and to modify "projects"
part of the global.json
.
UPDATED: Microsoft made a lot of changes between RC1 and RC2. Dnx.exe
will be not more used in ASP.NET Core. One should use dotnet.exe
instead. The description of new/modified global.json
and project.json
are not yet full documented. You can see the preliminary version of the documentation here. The links on the old documentation (under https://docs.asp.net/en/latest/dnx
) are now broken.