.Net Core dotnet运行未运行最后修改的源代码

编程入门 行业动态 更新时间:2024-10-11 07:25:54
本文介绍了.Net Core dotnet运行未运行最后修改的源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用.Net Core 2.2进行Asp.Net Mvc项目。我无法从命令行/ powershell运行最后修改的源代码。我尝试在 dotnet运行但没有用。如果我以前在Visual Studio 2019中运行/调试项目,则只能使用cli运行最后修改的源代码。

I am working on Asp.Net Mvc project with .Net Core 2.2. I can not run the last modified source code from command line/powershell. I tried manually calling dotnet clean and dotnet build before dotnet run but did not work. I can only run the last modified source code with cli if I run/debug my project within Visual Studio 2019 before.

如何解决此问题?

我正在使用Windows10。我同时安装了SDK版本3.1和2.2,但我通过

I am using Windows 10. I have both SDK versions 3.1 and 2.2 installed but I declare the version by

<PropertyGroup> <TargetFramework>netcoreapp2.2</TargetFramework> ... </PropertyGroup>

在我的.csproj文件和构建路径中,目标版本正确。

in my .csproj file and in the build path the target version is correct.

推荐答案

TL; DR 问题出在构建错误的项目。确定正确的项目或 整体解决方案 。 dotnet构建主项目/入口项目/单个项目不会触发其他依赖项项目的构建。

TL;DR The problem was building the wrong project. Build the correct project or entire solution for certainty. dotnet build the main/entrance/single project does not trigger build for other dependency projects.

我正在研究一个包含许多项目的解决方案,其中一个是应用程序入口,该应用程序入口将其他项目作为依赖项。要运行该应用程序,您应该 dotnet运行这个项目。

I am working on a solution which has many projects, and one of them is the application entrance which has the other projects as dependency. To run the application, you should dotnet run this project.

我认为构建此入口项目也会触发该解决方案的依赖项目的构建。事实证明事实并非如此。

I thought building this entrance project would trigger build for dependency projects of the solution too. Turns out it does not.

诀窍是,您只能 dotnet运行项目,但可以 dotnet构建也是解决方案。所以我的解决办法是构建解决方案。

The trick is, you can dotnet run only projects but you can dotnet build also solutions. So my fix was to build the solution.

更多推荐

.Net Core dotnet运行未运行最后修改的源代码

本文发布于:2023-11-16 14:41:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1605202.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:源代码   Net   Core   dotnet

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!