Need Help Building ASP.NET Core Source Because of Missing .Net Version - asp.net-core

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!

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.

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.

Adding Microsoft.EntityFrameworkCore.Tools to a ASP.NET Core project

I am creating a new ASP.NET Core project using dotnet 4.5.2 and am trying to add a reference to Microsoft.EntityFrameworkCore.Tools. In my project.json file I have these listed under dependencies:
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
Looking under References, they appear to be successfully loaded. I then added this under tools in project.json:
"Microsoft.EntityFrameworkCore.Tools": {
"imports": [ "portable-net451+win8" ],
"version": "1.0.0-preview2-final"
}
After I added that, when I build the solution I get this build error:
Could not find a part of the path 'C:\Users\(my user name)\.nuget\packages\.tools\Microsoft.EntityFrameworkCore.Tools'
I get the same error if I remove the imports line. What am I doing wrong here?
Just ran into the same issue.
I fixed the issue by installing the tools package again in the package manager console:
Install-Package Microsoft.EntityFrameworkCore.Tools –Pre
Before reinstalling the package was actually missing in the .nuget\packages.tools folder, after reinstalling it was there.
I followed the https://docs.efproject.net/en/latest/platforms/aspnetcore/new-db.html tutorial, but I think I installed the package in the wrong order or initially forgot to reference the EF.tools package in the "tools" section of the project json.
I had this same problem and just solved using the examples from the EF Core setup guide from Microsoft, checking their GitHub code as well, I found this to work for the project.json.
I had to remove the imports from the "frameworks" property, which means no Application Insights for now. Once I did this and built, the folder appeared in the tools folder. Sorry I'm not good at posting code here but here are the important parts, ... elipses used to trim the post of my other things:
"dependencies": {
...
"Microsoft.EntityFrameworkCore": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.0.0",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
} ...},
"tools": {
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
}...
I had the same issue and had to add the following to my project.json.
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0-preview1-final"
The only difference is that I'm working with the newly release .NET Core 1.1, ASP.NET 1.1 and Entity Framework 1.1.
I had the same issue and tried many things. I found out that Design and Tools need to be the same version but intellisense was not giving me options common to both packages. Then I found this article and tried its code.
https://learn.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet
Using the following code from that article solved the issue for me;
"dependencies": {
"Microsoft.EntityFrameworkCore.Design": {
"type": "build",
"version": "1.0.0-preview2-final"
}
"Microsoft.EntityFrameworkCore.Tools": {
"type": "build",
"version": "1.0.0-preview2-final"
},
},
...
"tools": {
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},
My problem was I had Microsoft.EntityFrameWorkCore.Tools instead of Microsoft.EntityFramework.Tools, note the lowercase w.

Reference a Full Framework Library Project from ASP.NET Core MVC Web Application (RC2)?

I'm currently using ASP.NET Core MVC RC2 which is suppose to support referencing a full framework library Project from a Core MVC Web Application Project. But I can't seem to make it work.
I have an existing full framework library project that I'd like to use with a new Core MVC Web application project. But when I try to add a reference to the library's project I get an error that says the target framework for it is incompatible with the target framework for the web application.
To try to simplify the problem I created a new Core MVC web application and a new Windows Code Library and tried to add a reference from the web application project to the library's project and got the same error message. I've searched on stack overflow and I did find this question that seemed highly relevent:How to make ASP.NET Core RC2 app build on net46 framework with older third party dependencies but I was unable to use the information there to solve my issue.
Here are the steps to reproduce the issue:
I created a solution with a ".NET Core" "ASP.NET Core Web Application" project based on the "Web Application" template in Visual Studio 2015.
I then added a new "Windows" "Class Library" project to the solution.
So at this point the solution looks like this:
Now, when I try to use visual studio to add reference from the Core MVC Web Application to the Full Framework library I get an error that says that "ExampleLib has a target frameworks that are incompatible with the targets in current project ExampleWebApplicaiton.":
This error seems fairly self explanatory and seems to want me to change the framework that the web application is targeting so that it's the same as the library, which makes perfect sense. The problem is that I can't find documentation on how to do that and intellisense isn't being particularly helpful.
I suspect I need to change one of the following pieces of the project.json file for the web application:
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
or
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
How do I specify .NETFramework Version 4.6 for the Core MVC Web Application instead of .NETCoreApp?
There is a template that allows you to target the full .NET framework - sorry, can't post an image yet, but you can go to:
Templates -> Visual C# -> Web -> ASP.NET Core Web Application (.NET Framework)
Note that you can specify the version of the .NET Framework from the dropdown above (as per usual).
This will change your project.json to:
"frameworks": {
"net461": { }
}
(depending on the framework version that you've selected). You will now be able to add a reference to your class library.
"frameworks": {
"net461": {
"dependencies": {
"ClassLibrary1": {
"target": "project"
}
}
}
}
Following Ron C's steps here's the complete project.json for a web api project I just tested and it worked.
{
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"net461": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
],
"frameworkAssemblies": {
"System.Data": "4.0.0.0"
}
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}

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?