繁体   English   中英

Visual Studio 2017,生成解决方案或发布不生成.EXE

[英]Visual Studio 2017, Build solution or Publish not generating an .EXE

我已经开发了一个C#控制台应用程序 ,该程序在Visual Studio环境中可以正常工作。 当我在“发布”下(也可以在“调试”下)选择“生成解决方案”时, 将生成一个.DLL而 不是一个.EXE 我可以使用命令行(“ c:\\ Windows \\ Microsoft.NET \\ Framework64 \\ v3.5 \\ csc.exe”,后跟.cs文件的路径)生成.EXE,但是应该可以从Visual Studio环境内部生成.EXE。

我已经将Visual Studio配置为使用“ C:\\ c#projs”作为我的项目位置 (菜单路径“工具”->“选项”->“项目和解决方案”->“项目位置”,而不是c下的默认路径) :\\ USERS \\\\文件....

这是项目文件“ App01.csproj”

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputPath>bin\</OutputPath>
    <OutputType>Exe</OutputType>
    <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <StartupObject>App01.SetDirDatesProgram</StartupObject>
    <Platforms>AnyCPU;x64</Platforms>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <OutputPath>bin\</OutputPath>
    <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
    <PlatformTarget>x64</PlatformTarget>
    <WarningLevel>0</WarningLevel>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <OutputPath>bin\</OutputPath>
    <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
    <PlatformTarget>x64</PlatformTarget>
    <WarningLevel>0</WarningLevel>
  </PropertyGroup>

</Project>

这是生成的“ App01.deps.json”文件:

"runtimeTarget": {
    "name": ".NETCoreApp,Version=v2.1",
    "signature": "da39a3ee5e6b4b0d3255bfef95601890afd80709"
  },
  "compilationOptions": {},
  "targets": {
    ".NETCoreApp,Version=v2.1": {
      "App01/1.0.0": {
        "runtime": {
          "App01.dll": {}
        }
      }
    }
  },
  "libraries": {
    "App01/1.0.0": {
      "type": "project",
      "serviceable": false,
      "sha512": ""
    }
  }
}

“ App01.deps.json”文件由Visual Studio创建,包含(在“ 运行时 ”键下)“ App01.dll ”而不是“ App01.exe ”。

我的问题是 :我需要在Visual Studio中进行哪些修改才能获取(在“运行时”键下)“ App01.exe”而不是“ App01.dll”,并且显然是为了由Visual生成App01.exe Studio,以便我可以将App01.exe部署到其他地方?

右键单击解决方案资源管理器中的项目名称,选择“ Properties...然后转到“ Application部分并查找“ Output type:确保将其设置为“ Console Application

对于.NET Core控制台应用程序,我想您会找到在以下SO问题上寻求的信息: 构建.NET Core控制台应用程序以输出EXE?

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM