After we upgraded our web application to asp.net core 1.0 we're unable to get a successfull build within Appveyor.
There are several nuget packages issues, the first error is:
Microsoft.AspNetCore.Mvc 1.0.0 is not compatible with .NETCoreApp,Version=v1.0.
On of the feed that is used is https://www.nuget.org/api/v2 and we think it should use the V3 version to be able to build core 1.0 web projects.
Is our assumption correct and how do we force appveyor to use the v3 api instead v2?
How do we get a successful build for our asp.net core 1.0 project?
UPDATE
Our assumption seems not to be correct, with the command
nuget sources update -Name nuget.org -Source https://api.nuget.org/v3/index.json
the new v3 feed is successfully used but the build still fails with the same errors.
dotnet information from build-server:
.NET Command Line Tools (1.0.0-preview2-003121)
Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: removed
Runtime Environment:
OS Name: Windows
OS Version: 6.3.9600
OS Platform: Windows
RID: win81-x64
And our project.json:
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "default"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "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",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.DotNet.Watcher.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"compile": {
"exclude": [
"wwwroot",
"node_modules"
]
}
},
"runtimes": {
"win10-x64": {}
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
//"publishExclude": [
// "**.user",
// "**.vspscc"
//],
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
And global.json
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003121"
}
}
Try updating nuget source during the build with this command:
nuget sources update -Name nuget.org -Source https://api.nuget.org/v3/index.json
Related
I want to use WebListener in an ASP.NET Core Application in Azure Service Fabric.
I have did the following:
Task<string> ICommunicationListener.OpenAsync(CancellationToken cancellationToken)
{
var endpoint = FabricRuntime.GetActivationContext().GetEndpoint(_endpointName);
string serverUrl = $"{endpoint.Protocol}://{FabricRuntime.GetNodeContext().IPAddressOrFQDN}:{endpoint.Port}";
_webHost = new WebHostBuilder().UseWebListener()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseUrls(serverUrl)
.Build();
_webHost.Start();
return Task.FromResult(serverUrl);
}
Unfortunatelly this does not work. I created a WEB API Controller and when I call this it Returns 404.
When I use Kestrel it works:
_webHost = new WebHostBuilder().UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseUrls(serverUrl)
.Build();
This is my projects.json:
{
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.Server.WebListener": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.ServiceFabric": "5.3.301",
"Microsoft.ServiceFabric.Data": "2.3.301",
"Microsoft.ServiceFabric.Services": "2.3.301"
},
"commands": {
"weblistener": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener"
},
"tools": {
},
"frameworks": {
"net452": {
"dependencies": {
}
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
}
}
Am I missing something?
The reason to use Web Listener is that I want to use Windows Authentication with my intranet application so that users will not have to manually enter a username and Password.
Try using a wildcard host, like this:
string serverUrl = $"{endpoint.Protocol}://+:{endpoint.Port}";
I am trying to create an application using Microsoft SQL Server database using Entity Framework Core.
This is what I have done so far
Step 1: From Nuget Package manager I have installed: Install-Package Microsoft.EntityFrameworkCore.SqlServer
Step 2: From Nuget Package manager I have installed (for Entity Framework commands) : Install-Package Microsoft.EntityFrameworkCore.Tools –Pre
And my project.json looks as under
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-final",
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}
But it throws error
a) The dependency Microsoft.EntityFrameworkCore.SqlServer >= 1.0.1 could not be resolved.
b) The dependency Microsoft.EntityFrameworkCore.Tools >= 1.0.0-preview3-final could not be resolved.
Screen shot
I am using
VS 2015 Update 3
Not net framework 4.6.1
Why it is throwing the error and how can i fix it?
I think is because you are missing Microsoft.EntityFrameworkCore, try this:
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.EntityFrameworkCore": "1.0.1",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-final"
}
You won't need to restore the packages using Nuget, the changes in project.json should automatically restore those packages.
The above works for me, if it doesn't for you maybe there's something else, let me know.
I created a new Web Api project after installing the latest visual studio updates for TC 2.
Added entity Microsoft.EntityFrameworkCore": "1.0.0-rc2-final and Microsoft.EntityFrameworkCore.Tools: 1.0.0-preview1-final to the project.
Opened a command line and typed dotnet ef.
At this point I got an error:
Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
Have I got the wrong tools version?
The version I used is what was available from intellisense.
Excerpt from project.json:
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
"Microsoft.NETCore.Platforms": "1.0.1-rc2-24027",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final" ,
"type": "build"
}
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools": {
"imports": [ "portable-net451+win8" ],
"version": "1.0.0-preview1-final"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8",
"portable-net451+win8"
]
}
},
A workaround that saved my day.
Delete:
%USERPROFILE%\.nuget\packages\.tools\Microsoft.EntityFrameworkCore.Tools
%USERPROFILE%\.nuget\packages\Microsoft.EntityFrameworkCore.Tools
Re-run dotnet restore
This appears to be known issue in RC2.
I will mark this as answered and wait for the EF team to sort it out.
I also had to add InternalAbstractions manually in the project.json file:
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
https://github.com/dotnet/core/issues/366
In entity framework core 1.0 RC1 when I published a website, it generated a ef.cmd file, I can ran ef database update to update the product database. How can I do it in RC2 when there is no ef.cmd file.
With RC2, you need to install the tooling via your project.json file, then issue dotnet restore. Here is a sample project.json which also brings in EntityFrameworkCore.SQLite:
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002702"
},
"Microsoft.EntityFrameworkCore.Tools": {
"type": "build",
"version": "1.0.0-preview1-final"
},
"Microsoft.EntityFrameworkCore.SQLite": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
},
"tools": {
"Microsoft.EntityFrameworkCore.Tools": {
"imports": ["portable-net451+win8"],
"version": "1.0.0-preview1-final"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": "portable-net451+win8"
}
}
}
The important parts here are:
"Microsoft.EntityFrameworkCore.Tools": {
"type": "build",
"version": "1.0.0-preview1-final"
}
And
"tools": {
"Microsoft.EntityFrameworkCore.Tools": {
"imports": ["portable-net451+win8"],
"version": "1.0.0-preview1-final"
}
},
These tell the dotnet restore command to download the tooling for entity framework. Now you'll be able to use the .NET Core CLI Entity Framework functionality.
This will let you do things like:
$ dotnet ef migrations add myMigration
$ dotnet ef database update
I made a new Class Library (Package) project in VS 2015 and added a reference to Microsoft.Owin package, however I can't access the Microsoft.Owin namespace.
This is my project.json file:
{
"version": "1.0.0-*",
"description": "Class1 Class Library",
"authors": [ "sebastiano.roncato" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"System.Collections": "4.0.10-beta-23019",
"System.Linq": "4.0.0-beta-23019",
"System.Threading": "4.0.10-beta-23019",
"System.Runtime": "4.0.10-beta-23019",
"Microsoft.CSharp": "4.0.0-beta-23019",
"Microsoft.Owin": "3.0.0",
"Owin": "1.0.0"
},
"frameworks": {
"dotnet": { }
}
}