似乎无法得到类库项目,以建立从BETA4升级ASPNET 5 beta5的后 [英] Can't seem to get class library projects to build after upgrading aspnet 5 from beta4 to beta5

查看:175
本文介绍了似乎无法得到类库项目,以建立从BETA4升级ASPNET 5 beta5的后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从ASPNET BETA4升级到beta5的后,我有多个类库项目和一个单一的Web应用程序的解决方案。我收到各种错误。
于是我开始了创建与用户/识别/ EF一个新的Web应用程序项目。我经历了所有的问题,努力提升这个项目beta5的和它的作品。
然后,我添加了一个新的类库项目到解决方案,我得到相同类型的错误与我的其他更复杂的解决方案。

after upgrading from aspnet beta4 to beta5 I have a solution with multiple class library projects and a single web app. I'm getting all kinds of errors. So I started over creating a new web app project with users/identity/ef. I worked through all the issues upgrading this project to beta5 and it works. Then I added a new class library project to that solution and I get the same kinds of errors as with my other more complex solution.

dnvm列表:

   Active Version     Runtime Architecture Location                   Alias
   ------ -------     ------- ------------ --------                   -----
   1.0.0-beta4 clr     x64          C:\Users\Joe\.dnx\runtimes
   1.0.0-beta4 clr     x86          C:\Users\Joe\.dnx\runtimes
   1.0.0-beta4 coreclr x64          C:\Users\Joe\.dnx\runtimes
   1.0.0-beta4 coreclr x86          C:\Users\Joe\.dnx\runtimes
   1.0.0-beta5 clr     x64          C:\Users\Joe\.dnx\runtimes
*    1.0.0-beta5 clr     x86          C:\Users\Joe\.dnx\runtimes default

我的解决办法有这个global.json:

my solution has this global.json:

