I have an ASP.NET Core application that compiles and runs locally. When I try to restore the nuget packages on Visual Studio Team Services (hosted agent) the following errors occurs:
Ix-Async 1.2.5 is not compatible with .NETPlatform,Version=v5.4.
Remotion.Linq 2.0.1 is not compatible with .NETPlatform,Version=v5.4.
System.Collections.Immutable 1.1.36 is not compatible with
.NETPlatform,Version=v5.4.
Some packages are not compatible with .NETPlatform,Version=v5.4.
Ix-Async 1.2.5 is not compatible with DNXCore,Version=v5.0.
Remotion.Linq 2.0.1 is not compatible with DNXCore,Version=v5.0.
Microsoft.CodeAnalysis.CSharp 1.1.0-rc1-20151109-01 is not compatible
with DNXCore,Version=v5.0.
Microsoft.CodeAnalysis.Common 1.1.0-rc1-20151109-01 is not compatible
with DNXCore,Version=v5.0.
Some packages are not compatible with DNXCore,Version=v5.0.
System.Exception: Unexpected exit code 1 returned from tool NuGet.exe
at
Microsoft.TeamFoundation.DistributedTask.Task.Internal.PowerShell.InvokeToolCmdlet.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
The VSTS task that is failing is configured like this:
global.json file is as follows:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-rc1-update1"
}
}
And the project.json file from the web project:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"AutoMapper": "4.2.1",
"Cubic.Site.Data": "1.0.0-*",
"Cubic.Site.Data.Storage": "1.0.0-*",
"Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.Abstractions": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.ViewFeatures": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Newtonsoft.Json": "8.0.3",
"StyleCop.Error.MSBuild": "1.0.0",
"StyleCop.MSBuild": "4.7.54"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
},
"frameworks": {
"dnx451": {
"dependencies": {
}
},
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules"
],
"publishExclude": [
"**.user",
"**.vspscc"
]
}
The solution contains the web app and 2 other class libraries. Site.Data project.son file:
{
"version": "1.0.0-*",
"description": "Site.Data Class Library",
"authors": [ "foo" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"net451": { },
"dotnet5.4": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
}
}
And the other class library project.json file content is:
{
"version": "1.0.0-*",
"description": "Site.Data.Storage Class Library",
"authors": [ "foo" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"net451": {
"frameworkAssemblies": {
"System.Runtime": ""
}
},
"dotnet5.4": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
},
"dependencies": {
"Cubic.Site.Data": "1.0.0-*",
"EntityFramework.Core": "7.0.0-rc1-final",
"EntityFramework.InMemory": "7.0.0-rc1-final"
}
}
Any idea on what's going on? The strange thing is that the first time this error occurred there were absolutely no changes to config files, project files or the solution - only ASP.NET MVC views were modified. Since that moment I wasn't able to restore the nuget packages on VSTS.
I was wondering if something was installed on the hosted agent that is causing this error?
EDIT 2016-06-21
This issue is now fixed, these errors no longer occur!!! I suspect that there were some changes on the hosted agent that would fix this issue, maybe someone from the VSTS can confirm that??
Since you didn't see this issue anymore, it should be caused by the nuget version in Hosted Build Agent. Refer to this link for details: Issues with Hosted Build in Visual Studio Team Services – 6/20 – Resolved.
Final Update: Tuesday, 21 June 2016 16:07 UTC
Our hotfix deployment to restore nuget 3.3 on the Build Agents has
completed by 21 June 2016 ~03:00 UTC. Customers should no longer see
any issues with running Hosted Builds due to nuget package restore.
We understand that customers rely on VS Team Services as a critical
service and apologize for any impact this incident caused.
Sincerely, Manohar
Update: Monday, 20 June 2016 22:10 UTC
The update to nuget.exe from 3.3 to 3.4.3 has been identified as the
root cause of the active restore problems. We are working on a hotfix
to restore the previous nuget version on the build agents.
We will update this post as the hotfix progresses.
Sincerely, Sri Harsha
Initial Update: Monday, 20 June 2016 19:40 UTC We are actively
investigating issues with the build agents of Visual Studio Team
services related to nuget package restore. Some customers may
experience Build failures due to nuget packages being restored
incorrectly in the Build Agents.
Next Update: Before 22:00 UTC We are actively working to resolve this
issue and apologize for any inconvenience.
Sincerely, Manohar
Related
I am build a dotnet core APIm which has SSL enabled. When I try to run I get the following error:
An error occurred attempting to determine the process id of dotnet.exe which is hosting your application. One or more errors occurred.
I have looked at countless pages (StackOverflow and others) that talk about this issue, and I understand the main reasons it can happen. But... I am almost certain none of them are my issue.
Firstly, when I turn off SSL and try to run without it still errors. Secondly, when I go through a process of "repairing" or reinstalling different dotnet core/iis express things it works. After working for some time, it will stop (I think possibly when Visual Studio is closed).
I have been unable to find any pattern as to when it starts working, but I believe it stops when Visual Studio 2015 closes.
Here are a few things I do, which may or may not get it temporarily working:
Repair IIS, giving me a https certificate for localhost
Open firefox or edge with the SSL address (after running without debug) to make sure it has certificate (or certificate exemption)
Repair/uninstall/reinstall dotnet core
Remove IIS Express files from local user
Please could somebody possibly give me either some suggestions for what it could be, or steps to help find out what the specific issue is?
Alternatively some kind of work around that I can use until we upgrade to Visual Studio 2017?
Additional information:
I sometimes use a VPN
project.json
{
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-*",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.EntityFrameworkCore": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"AutoMapper": "5.2.0",
"Swashbuckle": "6.0.0-beta902",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.IdentityModel.Tokens": "5.1.2",
"Microsoft.AspNetCore.Authentication.JwtBearer": "1.1.0",
"OpenIddict": "1.0.0-*",
"OpenIddict.EntityFrameworkCore": "1.0.0-*",
"OpenIddict.Mvc": "1.0.0-*",
"Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel.Https": "1.0.1",
"AspNet.Security.OAuth.Validation": "1.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-*"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"xmlDoc": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"web.config",
"appsettings.json",
"appsettings.production.json",
"appsettings.development.json",
"appsettings.labs.json",
"Resources\\testCert.pfx",
"Resources\\SiteWildcard.pfx"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
launchSettings.json
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:44345/",
"sslPort": 44345
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"App.Api": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
I think I've just figured out what it is... It is happening only when the VPN is active. If I disconnect the VPN it works again. I don't know a solution of how to get it to work whilst the VPN is active, but I am happy enough with the work around for now.
This may come in useful in future to anybody else who has been stuck in the same position. For me the confusion of it sometimes working and sometimes not is because I have to activate and deactivate the VPN to connect to certain things.
https://support.microsoft.com/en-us/help/3180222/warnings-about-an-untrusted-certificate-after-you-install-visual-studio-2015-update-3
The above link worked for me.
You will need to open Windows PowerShell ISE from the windows search bar and enter the following command:
ipmo PKI
$name = [GUID]::NewGuid()
$cerFile = "$env:TEMP\$name.cer"
$certs = Get-ChildItem Cert:\LocalMachine\My -DnsName localhost -SSLServerAuthentication | ? {($_.FriendlyName -eq 'IIS Express Development Certificate') -and ($_.SignatureAlgorithm.FriendlyName -ieq 'sha256RSA') -and ($_.EnhancedKeyUsageList.Count -eq 1)}
if ($certs.Count -eq 0)
{
Write-Error 'Cannot find any SHA256 certificate generated by IIS Express. Please make sure that the latest version of IIS Express is installed.'
}
else
{
foreach ($cert in $certs)
{
Export-Certificate -Cert $cert.PSPath -FilePath $cerFile -Type CERT | Out-Null
Import-Certificate -FilePath $cerFile -CertStoreLocation Cert:\CurrentUser\Root | Out-Null
Remove-Item $cerFile -Force
}
Write-Host 'Successfully installed the certificate to Trusted Root Certification Authorities of the current user.'
}
If the above code doesn't work just go to the link and copy it.
You will then receive a warning message, click yes for that.
Next use windows search to search for mmc to open up the Microsoft Management Console.
You can then follow the rest from the website. Hope it helps
I am following this documentation https://www.microsoft.com/net/core#macos on how to run .NET Core on mac. I have successfully installed the dotnet command and all but when I try to create a new project using dotnet new, it generates a .csproj file as opposed to project.json as described. This doesn't allow me to go on to run dotnet restore or dotnet run to run this new project. I don't know what I'm missing out here. Kindly assist.
I found a way around this. I created a project.json file and put the necessary parameters in it. In this case,
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0"
},
"imports": "dnxcore50"
}
}
}
Then dotnet restore works there on.
Cheers!
I am trying to create first sample application running with ASP.NET 5 on OS X. However I just can't figure out how project.json dependencies work.
I generated Web Api Application with yeoman and everything had worked fine until I've tried to use WebClient.
According to dnvm list I'm running:
* 1.0.0-rc1-update2 mono linux/osx
And while restore packages goes well the project fails at build step.
Here is my project.json file:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"tooling": {
"defaultNamespace": "LocationService"
},
"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
},
"frameworks": {
"dnx451": {
"dependencies": {
"System.Web.Http": "4.0.0"
}
},
"dnxcore50": {
}
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"**.user",
"**.vspscc"
]
}
And project fails on build with unresolved reference:
LocationService/Controllers/ValuesController.cs(32,40):
DNXCore,Version=v5.0 error CS0246: The type or namespace name
'WebClient' could not be found (are you missing a using directive or an
assembly reference?)
I've tried add dependency both under dnxcore50 and dnx451.
Dmvm tells me that I can use coreclr x64 but it seems just not works in my case - ends up with numerous unresolved references during build.
WebClient is not available (yet?) for dnxcore.
Try removing dnxcore50 framework or use HttpClient or HttpWebRequest instead of WebClient.
I have ASP.NET Core project which has both netcoreapp and net46 in frameworks section. I can build and run it without any problem on Mac OS X. But when i open it in VSCode it shows tons of errors like this: Predefined type '...' is not defined or imported [net46] and everything is red.
Is there any way to fix it without removing net46 from project.json?
Frameworks section of my project.json:
"frameworks": {
"net46": {
"dependencies": {
"System.Net.Http": "4.0.0-*"
}
},
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-*",
"type": "platform"
},
"System.Net.Http": "4.0.1-*"
},
"imports": [
"dnxcore50"
]
}
}
In a Visual Studio 2015 solution I have a folder structure as follows:
-src
-Project.Models
(...)
-MyModel.cs
-Project.Web
(...)
-Controllers
-MyControllers.cs
-Dependencies
-project.json
Where Project.Web is a ASP.NET 5 Web API project and Project.Models a ASP.NET 5 Class Library.
Now I want to use MyModel of Project.Models in MyController of Project.Web. To do this I need to reference the Models project from the Web project. I cannot get this to work here. The using Project.Models statement keeps highlighting the Models part in red because the assembly reference cannot be found.
What I tried:
The usual "Add reference" in combination with using statement
Creating a NuGet package of Project.Models (by specifying "Compile on built" in properties), adding the NuGet package to a local repository and referencing it in project.json.
Both things do not seem to work also after restarting Visual Studio.
Can someone explain to me how to accomplish referencing the Project.Models from Project.Web?
/Edit Include project.json:
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-beta5",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta5",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta5",
"Microsoft.AspNet.Loader.IIS": "1.0.0-beta5",
"Microsoft.AspNet.Loader.IIS.Interop": "1.0.0-beta5",
"Microsoft.Framework.Runtime": "1.0.0-beta5",
"Microsoft.AspNet.Mvc.Xml": "6.0.0-beta5",
"MongoDB.Driver": "2.0.1"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --config hosting.ini"
},
"frameworks": {
"dnx451": { }
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
]
}
And global.json
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta5",
"runtime": "coreclr",
"architecture": "x86"
}
}
The problem was that I was using .NET Core. When I changed my frameworks entry in the project.json file to use
"dnx451": { }
instead of
"dnxcore50": { }
the references were included again (the red of the image became black). Seems like .NET core does not (yet?) support all packages.