Reputation: 7334
I have a project with a reference by src to another project.
When running from the command prompt with dnx web is works fine.
But running with CTRL-F5 (web) give me an error
The context of the project at could not be determined. This can happen if a project references other projects by source, and those projects have a global.json file specifying a different version of the SDK.`
running with dnx-watch I got this error
System.ArgumentException: The directory name C:\git\Localization\src\JsonLocalization\project.json is invalid.`
Main solution global.json
{
"projects": [
"src",
"test",
"../TagHelpers/src",
"../Mvc.JQuery.Datatables/src",
"wrap",
"../Localization/src"
],
"sdk": {
"version": "1.0.0-beta8"
}
}
Main Project.json
{
"webroot": "wwwroot",
"userSecretsId": "aspnet5-GGZDBC5-d96c66a6-1a4e-4a9a-b8d4-11c2f88ff638",
"version": "1.0.0-*",
"dependencies": {
"CsvHelper": "2.13.1",
"EntityFramework.Commands": "7.0.0-beta8",
"EntityFramework.SqlServer": "7.0.0-beta8",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta8",
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta8",
"Microsoft.AspNet.Authentication.Google": "1.0.0-beta8",
"Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta8",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta8",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta8",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta8",
"Microsoft.AspNet.Http": "1.0.0-beta8",
"Microsoft.AspNet.Http.Features": "1.0.0-beta8",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta8",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8",
"Microsoft.AspNet.Mvc": "6.0.0-beta8",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta8",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta8",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta8",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta8",
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta8",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
"Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta8",
"Microsoft.Framework.Logging": "1.0.0-beta8",
"Microsoft.Framework.Logging.Console": "1.0.0-beta8",
"Microsoft.Framework.Logging.Debug": "1.0.0-beta8",
"Microsoft.Framework.SecretManager": "1.0.0-beta8",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta8",
"Newtonsoft.Json": "7.0.1-*",
"Mvc6.JQuery.Datatables": "1.0.0-*",
"npm": "1.4.15.2",
"TagHelpers": "1.0.0-*",
"Microsoft.AspNet.Localization": "1.0.0-beta8",
"JsonLocalization": "1.0.0-*"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": {
"dependencies": {
"DataTables": "1.0.0-*"
},
"frameworkAssemblies": {
"System.Web": "4.0.0.0"
}
}
},
...
}
Localization global.json
{
"projects": [
"src",
"test"
],
"sdk": {
"version": "1.0.0-beta8"
}
}`
project.json
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.Framework.Localization": "1.0.0-beta8",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta8",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
"Newtonsoft.Json": "7.0.1-*"
},
"frameworks": {
"dnx451": { }
}
}
Upvotes: 1
Views: 1010
Reputation: 4687
It's worth mentioning, this can occur if there are multiple global.json
files.
In my case, I was referencing a dependency as a Git Submodule. I added the submodule projects to the primary solution in order to debug the dependency which caused the error listed in the OP.
Deleting the global.json
(temporarily) from the submodule resolved the issue.
Upvotes: 0
Reputation: 146188
After spending HOURS messing with this and getting errors like :
RRStore.EF could not be determined. This can happen if a project references other projects by source, and those projects have a global.json file specifying a different version of the SDK.
I added a global.json
file (which was otherwise nowhere to be seen) but that made no difference.
Then I eventually decided to try
Restart Visual Studio and it worked instantly even with no global.json
Upvotes: 1
Reputation: 7334
I added the global.json at the wrong location. After moving the file to C:\git\Localization\global.json the project works fine under VS2015.
It seems that VS2015 doesn't add the project as there are reference conflict. Adding as existing project to a solution will always work but lead sometimes to conflicts.
Removing the projects can be done with the folling steps. * Remove from global.json. * remove projects from solution (probably not needed any more) * remove projects.json.lock
Upvotes: 0