.Net Core 爬坑日记

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

.Net Core 爬坑日记

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

.Net Core 爬坑日记

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

.Net Core 爬坑日记

.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.\Sdks (这个是本人的)

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

.Net Core 爬坑日记

在项目下新建一个global.json

内容为空

.Net Core 爬坑日记

然后关闭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.</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)

.Net Core 爬坑日记

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

.Net Core 爬坑日记

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

上一篇:bash: ifconfig: command not found


下一篇:[idea]Error:java: invalid source release: 1.8 标签: idea 2017-02-24 15:50 961人阅读