.Net Core 爬坑日记

安装【DotNetCore.1.0.1-VS2015Tools.Preview2.0.3.exe】失败

查看log发现,发现猫腻,然后copy下链接,用迅雷手动下载【AspNetCoreLocalFeed_69.msi】

并安装好,再次安装【DotNetCore.1.0.1-VS2015Tools.Preview2.0.3.exe】,

.Net Core 1.0升级2.0(xproj项目迁移到.csproj )

vs2015的创建的项目是以*.xproj的项目文件,迁移到vs2017需要如下准备:

1、安装好vs2017;

2、下载最新的SDK

3、在目标项目中,建立一个global.json文件,内容如下:

{
  "projects":["src","test"],
  "sdk": {
    "version": "1.1.0"
  }
}

4、用vs2017打开,自动迁移,完毕!!

参考资料:https://blog.jetbrains.com/dotnet/2017/04/04/rider-eap-update-csproj-based-net-core-support-migrate/

 

补充:

.Net Core SDK 2.0装完成之后,在VS2017的目标框架仍然没发现2.0的时候,参考这篇(http://www.cnblogs.com/lishuyi/p/7081269.html),设置一下系统环境变量,

变量名:MSBuildSdksPath
变量值:C:\Program Files\dotnet\sdk\2.0.0\Sdks   (这个是本人的)

.Net core 项目加载提示“项目文件不完整。缺少预期导入”

在项目下新建一个global.json

内容为空

 

然后关闭vs重新启动项目,从.csproj启动,启动之后,删除原解决方案文件.sln

创建多平台共用的组件  .NET Standard

创建好.NET Standard项目,前提是安装好对应的版本,然后修改.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <PackageId>Banana.Uow</PackageId>
    <PackageTags>orm;sql;micro-orm;Dapper;Uow;Repository</PackageTags>
    <Title>Dapper</Title>
    <Description>Uow and Repository</Description>
    <Authors>EminemJK</Authors>
    <TargetFrameworks>net452;netstandard2.0</TargetFrameworks>
  </PropertyGroup>
  <ItemGroup Condition="'$(TargetFramework)' == 'net452'">
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="Microsoft.CSharp" />
  </ItemGroup>
  <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
    <PackageReference Include="System.Data.SqlClient" Version="4.4.0" />
    <PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
    <PackageReference Include="System.Reflection.TypeExtensions" Version="4.4.0" />
    <PackageReference Include="System.Collections.Concurrent" Version="4.3.0" />
    <PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" />
    <PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
    <PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
    <PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
    <PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" /> 
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="MySql.Data"  Version="8.0.13" />
    <PackageReference Include="Dapper.Contrib" Version="1.50.5" />
    <PackageReference Include="System.Data.SQLite" Version="1.0.109.2" />
  </ItemGroup>
</Project>

未经处理的异常:System.IO. FileNotFoundException:未能加载文件或程序集“System.Runtime,Version=

Could not load file or assembly 'System.Runtime, Version=

未经处理的异常:System.IO.FileNotFoundException:未能加载文件或程序集“System.Runtime,Version=4.2.1.0,Cu"lture=neutra"l, PublicKeyToken=b03f5f7f11d50a3a”或它 的某一个依赖项。系统找不到指定的文件。

System.ModuleHandle.ResolveTypeCRuntimeModule module, Int32 typeToken, Int Ptr* typelnstArgs, Int32 typelnstCount, IntPtr* methodlnstArgs, Int32 methodlnst Count, ObjectHandleOnStack type)
System.ModuleHandle.ResolveTypeHandlelnternal(RuntimeModule module, Int32 typeToken, Runti meTypeHandle[] typelnstanti ati onContext, Runti meTypeHandle[] met hodlnstanti ati onContext)
System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] ge nericTypeArguments, Type[] generi cMethodArquments)
System.Reflecti on.CustomAttri bute.Fi TterCustomAttributeRecord(CustomAttri b uteRecord caRecord, Metadatalmport scope, Assembly& lastAptcaOkAssembly, Runtime Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilte rType, Boolean mustBelnheritable, Object[] attributes, IList derivedAttributes, RunfimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters ,Boolean& isVarArg)
System.Reflecti on.CustomAttri bute.GetCustomAttri butes(Runti meModule decora tedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFi lterType, Boolean mustBelnheritable, IList derivedAttributes, Boolean isDecorate dTargetSecurityTransparent)
System.Reflecti on.CustomAttri bute.GetCustomAttri butes(Runti meAssembly asse mbly, RuntimeType caType)
在 System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)

本地VS开发调试没问题,发布到IIS后出现以上问题,请安装与项目目标框架(我是.Net core 2.2)对应的RunTime并重启电脑即可。

 

爬坑日记进行中……持续更新……

转载于:https://www.cnblogs.com/EminemJK/p/7095199.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值