I hit an issue trying to build a web application for Asp.NET Core 1.0 using dnx core and Visual Studio Code on Windows 7. I used Yeoman to generate an empty application and then ran dnu restore
. This gives the following output:
Microsoft .NET Development Utility CoreClr-x64-1.0.0-rc1-16609
CACHE https://api.nuget.org/v3/index.json
Restoring packages for d:\development\asp.net core\yeoman_test\EmptyApplication\
project.json
Writing lock file d:\development\asp.net core\yeoman_test\EmptyApplication\proje
ct.lock.json
----------
System.ArgumentOutOfRangeException: Specified argument was out of the range of v
alid values.
Parameter name: supportedFrameworks
at NuGet.NetPortableProfile..ctor(String frameworkDirectory, String name, IEn
umerable`1 supportedFrameworks)
at NuGet.NetPortableProfileTable.LoadPortableProfile(String versionDirectory,
String profileDirectory)
at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at NuGet.NetPortableProfileTable.BuildPortableProfileCollection()
at NuGet.NetPortableProfileTable.GetProfileData()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at NuGet.NetPortableProfileTable.GetProfile(String profileName)
at NuGet.NetPortableProfile.Parse(String profileValue)
at NuGet.VersionUtility.IsPortableLibraryCompatible(FrameworkName frameworkNa
me, FrameworkName targetFrameworkName)
at NuGet.VersionUtility.IsCompatible(FrameworkName frameworkName, FrameworkNa
me targetFrameworkName)
at NuGet.ContentModel.ContentItemCollection.FindBestItemGroup(SelectionCriter
ia criteria, ContentPatternDefinition[] definitions)
at Microsoft.Dnx.Tooling.Utils.LockFileUtils.CreateLockFileTargetLibrary(Lock
FilePackageLibrary library, IPackage package, RestoreContext context, String cor
rectedPackageName)
at Microsoft.Dnx.Tooling.RestoreCommand.WriteLockFile(LockFile previousLockFi
le, String projectLockFilePath, Project project, List`1 graphItems, PackageRepos
itory repository, IProjectResolver projectResolver, IEnumerable`1 contexts)
at Microsoft.Dnx.Tooling.RestoreCommand.<RestoreForProject>d__69.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
ification(Task task)
at Microsoft.Dnx.Tooling.RestoreCommand.<>c__DisplayClass68_0.<<Execute>b__2>
d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
ification(Task task)
at Microsoft.Dnx.Tooling.RestoreCommand.<Execute>d__68.MoveNext()
----------
Restore failed
Specified argument was out of the range of valid values.
Parameter name: supportedFrameworks
NuGet Config files used:
C:\Users\<user>\AppData\Roaming\NuGet\nuget.config
Feeds used:
https://api.nuget.org/v3-flatcontainer/
My dnvm output for the current runtime:
* 1.0.0-rc1-update2 coreclr x64 win default
And the project.json:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"tooling": {
"defaultNamespace": "EmptyApplication"
},
"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules"
],
"publishExclude": [
"**.user",
"**.vspscc"
]
}
I can replicate the issue in a minimal form using just the following project.json (and no other files in the directory):
{
"dependencies": {
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final"
},
"frameworks": {
"dnxcore50": {}
}
}
I've dug into Kestrel's nuget package and its dependencies (for DNXCore5.0) are:
<group targetFramework="DNXCore5.0">
<dependency id="Microsoft.AspNet.Hosting" version="1.0.0-rc1-final" />
<dependency id="Microsoft.Extensions.Logging.Abstractions" version="1.0.0-rc1-final" />
<dependency id="System.Numerics.Vectors" version="4.1.1-beta-23516" />
<dependency id="System.Collections" version="4.0.11-beta-23516" />
<dependency id="System.Diagnostics.Debug" version="4.0.11-beta-23516" />
<dependency id="System.Diagnostics.TraceSource" version="4.0.0-beta-23516" />
<dependency id="System.Diagnostics.Tracing" version="4.0.21-beta-23516" />
<dependency id="System.Globalization" version="4.0.11-beta-23516" />
<dependency id="System.IO" version="4.0.11-beta-23516" />
<dependency id="System.Linq" version="4.0.1-beta-23516" />
<dependency id="System.Net.Primitives" version="4.0.11-beta-23516" />
<dependency id="System.Runtime.Extensions" version="4.0.11-beta-23516" />
<dependency id="System.Runtime.InteropServices" version="4.0.21-beta-23516" />
<dependency id="System.Text.Encoding" version="4.0.11-beta-23516" />
<dependency id="System.Threading" version="4.0.11-beta-23516" />
<dependency id="System.Threading.Tasks" version="4.0.11-beta-23516" />
<dependency id="System.Threading.Thread" version="4.0.0-beta-23516" />
<dependency id="System.Threading.ThreadPool" version="4.0.10-beta-23516" />
<dependency id="System.Threading.Timer" version="4.0.1-beta-23516" />
</group>
I worked through these and found that changing my project.json dependencies to just contain either Microsoft.AspNet.Hosting
or System.Numerics.Vectors
caused the same error with supportedFrameworks. There may be others, but after Microsoft.Extensions.Logging.Abstractions
, System.Collections
, and System.Diagnostics.Debug
worked I decided to ask here before continuing.
I assume I'm doing something silly, of course, but can't seem to work out exactly what.
Reference Assemblies\Microsoft\Framework\.NETPortable
folder is an empty shell, containing only empty profiles with empty supportedFramework folders. Possibly left from uninstalling VS2015? Deleting that folder fixed the issue, if you want to write an answer I'll mark it as accepted.