简体   繁体   English

用VS2015创建的ASP.Net核心Web应用程序(.Net Framework)创建了一个看上去很狡猾的项目

[英]ASP.Net Core Web Application (.Net Framework) created with VS2015 creates a dodgy looking project

I'm creating an application using ASP.Net Core, it's just a prototype atm to test various technologies. 我正在使用ASP.Net Core创建一个应用程序,它只是一个用于测试各种技术的原型atm。 I need it to use Dotnet Framework instead of Dotnet Core. 我需要使用Dotnet Framework而不是Dotnet Core。 (One of the reasons being that I need Dotnet Framework's support for COM interop). (原因之一是我需要Dotnet Framework对COM互操作的支持)。

I have VS2015 Update 3 running on Win7 x64. 我在Win7 x64上运行VS2015 Update 3。

I select File -> New -> Project, then in the New Project dialog, I select .Net Framework 4.6 in the Dotnet version dropdown and Web -> 'ASP.Net Core Web Application (.Net Framework)' from the project tree to create a new Web Application. 我选择File-> New-> Project,然后在New Project对话框中,在Dotnet version下拉列表中选择.Net Framework 4.6,然后从项目树中选择Web->'ASP.Net Core Web Application(.Net Framework)'创建一个新的Web应用程序。

It builds and runs but I don't fully understand the configuration of the project that has been created. 它可以构建和运行,但是我不完全了解已创建项目的配置。

The project uses a project.json file instead of packages.config. 该项目使用project.json文件而不是packages.config。 This I think I understand and is because ASP.Net Core requires use of Nuget 3 instead of Nuget 2. 我认为这是我理解的,因为ASP.Net Core要求使用Nuget 3而不是Nuget 2。

What I don't understand is that when I build the project in my output directory I have a subdirectory ./net46/win7-x64 and in there is some strange stuff indeed. 我不明白的是,当我在输出目录中构建项目时,我有一个子目录./net46/win7-x64,确实有一些奇怪的东西。

libuv.dll and a load of Microsoft.AspNetCore.<whatever> makes sense, Asp.Net isn't part of the Dotnet Framework so nuget resolves that dependency and copies it to my output directory. libuv.dll和Microsoft.AspNetCore的负载。<whatever>是有意义的,Asp.Net不是Dotnet Framework的一部分,因此nuget可以解决该依赖关系并将其复制到我的输出目录中。 However I also have a load of nuget. 但是我也有很多负担。 assemblies in my output directory. 我的输出目录中的程序集。 What is that doing there? 那在那里做什么? My application doesn't use nuget internally so why should that need to be shipped as a dependency? 我的应用程序内部不使用nuget,那么为什么需要将其作为依赖项提供?

Equally confusing are a load of System.<whatever> assemblies, like for example System.Threading.Thread.dll v1.0.24212.1. 同样令人困惑的是System。<whatever>程序集的负载,例如System.Threading.Thread.dll v1.0.24212.1。 Now the Dotnet Framework doesn't have a System.Threading.Thread.dll, it has a System.Threading.dll v4.6.1085.0. 现在,Dotnet Framework没有System.Threading.Thread.dll,它具有System.Threading.dll v4.6.1085.0。

These System.<whatever> dlls are actually Dotnet Core libraries (they match assemblies in c:\\Program Filess\\dotnet\\shared), but this project was created using the project wizard that is supposed to use Dotnet Framework, not Dotnet Core, so what are all these Dotnet Core assemblies doing in my output directory? 这些System。<whatever> dll实际上是Dotnet Core库(它们与c:\\ Program Filess \\ dotnet \\ shared中的程序集匹配),但是此项目是使用应该使用Dotnet Framework 而不是 Dotnet Core的项目向导创建的,因此这些Dotnet Core程序集在我的输出目录中做什么?

I suspect the issue is related to deployment modes. 我怀疑问题与部署模式有关。 Dotnet Core has two deployment modes. Dotnet Core具有两种部署模式。 Framework dependent and self-contained. 框架依赖且自成体系。 Framework dependent means the application doesn't ship it's own Dotnet Core assemblies, it replies on Dotnet Core already being installed on the target machine and uses that. 依赖于框架意味着应用程序不会交付它自己的Dotnet Core程序集,而是对已经安装在目标计算机上的Dotnet Core进行答复并使用它。 Self-contained means the application ships all it's own Dotnet Core dependencies. 自包含的意味着应用程序附带了它自己的所有Dotnet Core依赖项。

This raises two questions though. 但这提出了两个问题。 Framework dependent and self-contained are Dotnet Core deployment modes, 1) there is nothing in the documentation to suggest that they have anything to do with an application that uses Dotnet Framework instead, and 2) the documentation states that Framework Dependent is the default, but it doesn't seem to be and I haven't changed anything. 依赖框架和自包含框架是Dotnet Core部署模式,1)文档中没有任何内容表明它们与使用Dotnet Framework的应用程序有任何关系,并且2)文档指出“框架依赖”是默认设置,但这似乎不是,我也没有做任何更改。

