Visual Studio 2017:构建解决方案时不生成.EXE文件 [英] Visual Studio 2017 : Not generating an .EXE file when building a solution
问题描述
我是Visual Studio的新手,但对多种编程语言有丰富的经验。
我已将 Visual Studio 2017 (社区)配置为使用 我的C#项目目录
c:\ c #projs ,而不是c:\ users目录中的目录。
I已经创建了一个控制台应用程序项目,我可以毫无问题地调试和测试它。由于应用程序正在执行我想要的操作,因此我想获取生成的EXE文件以便将其部署到其他位置。问题是Visual Studio正在生成一个
的DLL而不是一个EXE。
我在.NET上搜索了很多东西并尝试了很多东西,但我从Visual Studio中得不到任何EXE 。但是我能够使用命令行生成EXE。拨打
c:\ Windows \ Microsoftoft.NET \ Framework64 \v3.5 \ csc.exe 然后是我的.CS应用程序的路径生成我需要的EXE。但是这个解决方案并不令人满意,因为Visual Studio
这样的复杂产品应该可以直接从Visual Studio内部生成EXE(当我选择"构建解决方案"或"发布"时)必须使用命令行。
以下是我的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>
<平台> AnyCPU; x64< /平台>
< / 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>
我希望有人能够指引我朝着正确的方向前进。 C#和Visual Studio文档质量很高,但它们非常大,我需要花很多时间才能发现这个问题的解决方案,我已经在这里和那里读过零碎的东西,
但没有成功。
提前致谢。
也许社区版与其他版本略有不同,但以下是我对控制台应用程序的属性(不使用VS2017的社区版):
你的相似吗?请注意,我没有看到"Exe"。作为"输出类型"的选项之一。
这是xml:
<?xml version = " 1.0"编码= QUOT; UTF-8英寸;?>
< Project ToolsVersion =" 12.0" DefaultTargets = QUOT;构建与QUOT;的xmlns = QUOT; HTTP://schemas.microsoft.com/developer/msbuild/2003">
< Import Project ="
(MSBuildExtensionsPath)\
(MSBuildToolsVersion)\ Mymicoft.Common.props"条件= QUOT;是否存在("
I am new to Visual Studio but have a large experience with several programming languages.
I have configured Visual Studio 2017 (Community) to use the directory c:\c#projs for my C# projects, instead of a directory inside the c:\users directory.
I have created a console application project and I can debug and test it without problems. As the application is doing what I want, I want to pickup the generated EXE file in order to deploy it elsewhere. The problem is that Visual Studio is generating a DLL but not an EXE.
I have searched a lot on the NET and tried many things but I get no EXE from Visual Studio. However I was able to produce an EXE using command line. Calling c:\Windows\Microsoft.NET\Framework64\v3.5\csc.exe followed by the path to my .CS application generates the EXE that I need. But this solution is not satisfactory as it should be possible for such a sophisticated product as Visual Studio to generate the EXE directly from inside Visual Studio itself (when I choose "build solution"or "publish") without being necessary to resort to command line.
Here is the contents of my App01.csproj file :
<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>
I hope somebody is able to direct me in the right direction. The C# and Visual Studio docs are of high quality but they are very large and it would take me a lot of time to discover the solution to this problem I have read bits and pieces here and there, but without success.
Thanks in advance.Perhaps the Community edition is slightly different than the other versions, but here are the properties I have for a Console app (not using the Community edition of VS2017):
Does yours look similar? Note that I do not see "Exe" as one of the options for "Output Type".
Here is the xml:
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="
(MSBuildExtensionsPath)\
(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('
这篇关于Visual Studio 2017:构建解决方案时不生成.EXE文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!