Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't publish asp.net 5 application after update to beta8 - the dependency ... could not be resolved

I have updated a webApi asp.net5 application to beta8 and can't publish to the file system any more.

The build seems to work, i can debug and run the app, but if i try to publish i get errors like this...

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(156,5): Error : Build failed.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(11,20): Error NU1001: The dependency AntiXSS >= 4.2.1 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(12,24): Error NU1001: The dependency Devshed.Csv >= 1.3.8 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(13,27): Error NU1001: The dependency Devshed.Shared >= 1.3.7 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(14,22): Error NU1001: The dependency DotNetZip >= 1.9.2 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(15,29): Error NU1001: The dependency Iesi.Collections >= 3.2.0.4000 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(16,25): Error NU1001: The dependency MongoDB.Bson >= 2.0.0 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(17,27): Error NU1001: The dependency MongoDB.Driver >= 2.0.0 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(18,32): Error NU1001: The dependency MongoDB.Driver.Core >= 2.0.0 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(19,23): Error NU1001: The dependency NHibernate >= 3.3.4.4000 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(20,17): Error NU1001: The dependency NLog >= 4.1.2 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(21,24): Error NU1001: The dependency NLog.Config >= 4.1.2 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(22,24): Error NU1001: The dependency NLog.Schema >= 4.0.1 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(23,31): Error NU1001: The dependency System.Data.SQLite >= 1.0.90 could not be resolved.
C:\Projekte\Workfolders\software\trunk\wrap\LibInternal.Database\project.json(24,24): Error NU1001: The dependency LibInternal >= 1.0.0-* could not be resolved.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(156,5): Error : Build failed.


3>Publish failed due to build errors. Check the error list for more details.
========== Build: 2 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

Here is the Project.json file:

{
  "webroot": "wwwroot",
  "version": "1.0.0-*",

  "dependencies": {
    "Microsoft.AspNet.Cors": "6.0.0-beta8",
    "Microsoft.AspNet.Hosting": "1.0.0-beta8",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8",
    "Microsoft.AspNet.Mvc": "6.0.0-beta8",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-beta8",
    "Microsoft.AspNet.StaticFiles": "1.0.0-beta8",
    "MongoDB.Driver": "2.0.1"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
  },

  "frameworks": {
    "dnx451": {
      "dependencies": {
        "LibInternal.Database": "1.0.0-*"
      }
    }
  },

  "exclude": [
    "wwwroot",
    "node_modules",
    "bower_components"
  ],
  "publishExclude": [
    "node_modules",
    "bower_components",
    "**.xproj",
    "**.user",
    "**.vspscc"
  ]
}

LibInternal.Database is a .NET Framework 4.5 Project.

Here is packages.config from LibInternal.Database:

<packages>
  <package id="AntiXSS" version="4.2.1" targetFramework="net45" />
  <package id="Devshed.Csv" version="1.3.8" targetFramework="net45" />
  <package id="Devshed.Shared" version="1.3.7" targetFramework="net45" />
  <package id="DotNetZip" version="1.9.2" targetFramework="net45" />
  <package id="Iesi.Collections" version="3.2.0.4000" targetFramework="net45" />
  <package id="MongoDB.Bson" version="2.0.0" targetFramework="net45" />
  <package id="MongoDB.Driver" version="2.0.0" targetFramework="net45" />
  <package id="MongoDB.Driver.Core" version="2.0.0" targetFramework="net45" />
  <package id="NHibernate" version="3.3.4.4000" targetFramework="net45" />
  <package id="NLog" version="4.1.2" targetFramework="net45" />
  <package id="NLog.Config" version="4.1.2" targetFramework="net45" />
  <package id="NLog.Schema" version="4.0.1" targetFramework="net45" />
  <package id="System.Data.SQLite" version="1.0.90.0" targetFramework="net45" />
</packages>

And this is the .pubxml file:

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <CompileSource>False</CompileSource>
    <UsePowerShell>False</UsePowerShell>
    <WebRoot>wwwroot</WebRoot>
    <WwwRootOut>wwwroot</WwwRootOut>
    <IncludeSymbols>False</IncludeSymbols>
    <Native>False</Native>
    <IgnoreDNXRuntime>False</IgnoreDNXRuntime>
    <publishUrl>D:\Publish\WebAPI</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <PublishDNXVersion>dnx-clr-win-x64.1.0.0-beta8</PublishDNXVersion>
  </PropertyGroup>
</Project>

Somebody any ideas?

like image 897
Juri Avatar asked Oct 16 '15 16:10

Juri


People also ask

How to publish ASP NET Core app to Azure?

Publish an ASP.NET Core app to Azure with Visual Studio Set up. Open a free Azure account if you don't have one. Create a web app. In the Visual Studio Start Page, select File > New > Project... Select ASP.NET Core Web Application. Run the app. Press CTRL+F5 to run the project. Test the Privacy ...

How do I publish an ASP NET project in Visual Studio?

This article supports ASP.NET and ASP.NET Core. You need Visual Studio installed with the ASP.NET and web development workload. Install the latest updates in Visual Studio by selecting Help > Check for Updates. Add the workload by selecting Tools > Get Tools and Features. In Solution Explorer, right-click your project and choose Publish.

Why is my ASP NET application not rendering in IIS?

This error is because IIS does not have the correct permissions to render your ASP.NET Core application. In Windows 10, you need to give full access to the IIS_IUSRS group in the path where you are hosting your ASP.NET Core application in IIS. This should resolve your issue.

Is it possible to publish an executable from a DotNet application?

For more information, see .NET dotnet publish command. Executables aren't cross-platform. They're specific to an operating system and CPU architecture. When publishing your app and creating an executable, you can publish the app as self-contained or framework-dependent.


1 Answers

After a couple of hours of research and chat with microsoft developers i can say that is a bug.

This is a known issue by Microsoft team and hopefully it will be fixed in the next beta. I could fix this with this two steps:

In the solution folder should be a sub-folder named "wrap". In this folder are sub-folders with project.json files. In this file i had to change "net45" to "dnx451".

I had to change the name of the sub-folder in the bin folder:

\project\wrap{LibraryName}\bin\Release\net45 => \project\wrap{LibraryName}\bin\Release\dnx451

After that i could publish to filesystem.

like image 160
Juri Avatar answered Sep 23 '22 00:09

Juri