ASP.NET Core (vNext) project can't find reference to 4.51 - asp.net-core

I have a asp.net 5 (vNext) project with a project.json that is named FMS.DOMAIN. One of the references is a dotNet 4.51 project named FMS.DAL.
This works on all machine except one. On one machine it can't find this dotNet 4.51 project. I think it is looking for it on a public nuget server.
When I do 'dnu restore' I see this:
C:_Workspaces\MyProject\MyProject\FMS.Domain\project.json
CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='FMS.DAL'
Unable to locate Dependency FMS.DAL >= 1.0.
This is the project.json from FMS.Domain.
{
"version": "1.0.0-*",
"description": "FMS.Domain Class Library",
"authors": [ "ctcrrmcidmc" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"dnx451": {
"dependencies": {
"FMS.DAL": "1.0.0-*"
}
}
},
"dependencies": {
"AutoMapper": "4.1.1",
"FMS.Common": "1.0.0-*"
}
}
How does it know when to search nugget and when to use a local project? The reference to "FMS.Common": "1.0.0-*" is also a local project and it's working (but it's vNext).
We did get it to work if we had a reference to the DLL directly using the 'Add Reference' context menu. That produce an edit the project.json that look the same as the manual edit but it works. It must be doing something else.
More Info:
I blew away my workspace and got the code fresh from TFS. I am getting the problem on my machine. I see this error with 'dnu restore':
CACHE https://www.nuget.org/api/v2/FindPackagesById()?id='FMS.DAL'
nable to locate Dependency FMS.DAL >= 1.0.0
It is looking for FMS.DAL at nuget.org instead of in my project. I removed the dependency from project.json and saved, then I add it back by right-clicking on references and picking a project reference. It's added back to project.json and looks exactly the same as before I removed it. I run 'dnu restore' again and it works.
The only pending change is in project.json and when I do a compare with TFS there are no differences. Then I did an undo pending changes for the entire solution and 'dnu restore' still works.

Related

Reference local build of Microsoft.AspNetCore.Mvc in AspNetCore application

How can I reference a local build of Microsoft.AspNetCore.Mvc in my Asp.Net Core application? I'm trying to debug something in the framework. I've pulled down the source and have it compiled, but I can't get my application to see the location to pick-up the code.
My global.json file:
{
"projects": [
"src",
"test",
"c:/source/repos/mvc/src"
],
"sdk": {
"version": "1.0.0-preview2-003131"
}
}
Snippet of my package.json file. The version is the same version as the DLL that is built:
"dependencies": {
"Microsoft.AspNetCore.Mvc": {
"version": "1.2.0-preview1",
"type": "build"
},
If you want to be sure it will use the project reference instead of the nuget reference you can specify the dependency target:
"Microsoft.AspNetCore.Mvc": {
"version": "1.2.0-preview1",
"type": "build",
"target" : "project" //this will make sure it only looks for a project
},
Also make sure you run dotnet restore before you build the project.

Need Help Building ASP.NET Core Source Because of Missing .Net Version

I can't seem to find the version of asp.net core that is wanted to build what is at the current asp.net core site. I'm currently getting the error that vs is looking for v 1.0.0-preview2-1-003180 but I can't find that anywhere to install. I'ved looked here:
https://github.com/dotnet/core/blob/master/release-notes/download-archive.md
What is the recommended way to download the source from
https://github.com/aspnet/Mvc
and build it. (I'm on the dev branch).
Update:
There are 13 projects in the solution. There is a global.json in solution and a project.json in each project.
Here is the global.json:
{
"projects": [
"src",
"test/WebSites",
"samples"
],
"sdk": {
"version": "1.0.0-preview2-1-003180"
}
}
Try updating "frameworks" property of project.json to something like:
"frameworks": {
"netcoreapp1.1": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
}
},
"imports": "dnxcore50"
}
},
This should target .NET Core 1.1 rather than the specific SDK version you are receiving an error on.
Hopefully that helps!

AspNetCore namespace doesnt exist

I'm following this course to learn ASP.NET Core.
I did exactly as they did, I can type dotnet new and dotnet restore.
I also installed the dotnetcore 1.0.1 SDK preview.
All seems fine, and I should be able to type
using Microsoft.AspNetCore.Http;
But the only things recognized after Microsoft are cSharp, visualbasic and win32?
Here is my project.json file:
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
},
"Microsoft.AspNet.WebApi": "5.2.3",
"Microsoft." **<< i cannt type AspNetCore here**
},
"imports": "dnxcore50"
}
}
There is no Microsoft."AspNetCore". The only things I do have starting with Asp are:
AspNet.Identity.Owin
AspNet.Mvc
AspNet.Providers.Core
AspNet.Razor
AspNet.SignalR
AspNet.Web.Optimization
AspNet.WebApi
AspNet.WebApi.Clients
AspNet.WebApi.Core
AspNet.WebApi.Cors
AspNet.WebPages
The code completion doesn't always work when editing the project.json file, especially if you're using a lighter editor like VS Code. (Sometimes it doesn't work even in full-blown Visual Studio).
If this happens, don't worry! You can still install any packages you need. Find packages by searching on NuGet and then edit the dependencies section like this:
"PackageName": "1.0.0" # Version from package details on NuGet
Then, use the dotnet restore command within the project directory to pull down all the packages in project.json.

Why can't EntityFramework.Core be added to a simple PCL?

Am I missing something obvious?
Open Visual Studio 2015 Update 2
Add a new Portable Class Library project, targeting .NET 4.6 and UWP 10
Attempt to install NuGet package Microsoft.EntityFrameworkCore v1.0.0-rc2-final
It fails with "EntityFramework.Core 7.0.0-rc1-final is not compatible with .NETPlatform,Version=v5.0."
Is this supposed to work?
EDIT
Just to clarify, here is my PCL properties:
Installation with nuget unfortunately does not working out of the box. You have to modify the project.json by your self to get it working!
https://docs.efproject.net/en/latest/miscellaneous/rc1-rc2-upgrade.html
"tools": {
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
}
For more info :
Trying to install EF Core with Portable Class Library targeting .Net 4.6.1

ASP.Net 5 RC1 unresolved dependency: NU1001 The dependency ... >= 1.0.0-* could not be resolved

I hoping someone can help shed some light on how to get around this issue. I've noticed this issue while attempting to add a classic .csproj class library to a ASP.NET 5 RC1 xproj project and while attempting to add references to regualar .NET 4.5-4.6 assemblies to xproj based ASP.NET 5 RC1 projects. In this particular case I'm trying to add a reference to Microsoft.WindowsAzure.ServiceRuntime to an ASP.NET 5 WebApi project. I can see a wrap file get's generated that looks like this:
{
"version": "1.0.0-*",
"frameworks": {
"dnx46": {
"bin": {
"assembly": "../../lib/dnx46/Microsoft.WindowsAzure.ServiceRuntime.dll"
}
}
}
}
The reference in the project.json file looks like this:
"frameworks": {
"dnx46": {
"dependencies": {
"Microsoft.WindowsAzure.ServiceRuntime": "1.0.0-*"
}
}
},
When open up the project.lock.json file I see the following get added:
"DNX,Version=v4.6": [
"Microsoft.WindowsAzure.ServiceRuntime >= 1.0.0-*"
]
When I look at the references in visual studio I see the following:
What am I doing wrong? Is there any kind of workaround for this issue?