{
  "projects": [ "src", "test" ],
   "sdk": {
    "version": "1.0.0-beta5"
}

我的类库有这个project.json

my class library has this project.json

 {
  "version": "1.0.0-*",
  "description": "",
  "authors": [ "" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta5",
"System.Runtime": "4.0.20-beta-23019"


  },

  "frameworks": {
"dnx451": { },
"dnxcore50": {
  "dependencies": {
    "System.Collections": "4.0.10-beta-3019",
    "System.Linq": "4.0.0-beta-23019",
    "System.Threading": "4.0.10-beta-23019",
    "Microsoft.CSharp": "4.0.0-beta-23019"

    }
  }
 }
 }

我在类库项目一个类文件:

I have a single class file in the class library project:

using Microsoft.Framework.Configuration;
using System;

namespace myapp.Configuration
{
public static class ConfigurationExtensions
{

    public static string GetOrDefault(this IConfiguration config, string key, string defaultIfNotFound)
    {
        string result = config.Get(key);

        if (string.IsNullOrEmpty(result)) { return defaultIfNotFound; }

        return result;
    }

    public static int GetOrDefault(this IConfiguration config, string key, int defaultIfNotFound)
    {
        string result = config.Get(key);

        if (string.IsNullOrEmpty(result)) { return defaultIfNotFound; }

        return Convert.ToInt32(result);
    }

    public static bool GetOrDefault(this IConfiguration config, string key, bool defaultIfNotFound)
    {
        string result = config.Get(key);

        if (string.IsNullOrEmpty(result)) { return defaultIfNotFound; }

        return Convert.ToBoolean(result);
    }

    public static Guid GetOrDefault(this IConfiguration config, string key, Guid defaultIfNotFound)
    {
        string result = config.Get(key);

        if (string.IsNullOrEmpty(result)) { return defaultIfNotFound; }
        if (result.Length != 36) { return defaultIfNotFound; }

        return new Guid(result);
    }
}
}

当我尝试建立我得到许多错误这样的:

when I try to build I get numerous errors like these:

错误CS0518 predefined型'System.Void没有定义或导入ClassLibrary1.DNX 4.5.1
错误CS0518 predefined类型'System.Object的'未定义或导入ClassLibrary1.DNX 4.5.1
错误CS0518 predefined类型'System.String'未定义或导入ClassLibrary1.DNX 4.5.1
错误CS0433'的Guid'存在两种类型'mscorlib程序,版本= 4.0.0.0,文化=中性公钥= b77a5c561934e089'和'System.Runtime,版本= 4.0.20.0,文化=中性公钥= b03f5f7f11d50a3a

Error CS0518 Predefined type 'System.Void' is not defined or imported ClassLibrary1.DNX 4.5.1 Error CS0518 Predefined type 'System.Object' is not defined or imported ClassLibrary1.DNX 4.5.1 Error CS0518 Predefined type 'System.String' is not defined or imported ClassLibrary1.DNX 4.5.1 Error CS0433 The type 'Guid' exists in both 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

任何想法如何解决这些错误

Any ideas how to resolve these errors

更新
通过试错这个最小类库我发现,如果我从project.json除去System.Runtime依赖那么这个简单的类库将建立。

UPDATE with this minimal class library by trial and error I found that if I removed the dependency for System.Runtime from the project.json then this simple class library would build.

因此​​,要澄清它BETA4更新到beta5的后看来问题
现在有(肯定,也许别人,而是这些)这些特定的依赖关系中的任何一个任何项目都不会建立并得到有关原始类型这些错误。

So to clarify the problem it seems after updating to beta5 from beta4 now any project that has any one of these specific dependencies (and probably others but these for sure) will not build and will get these errors about primitive types.

"System.Runtime": "4.0.20-beta-23019"
"System.ComponentModel.Annotations": "4.0.10-beta-23019"
"System.Xml.XmlDocument": "4.0.0-beta-23019"

不幸的是我需要一些这些对于我的code工作

unfortunately I do need some of these for my code to work

看起来似乎是在包依赖链时髦

seems like something is funky in the package dependency chain

到目前为止升级到beta5的从BETA4一共得到火车失事我。我希望也许有人知道如何解决这些问题,但如果我没有及时响应我想我的下一步是尝试回去BETA4并删除beta5的

so far upgrading to beta5 from beta4 has been a total train wreck for me. I'm hoping maybe someone knows how to resolve these issues but if I get no timely response I guess my next step is to try to go back to beta4 and remove beta5

有任何人任何运气从BETA4多项目解决方案迁移到beta5的?

has anyone else had any luck migrating a multi project solution from beta4 to beta5?

推荐答案

好吧,我的目的,我在我的每一个项目的下探目标dnx451然后配置我的web应用程序使用特定的DNX版本解决了构建问题1.0.0 beta5的.NET的核心。
这是project.json对每一个项目我删除dnx451:{},从框架部分,并在Web项目的属性我指定的DNX版本使用

ok, for my purposes I solved the build problem by dropping the target for dnx451 in each of my projects and then configuring my web app to use the specific DNX version 1.0.0-beta5 .NET Core. that is in project.json for each project I removed "dnx451": { }, from the frameworks section, and in the properties for the web project I specified the DNX version to use.

我怀疑有某种包装天翻地覆的是导致所有我具有dnx451错误。

I suspect there is some kind of packaging snafu that is causing all the dnx451 errors I was having.

现在我的假设是,如果它的工作原理下dnxcore50那么它将稍后上工作dnx451 /桌面框架。这就是我认为dnxcore50是桌面框架的一个子集,现在这是我真正需要使用的与我的应用程序向前移动。我想我现在可以安全掉落桌面架构的支持,并添加回来后经过包装天翻地覆已经放晴了。

For now my assumption is if it works under dnxcore50 then it will work later on dnx451/desktop framework. that is I assume dnxcore50 is a subset of the desktop framework and for now that is all I really need to work with to move forward with my app. I figure I can safely drop support for desktop framework now and add it back later after the packaging snafu has cleared up.

在我所有的project.json文件,我是能够得到过去所有的错误和构建和运行没有错误我的解决办法。只针对dnxcore50

by targeting only dnxcore50 in all of my project.json files I was able to get past all the errors and build and run my solution without errors.

这篇关于似乎无法得到类库项目,以建立从BETA4升级ASPNET 5 beta5的后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