https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/index https://docs.microsoft.com/zh-cn/dotnet/articles/core/deploying/index

To create an ASP.Net Core app using Dotnet Framework I would have expected to have an application that just referenced a few extra Microsoft.AspNetCore. 为了使用Dotnet Framework创建ASP.Net Core应用程序,我希望有一个引用了一些额外Microsoft.AspNetCore的应用程序。 libraries copied to its output, but what I actually have is something quite different and I don't know why. 库复制到其输出,但是我实际拥有的是完全不同的东西,我不知道为什么。

Can anyone shed some light on this please? 谁能对此有所启发?

UPDATE: Added project.json for reference. 更新:添加了project.json以供参考。

{
  "dependencies": {
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Routing": "1.0.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
  },

  "tools": {
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "net46": { }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

The assemblies that in Output path based on the platform that will run your application. 输出路径中的程序集基于将运行您的应用程序的平台。

For your situation, you are creating a ASP.NET Core Web Application (.NET Framework), which is a .NET Framework application and it needs .NET Framework installed on Windows machine to run this application. 根据您的情况,您正在创建一个ASP.NET Core Web应用程序(.NET Framework),它是一个.NET Framework应用程序,并且需要在Windows计算机上安装.NET Framework才能运行该应用程序。

And this type of project needs .NET Core assemblies and these .NET Core related assemblies are referenced as packages. 这种类型的项目需要.NET Core程序集,并且这些与.NET Core相关的程序集称为程序包。 And these assemblies stored in Win7-x64 folder, which means these assemblies will be called by .NET Framework in Win7 x64 machine. 这些程序集存储在Win7-x64文件夹中,这意味着这些程序集将由Win7 x64计算机中的.NET Framework调用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以在VSCode OSX上运行VS2015中创建的ASP.NET Web项目? - Is it possible to run a ASP.NET web project created in VS2015 on VSCode OSX? 如果网站创建为 Visual C# ASP.Net Web 应用程序在 VS2015 中,PageMethods 不起作用 - PageMethods not working if the website is created as a Visual C# ASP.Net Web Application in VS2015 在 VS2015 ASP.NET 5 Web API 应用程序中设置项目 url - Setting project url in VS2015 ASP.NET 5 Web API application vs2015中ASP.NET Core RC2的Web开发工具 - Web Development Tools for ASP.NET Core RC2 in vs2015 从VS2015中的ASP.NET Web项目引用VB.NET类库时,Intellisense损坏 - Intellisense broken when referencing a VB.NET class library from a ASP.NET Web project in VS2015 ASP.NET Web 应用程序 (.NET Framework) 与 ASP.NET Core Web 应用程序 (.NET Framework) 之间的差异 - Differences between ASP.NET Web Application (.NET Framework) vs ASP.NET Core Web Application (.NET Framework) 与发布ASP.NET Core(带有.net框架)vs 2015有关的问题 - Issue with Publishing ASP.NET Core (with .net framework) vs 2015 Visual Studio 2015 Web应用程序.NET核心与.NET Framework - Visual Studio 2015 Web Application .NET Core vs .NET Framework Asp.net Core 1.0 VS2015 IISExpress更改了应用程序URL:.css 404中的结果 - Asp.net Core 1.0 VS2015 IISExpress changed App URL: results in .css 404 如何在安装vs2015之后在vs2015上安装Asp.Net? - How can I install Asp.Net on vs2015 after already installing vs2015 ?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM