1)下载安装包含 .NET Core 1.1 Preview 1 的 SDK:Windows x64 安装包下载地址列表

2)下载最新 VS 2015 NuGet 插件:https://dist.nuget.org/index.html

3)创建一个扩展名位 .sln 的空白文件,将以下内容复制粘贴到这个 .sln 文件中。

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8BC01464-6079-4603-881A-9F8716BA6F7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BC01464-6079-4603-881A-9F8716BA6F7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BC01464-6079-4603-881A-9F8716BA6F7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BC01464-6079-4603-881A-9F8716BA6F7D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

这样就创建了一个空白的 .NET Core 解决方案文件。

3)在各个VS项目文件夹(.csproj文件所在的文件夹)中创建扩展名位 .xproj 的空文件,将下面的内容复制/粘贴至其中,并将 RootNamespace 的值设置为当前项目的命名空间。

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>8bc01464-6079-4603-881a-9f8716ba6f7d</ProjectGuid>
<RootNamespace></RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<DnxInvisibleContent Include="bower.json" />
<DnxInvisibleContent Include=".bowerrc" />
<DnxInvisibleContent Include="ConnectionString.config" />
<DnxInvisibleContent Include="packages.config" />
<DnxInvisibleContent Include="Web.config" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

4)在各个项目文件夹中添加如下包含基本配置的 project.json 文件:

{
"dependencies": {
"Microsoft.NETCore.App": "1.1.0-preview1-*"
},
"frameworks": {
"netcoreapp1.1": {
"imports": [
"portable-net45+win8+wp8"
]
}
}
}

5)对于 MVC 或 Web API 项目

5.1)在 project.json 中添加 buildOptions, runtimeOptions 与 publishOptions 的配置

  "buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
}, "runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
}, "publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},

5.2)添加 Program.cs 与 Startup.cs 文件

Program.cs

public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseUrls("http://*:5000")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build(); host.Run();
}
}

Startup.cs

public class Startup
{
public Startup(IHostingEnvironment env)
{
//..
} public IConfigurationRoot Configuration { get; } public void ConfigureServices(IServiceCollection services)
{
//..
} public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
//..
}
}

在Visual Studio中将现有.NET Framework项目迁移至.NET Core 1.1 Preview 1的更多相关文章

  1. Visual Studio 2013新建ASP.NET项目使用Empty模板,在页面中使用验证控件出错的解决方案

    Visual Studio 2013新建ASP.NET项目使用Empty模板,在页面中使用验证控件,运行页面,会出现如下的错误: 错误原因 VisualStudio 2012(或2013) WebFo ...

  2. Visual Studio 中的 .NET Framework 类库

    Visual Studio 中的 .NET Framework 类库 .NET Framework 类库由命名空间组成.每个命名空间都包含可在程序中使用的类型:类.结构.枚举.委托和接口. 当您在 V ...

  3. Visual Studio 2015 与GitLab 团队项目与管理【2】

    前一篇介绍了Git服务器的搭建,我采用的是CentOS7-64位系统,git版本管理使用的是GitLab,创建管理员密码后进入页面. 创建Users,需要记住Username和邮箱,初始密码可以由管理 ...

  4. visual studio 2015将已有项目添加到码云(gitee)

    visual studio 2015将已有项目添加到码云的步骤包括:gitee新建项目.清空项目及VS发布项目 1.gitee新建项目 2.清空项目 清空项目则会将vs项目的master分支发布到gi ...

  5. SharpDX初学者教程第1部分:在Visual Studio 2013中设置SharpDX项目

    原文 http://www.johanfalk.eu/blog/sharpdx-tutorial-part-1-setting-up-a-sharpdx-project-in-visual-studi ...

  6. Visual Studio 2017-2019版本创建C#项目时没有创建网站这一选项?

    通过了解以后发现Visual Studio 2017之后的版本在新建选项中已经不再有这一选择项了. 解决办法: 1.在创建新项目的面板滑倒最下面,---> 安装多个人工具和功能 2.这时已经打开 ...

  7. NET Framework项目移植到NET Core上遇到的一系列坑

    原文:NET Framework项目移植到NET Core上遇到的一系列坑 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https: ...

  8. NET Framework项目移植到NET Core上踩的坑(1)

    本文章向大家介绍NET Framework项目移植到NET Core上遇到的一系列坑,主要包括NET Framework项目移植到NET Core上遇到的一系列坑使用实例.应用技巧.基本知识点总结和需 ...

  9. .NET项目迁移到.NET Core操作指南

    为什么要从.NET迁移到.NET Core? .NET Core提供的特性 .NET Core性能提升 .NET如何迁移到.NET Core? 迁移工作量评估(API兼容性分析) 迁移方案制定 通过类 ...

随机推荐

  1. Tensorflow serving的编译

    Tensorflow serving提供了部署tensorflow生成的模型给线上服务的方法,包括模型的export,load等等. 安装参考这个 https://github.com/tensorf ...

  2. Problem with "AnyConnect was not able to establish connection to the specified secure gateway."

    Cisco的VPN客户端最近报"AnyConnect was not able to establish connection to the specified secure gateway ...

  3. [Idea] idea打不开项目,原因很莫名

    由于项目是gitlab上存储的,所以下下来之后,之前遇到过,以为是重新下载之后master上面没有内容导致无法正常打开,这种情况,切换一下master再打开即可: 但是这次遇到的问题不是这种情况, 使 ...

  4. UWP学习记录5-设计和UI之控件和模式2

    UWP学习记录5-设计和UI之控件和模式2 1.应用栏和命令栏 CommandBar 控件是一款通用.灵活.轻型的控件,可显示复杂内容(如图像或文本块)以及简单的命令(如 AppBarButton.A ...

  5. Beginning Scala study note(6) Scala Collections

    Scala's object-oriented collections support mutable and immutable type hierarchies. Also support fun ...

  6. MR操作

    MR操作————Map.Partitioner.Shuffle.Combiners.Reduce 1.Map步骤 1.1 读取输入文件,解析成k-v对,其中每个k-v对调用一次map函数 1.2 写自 ...

  7. 接口测试第三课(HTTP协议简介) -- 转载

    一.打开百度URL详解: 用浏览器打开百度网址,输入任意关键字搜索后: 详细URL地址复制出来如下 https://www.baidu.com/s?ie=utf-8&f=8&rsv_b ...

  8. Shell 快捷键

    输入bind -P可以查看所有的键盘绑定 Ctrl + Shift + '-' 缩小shell框Ctrl + Shift + ‘+' 放大shell框 CTRL相关的快捷键Ctrl-A 相当于HOME ...

  9. MAC帧和IP包的分析

    ping了12次岭南师范学院官网后退出   抓到的包如下   各个名词解释

  10. jmobile学习之路 ----设备检测

    用一个库,device.js.这是一种最简单的方法.device.js库,不依赖jQuery框架. <!doctype html> <html lang="en" ...