Referenced Projects do not allow referencing via "name" element in project.json
See original GitHub issueSteps to reproduce
I have a repository with reproducible steps here. You may clone it, perform dotnet restore
on /AppLib and then on /App to see the issue.
I have the following directory structure.
Root
/src
/App
/AppLib
AppLib has a simple project.json
using a name
element to define it’s name as FooLib
{
"name": "FooLib",
"version": "1.0.0",
"authors": [ "scionwest" ],
"dependencies":{
},
"frameworks": {
"netstandard1.1": {
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027",
"System.Linq.Expressions": "4.0.11-rc2-24027"
}
}
}
}
It has a single class
namespace AppLib
{
public class MyClass
{
}
}
The App
project has a simple project.json
as well, referencing the AppLib
via it’s folder name.
{
"version": "1.0.0",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"AppLib": "1.0.0",
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002702"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}
It has the basic Program.cs
class
using System;
using AppLib;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
var c = new MyClass();
Console.WriteLine("Hello World!");
}
}
}
Run dotnet restore
on both projects, then run dotnet run
to see this work correctly.
Next, modify the /App/project.json to reference FooLib
instead of AppLib
, then dotnet restore
the App project to generate the error.
Expected behavior
The App project should be able to reference the AppLib via its name defined in project.json
instead of the folder name.
Actual behavior
Unable to resolve ‘FooLib (>= 1.0.0)’ for ‘.NETCoreApp,Version=v1.0’.
Environment data
.NET Command Line Tools (1.0.0-preview1-002702)
Product Information: Version: 1.0.0-preview1-002702 Commit Sha: 6cde21225e
Runtime Environment: OS Name: Mac OS X OS Version: 10.11 OS Platform: Darwin RID: osx.10.11-x64
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
I’m not renaming a project though, are you saying that the folder name is the project name? If so, what is the point of the name element in the
project.json
?We’ll track this in dotnet/sdk#5868