GVKun编程网logo

[转载] Visual Studio 2017 VC项目设置 printf 输出到 Console 窗口调试(vs中printf输出到文件)

9

想了解[转载]VisualStudio2017VC项目设置printf输出到Console窗口调试的新动态吗?本文将为您提供详细的信息,我们还将为您解答关于vs中printf输出到文件的相关问题,此外

想了解[转载] Visual Studio 2017 VC项目设置 printf 输出到 Console 窗口调试的新动态吗?本文将为您提供详细的信息,我们还将为您解答关于vs中printf输出到文件的相关问题,此外,我们还将为您介绍关于asp.net-core – Visual Studio 2017 RC安装会中断Visual Studio 2015 ASP.NET核心项目、asp.net-core-mvc – 我是否需要在Visual Studio 2017 ASP.NET Core MVC中将Async添加到我的Controller Actions中、asp.net-mvc – 在Visual Studio 2015中创建一个空的MVC项目、asp.net-mvc-5 – Visual Studio 2015 MVC项目模板访问被拒绝的新知识。

本文目录一览:

[转载] Visual Studio 2017 VC项目设置 printf 输出到 Console 窗口调试(vs中printf输出到文件)

[转载] Visual Studio 2017 VC项目设置 printf 输出到 Console 窗口调试(vs中printf输出到文件)

参考链接: 程序打印自己的名称作为输出

开发VC程序时经常通过printf打印一些调试信息,仅在VS2017测试通过,其它版本没试过 

承接各类STM32项目、JAVA、C++、Android、微信、Linux,毕业设计开发 手机:18559979152(微信同号) 

一、打开VS工程。 

二、项目名称上点击鼠标右键选择 属性,打开项目的属性页。 

三、在配置属性中,生成事件->生成后事件 

在命令行的右边空白处添加“editbin /SUBSYstem:CONSOLE $(OUTDIR)\$(ProjectName).exe”,无引号,点击确定。 

 

四、运行你的程序,会多弹出一个黑色命令行的提示框,代码中使用printf函数输出你的打印信息 

 

承接各类STM32项目、JAVA、C++、Android、微信、Linux,毕业设计开发 手机:18559979152(微信同号)

asp.net-core – Visual Studio 2017 RC安装会中断Visual Studio 2015 ASP.NET核心项目

asp.net-core – Visual Studio 2017 RC安装会中断Visual Studio 2015 ASP.NET核心项目

安装Visual Studio 2017 Professional RC后,我无法在Visual Studio 2015 Professional中构建我的ASP.NET Core。我从来没有在VS2017打开这个项目

我得到

The following error occured attempting to run the project model server process (1.0.0-preview3-004056).

Unable to start the process. No executable found matching command dotnet-projectmodel-server

然后我在Visual Studio 2015中创建了一个全新的ASP.NET Core项目,我在加载我的项目时得到完全相同的消息。

此外,当我想要建立的项目,我得到

MSB1009: Project File does not exist.

同样的问题不会发生在ASP.NET 5项目,因此它只限于ASP.NET Core

解决方法

@Claudio Nunes和@MegaTron有正确的答案。阅读他的答案后,我意识到我的.NET核心解决方案没有一个global.json文件。我添加了一个新的解决方案文件夹并添加了一个global.json文件。因为我的项目没有嵌套在子文件夹中,我只需要从projects数组中删除“src”和“test”:
{
  "projects": [],"sdk": {
    "version": "1.0.0-preview2-003131"
  }
}

该项目现在在VS 2015正确打开与VS 2017 RC安装。

asp.net-core-mvc – 我是否需要在Visual Studio 2017 ASP.NET Core MVC中将Async添加到我的Controller Actions中

asp.net-core-mvc – 我是否需要在Visual Studio 2017 ASP.NET Core MVC中将Async添加到我的Controller Actions中

我刚刚将Visual Studio 2015 ASP.NET MVC Core项目转换为Visual Studio 2017 …我在错误列表中收到以下信息性消息

消息IDE1006命名规则违规:缺少后缀:’异步’

此消息出现在我的控制器中,重点关注以下内容:

public async Task<IActionResult> Index()

这也适用于创建,删除,详细信息和编辑.消息显示为信息,并适用于我的项目中超过1,000次出现.看来我需要将Index更改为IndexAsync
即.
    改变自:

public async Task<IActionResult> Index()
public async Task<IActionResult> Create()
public async Task<IActionResult> Delete(int? id)
public async Task<IActionResult> Details(int? id)

改成:

public async Task<IActionResult> IndexAsync()
public async Task<IActionResult> CreateAsync()
public async Task<IActionResult> DeleteAsync(int? id)
public async Task<IActionResult> DetailsAysnc(int? id)

这似乎是可选的,因为我的项目将构建并且它不是VS 2015中的问题.我不介意做这项工作,我需要确认在Visual Studio 2017 ASP.NET Core中更改它是正确的方法.

解决方法

微软正在推动你使用async这个词来为你的异步方法添加后缀.为什么? Visual Studio 2017的 release notes提到了这个花絮.

Task-like return types for async methods: This introduces the ability
to return any task-like type from an async method. PrevIoUsly these
return types were constrained to Task<T> and Task.

听起来不太明显哪些方法只是检查它们的返回类型是异步的.将它们与异步进行后缀可能是一个好主意.在VS提出这个“建议”之前,有一个previous stack overflow question辩论大会.来自微软的Stephen Toub对此发表了讲话.

