hi all
I am a newbie in the asp.net net core world and I am struggling to adding a simple ref .
I get an error
Steps
1) Created an "Asp.net Core Web Application(Net Framework) RC2" .(.net 4.6.1)
2) Added a Class Library (.Net core) called "ClassLibrary1") .(.net 4.6.1)
3)Within the web app i added a reference to the classlibrary in the Project.Jason like this
"dependencies": {
"ClassLibrary1": "1.0.0-*",
4) Get error
Severity Code Description Project File Line Suppression State
Error NU1001 The dependency ClassLibrary1 could not be resolved.
Is this a bug or its me.
Thanks
Hi @developer9969 what is the folder structure of the projects? And do you have a global.json file?
By default the system will only look for project-to-project references within the same "parent" folder, e.g. if you have this:
/src/MyWebSite/project.json --> has a reference to "MyLibrary": "1.0.0-*"/src/MyLibrary/project.jsonBut if you add a global.json file in /src or the / folder above it, you can list additional folders to search for project-to-project references.
hi thanks for your reply.,
FYI
it works if i choose "Asp.net Core WebApplication(.net Core) but not with (.net Framework)
_do you have a global.json file?_ "Yes" I do
/src/MyWebSite/project.json --> has a reference to "MyLibrary": "1.0.0-*"
Yes
Folder structure

hope it helps
BTW the folder structure you see in Visual Studio's Solution Explorer is not always the same as the folder structure on disk. Can you check if the folders on the hard drive for ClassLibrary1 and WebApplication2 are next to each other? I'm guessing they're not.
as far as I can see they are next to each other.
As I said in my previous comment I have done the exact same thing using the other template and worked.
Little rant:
I am grateful that i receive a reply and I understand the eagerness to get it work on linux ,but something as "simple" as adding a reference using the new way of doing it ,it's definetely a step back for developers using Visual studio. I guess is totally normal for those people who code in notepad.I wasted 5 hours trying to understand what is going on etc...
See pic

Can you expand the references node and also look at the error list?
Hi
For semplicity I have uploaded my simple project to my google drive.
https://drive.google.com/open?id=0B_0FY_oSB9pLbFcwX252bHB6VVU
My question would be can you create a Asp.net Core Web Application(Net Framework) RC2" .(.net 4.6.1) and then add a classlibrary and reference it without error?
many thanks
BTW I set up a quick mtg for Monday to discuss this.
Some more information (as I tried to repro this)
If you run dotnet restore you'll get a better error message:
dotnet :
At line:1 char:1
+ dotnet restore
+ ~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Errors in C:\users\joshs\documents\visual studio 2015\Projects\WebApplication3\src\WebApplication3\project.json
Project ClassLibrary1 is not compatible with net461 (.NETFramework,Version=v4.6.1). Project ClassLibrary1 supports: netstandard1.5 (.NETStandard,Version=v1.5)
One or more projects are incompatible with .NETFramework,Version=v4.6.1.
ClassLibrary1 has this project.json:
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
},
"frameworks": {
"netstandard1.5": {
"imports": "dnxcore50"
}
}
}
I'm not going to link the entire project.json in WebApplication2, but here's a subset:
"frameworks": {
"net461": { }
},
OH! That's because .NETstandard 1.5 doesn't support 4.6.1, it only supports 4.6.2+ (of the .NET Framework)
You'll need to bump your classlibrary down to .netstandard1.4.
See graph: https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md#mapping-the-net-platform-standard-to-platforms
guardiannite.
wow .thanks for pointing where i was going wrong.I will do as suggested.I was not familiar with "donet-restore". Only then as you said we see the "real" error
I will set the classlibrary down to .netstandard 1.4.
On another note it looks a bit of a challenge to try to map the right reference to the correct .net standard.I guess we had it too good so far with adding references as visual studio would list the .net version and you could choose the right one.
it would be nice to improve the adding reference experience a bit.
thanks again
@developer9969 , Did it work when you downgrade your library to netstandard1.4 ?
I was having the same issue with .net core 1.0 targeting 4.6.1 (except the error messaging works better now, so you don't need to call dotnet-restore to see the correct error anymore). In addition to changing ".NETStandard.Library" version in class library project.json's dependencies to 1.4.0, I changed "frameworks" in the same file to "net461". The reference works fine now. Many thanks guardiannite!!!
Hi ,
I had the same problem and I resolved by restoring the package NuGet .
I had the same issue unloading and reloading the project fixed it for me.
hai dont worry about that its a simple thing go to the project folder navigate to debug netcoreapp2.0 if you are in dotnet core just delete all the files now open project in visual studio and then try to add ... now it will add as expected
Most helpful comment
as far as I can see they are next to each other.
As I said in my previous comment I have done the exact same thing using the other template and worked.
Little rant:
I am grateful that i receive a reply and I understand the eagerness to get it work on linux ,but something as "simple" as adding a reference using the new way of doing it ,it's definetely a step back for developers using Visual studio. I guess is totally normal for those people who code in notepad.I wasted 5 hours trying to understand what is going on etc...
See pic