将ASP.NET Web项目部署到Azure会导致OutputPath错误 [英] Deploying ASP.NET web project to Azure gives OutputPath error

查看:62
本文介绍了将ASP.NET Web项目部署到Azure会导致OutputPath错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在Azure中部署Web项目时收到以下错误:
$
无效的恢复输入。缺少项目类型'PackageReference'的必需属性'OutputPath'。



项目是在VS2017中创建的,它包含一个主Web项目和两个DLL项目。 Web项目引用了两个DLL项目。我添加了PROJECT 在应用程序设置中有价值,因此它将构建正确的部署项目。



我不知道为什么我收到上述错误。我怀疑DLL项目没有被编译并引用到web项目中。但是要确定如何在Azure Web服务中定义该关系。如果有人可以提前帮助你。

解决方案

只是为了隔离问题,您可以在本地部署应用程序,并在发布到Azure之前查看其工作原理。


当您将ASP.NET Web应用程序推送到Azure WebApps时,Kudu使用msbuild构建它来创建部署工件。


对于解决方案中的多个项目,不能正确相互依赖。如果您构建整个解决方案,那么
的东西可能仍然有效。但是如果你只是构建Web项目,只构建严格的依赖树,请仔细查看配置。


转到包含您的文件夹 。sln   ; file,
并运行以下命令(调整路径<&spanbsp;
.csproj   for
你的情景)。这就是Kudu在部署时默认运行的内容。



确保内容文件在repo以及csproj中。另外,
确保使用构建项目  Build>在执行部署步骤之前,在VS中构建解决方案  菜单
命令。


隔离你的构建本地使用msbuild的应用程序:


对于经典.NET:
msbuild MyMvcApp \ MyMvcApp.csproj / nologo / verbosity:m / t:Build / t:pipelinePreDeployCopyAllFilesToOneFolder / p:_PackageTempDir =" ; c:\ mysite" ;; AutoParameterizationWebConfigConnectionStrings = false; Configuration = Release; UseSharedCompilation = false
/ p:SolutionDir ="。"


对于.NET Core: msbuild
ASPNetCore\ASPNetCore.csproj / p:PublishUrl =" c:\ mysite" / p:DeployOnBuild = true / p:Configuration = Release / p:WebPublishMethod = FileSystem / p: DeployTarget = WebPublish / p:AutoParameterizationWebConfigConnectionStrings = false / p:SolutionDir ="。"


查看本文档中列出的步骤说明

快速入门:使用Visual Studio创建您的第一个ASP.NET核心Web应用程序
以获取更多详细信息。


I am receiving the following error when trying to deploy a web project in Azure:
Invalid restore input. Missing required property 'OutputPath' for project type 'PackageReference'.

The project was created in VS2017 which consists of a main web project and two DLL projects. The web project references the two DLL projects. I have added the PROJECT  valuable in the App Settings so it will build the correct project for deployment.

I am not sure why I am getting the above error. I suspect that the DLL projects are not being compiled and referenced to the web project. But sure how to define that relationship in Azure Web Services. If anyone can help thank you in advance.

解决方案

Just to isolate the issue, you could deploy the app locally and see how that works before publishing to Azure.

When you push an ASP.NET Web Application to an Azure WebApps, Kudu builds it by using msbuild to create deployment artifacts.

For multiple projects in a solution don't correctly depend on each other. If you build the entire solution, then things might still work. But if you just build the Web project, only the strict dependency tree is built, kindly review the config.

Go to the folder that has your .sln file, and run the following command (adjust the path to the .csproj for your scenario). This is what Kudu runs by default when you deploy.

Ensure that the content files in repo as well as in csproj. Also, make sure you build the project using the Build > Build Solution menu command in VS before following the deployment steps.

To isolate you build the app locally using msbuild:

For classic .NET: msbuild MyMvcApp\MyMvcApp.csproj /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="c:\mysite";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="."

And for .NET Core:msbuild ASPNetCore\ASPNetCore.csproj /p:PublishUrl="c:\mysite" /p:DeployOnBuild=true /p:Configuration=Release /p:WebPublishMethod=FileSystem /p:DeployTarget=WebPublish /p:AutoParameterizationWebConfigConnectionStrings=false /p:SolutionDir="."

Take a look at the step-step instructions outlined in this document Quickstart: Use Visual Studio to create your first ASP.NET Core web app for more details.


这篇关于将ASP.NET Web项目部署到Azure会导致OutputPath错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