首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >简单Hello web应用程序错误MSB4019的构建失败:未找到导入的项目

简单Hello web应用程序错误MSB4019的构建失败:未找到导入的项目
EN

Stack Overflow用户
提问于 2022-05-04 16:41:47
回答 1查看 355关注 0票数 0

我有一个简单的asp.net web应用程序,它打印Hello。我不是开发人员,我想做的就是在Azure web应用服务上部署一个web应用程序。源代码在github上,当它试图通过github操作进行构建(用dotnet构建)时,我会得到以下错误。

代码语言:javascript
复制
Private
Add or update the Azure App Service build and deployment workflow config Build and deploy ASP.Net Core app to Azure Web App - webappra11 #5
Summary
Jobs
build
deploy
build
failed 3 hours ago in 1m 54s
Search logs
4s
9s
1m 12s
23s
Run dotnet build --configuration Release

Welcome to .NET 6.0!
---------------------
SDK Version: 6.0.202

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
Microsoft (R) Build Engine version 17.1.1+a02f73656 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Nothing to do. None of the projects specified contain packages to restore.
D:\a\udemy_demo\udemy_demo\demoapp\demoapp.vbproj(169,3): error MSB4019: The imported project "C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\6.0.202\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the expression in the Import declaration "C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\6.0.202\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" is correct, and that the file exists on disk.

Build FAILED.

D:\a\udemy_demo\udemy_demo\demoapp\demoapp.vbproj(169,3): error MSB4019: The imported project "C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\6.0.202\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the expression in the Import declaration "C:\Users\runneradmin\AppData\Local\Microsoft\dotnet\sdk\6.0.202\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" is correct, and that the file exists on disk.
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:13.94
Error: Process completed with exit code 1.
0s
0s
5s
0s

我已经做了一些研究,很多用户建议修改csproj文件,这是我没有的核心技术是使用visual。

我找到了链接https://alastaircrabtree.com/microsoft-webapplication-targets-was-not-found-again/,它应该是一个解决问题的黑客,但是在对下面的行做任何更改之前,我想在这里检查是否有人知道这里发生了什么。

我更改了以下几行

代码语言:javascript
复制
<!-- <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> -->
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildProgramFiles32)\MSBuild\Microsoft\VisualStudio\v14.0</VSToolsPath>
EN

回答 1

Stack Overflow用户

发布于 2022-05-04 17:00:04

本质上,您的csproj中的Microsoft.WebApplication.targets路径无法在磁盘上找到。你的解决办法看上去很管用。

或者您可以尝试添加:

代码语言:javascript
复制
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != '' And Exists('$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets')" />
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72116570

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档