If a public method is Task-returning and is asynchronous in nature (as
opposed to a method that is kNown to always execute synchronously to
completion but still returns a Task for some reason),it should have
an “Async” suffix. That’s the guideline. The primary goal here with
the naming is to make it very obvIoUs to a consumer of the
functionality that the method being invoked will likely not complete
all of its work synchronously; it of course also helps with the case
where functionality is exposed with both synchronous and asynchronous
methods such that you need a name difference to distinguish them. How
the method achieves its asynchronous implementation is immaterial to
the naming: whether async/await is used to garner the compiler’s help,
or whether types and methods from System.Threading.Tasks are used
directly (e.g. taskcompletionsource) doesn’t really matter,as that
doesn’t affect the method’s signature as far as a consumer of the
method is concerned.

Of course,there are always exceptions to a guideline. The most
notable one in the case of naming would be cases where an entire
type’s raison d’etre is to provide async-focused functionality,in
which case having Async on every method would be overkill,e.g. the
methods on Task itself that produce other Tasks.

As for void-returning asynchronous methods,it’s not desirable to have
those in public surface area,since the caller has no good way of
kNowing when the asynchronous work has completed. If you must expose a
void-returning asynchronous method publicly,though,you likely do
want to have a name that conveys that asynchronous work is being
initiated,and you Could use the “Async” suffix here if it made sense.
Given how rare this case should be,I’d argue it’s really a
case-by-case kind of decision.

I hope that helps,Steve

底线,这是信息性的.但是,随着Microsoft将返回类型扩展到Task以外,它开始变得越来越像最佳实践.用你自己的判断.

asp.net-mvc – 在Visual Studio 2015中创建一个空的MVC项目

asp.net-mvc – 在Visual Studio 2015中创建一个空的MVC项目

我正在使用VS 2015 Enterprise,我正在尝试创建一个空的MVC项目.

我右键单击解决方案进入“添加|新建项目…”对话框.然后,我从左侧列表中选择“Web”,然后选择“ASP.NET Web Application”,如下所示:

enter image description here

接下来,将打开以下对话框窗口,但“Web窗体”,“MVC”和“Web API”的复选框均已禁用.有谁知道为什么他们被禁用以及如何启用它们?选择“Web API”或“Web应用程序”(而不是“空”)不会更改复选框的状态 – 它们将保持禁用状态.

如果我没记错的话,我曾经能够在VS 2013中创建一个空的MVC项目,没有任何问题.

enter image description here

解决方法

您可以选择空模板以及MVC复选框选项,它将为您提供具有空模型,视图和控制器的MVC Web应用程序.

enter image description here

asp.net-mvc-5 – Visual Studio 2015 MVC项目模板访问被拒绝

asp.net-mvc-5 – Visual Studio 2015 MVC项目模板访问被拒绝

我在VS2015中创建了一个非常简单的MVC应用程序,它有一些基本的CSS样式和一些 HTML,可以更快地启动应用程序.

该应用程序运行完美.

我使用File – >将其导出为模板导出模板……

然后我根据这个项目类型创建了一个全新的项目.到现在为止还挺好.但是,现在当我运行新创建的项目时,我得到一个带有“拒绝访问”的空白页面(见图).

我一直在用模具梳子检查模板项目和新项目,我找不到任何差异.为什么一个工作但另一个工作被拒绝?我没有想法,任何帮助表示赞赏.

Access Denied

编辑:

经过更多的研究,我找到了问题的原因,但不是解决方案.

项目模板似乎已将“匿名身份验证”设置为“已禁用”,并且在项目设置中将“Windows身份验证”设置为“已启用”.但是,当我基于模板创建项目时,这些值会被翻转,从而导致拒绝访问.

这是模板中项目设置的图像:

enter image description here

这是“新”项目中项目设置的图像:

enter image description here

请注意,两个身份验证设置都被翻转.任何人都可以告诉我如何让这不发生?

编辑2:

正如所建议的那样,applicationhost.config文件是不同的,这导致了上述问题.以下是模板的applicationhost.config安全性部分:

enter image description here

但是,这是基于模板创建的新项目中的相同文件:

enter image description here

请注意,该部分完全从新项目中丢失.那么,现在的问题是如何将其复制到新项目中?

解决方法

正如BrianLegg所建议的那样,我将我的评论移到答案中

似乎该问题与applicationhost.config文件有关.这个文件在包含模板的zip文件中不存在.

您可以查看物理路径属性

<system.applicationHost>
          <sites>

也许它试图访问第一个项目而不是新项目.

你能检查一下applicationHost.config模板中的内容吗?

看看Where is the template for applicationHost.config file stored

关于[转载] Visual Studio 2017 VC项目设置 printf 输出到 Console 窗口调试vs中printf输出到文件的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于asp.net-core – Visual Studio 2017 RC安装会中断Visual Studio 2015 ASP.NET核心项目、asp.net-core-mvc – 我是否需要在Visual Studio 2017 ASP.NET Core MVC中将Async添加到我的Controller Actions中、asp.net-mvc – 在Visual Studio 2015中创建一个空的MVC项目、asp.net-mvc-5 – Visual Studio 2015 MVC项目模板访问被拒绝的相关信息,请在本站寻找。

本文标签: