allowDefinition='MachineToApplication' msbuild 错误 [英] allowDefinition='MachineToApplication' msbuild error

查看:15
本文介绍了allowDefinition='MachineToApplication' msbuild 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个具有 4-5 种不同构建配置的 ASP.NET MVC.每当我们更改构建配置时,我们都需要删除 web 项目的 obj 文件夹,因为我们收到allowDefinition='MachineToApplication"错误.很痛苦,但我们通过删除构建前/构建后事件中的文件夹来管理.现在我需要配置我们的 CI 来构建部署包.这意味着我无法删除 obj 文件夹.每次我编译例如使用以下 msbuild 参数

We have a ASP.NET MVC with 4-5 different build configurations. Whenever we change the build configuration, we need to delete the obj folder for the web project, since we get the 'allowDefinition='MachineToApplication' error. A pain, but we managed by deleting the folder in pre/post build events. Now I need to configure our CI to build deployment packages. This means that I cannot delete the obj folder. Every time I compile e.g. with the following msbuild parameters

/p:CreatePackageOnPublish=true/p:DeployOnBuild=true

/p:CreatePackageOnPublish=true /p:DeployOnBuild=true

我收到错误:

web.config(123): error ASPCONFIG: 使用注册为 allowDefinition='MachineToApplication' 的部分超出应用程序级别是错误的.此错误可能是由于虚拟目录未在 IIS 中配置为应用程序所致.

web.config(123): error ASPCONFIG: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

据我了解,问题在于项目中有多个 .config 文件——在我们的例子中,没有.我真的可以使用一些帮助来找到解释并找到永久(无破解)修复.

As far as I understand, the problem is that there's multiple .config files in the project - In our case, there's not. I could really use some help to find an explanation and find a permanent (no- hack) fix.

此问题被标记为重复,但 2 个线程中的相应答案和原因明显不同.不确定此标签的用途 - 在发布此问题之前,我已经阅读了该特定帖子,因为它没有回答我的问题.此错误消息有多种原因.它是相似的",但绝对不是重复的!

This question is marked as a duplicate, but the corresponding answers and cause(s) in the 2 threads, are clearly different from each other. Not sure what is intended with this tag - I've read that particular post before posting this question, as it didn't answer my question. There's multiple causes for this error message. It is 'similar', but definitely not a duplicate!

推荐答案

我也在删除 obj 文件夹,直到与需要它的构建脚本发生冲突.Catch-22,我使用以下 SO 链接上接受的答案将 Obj 文件夹的位置移动到 C:TempBUILD.您必须为每个 csproj 文件执行此操作,但这是一个很好的解决方案.

I too was deleting the obj folder until I had a conflict with a build script which required it. Catch-22, I used the accepted answer on the following SO link to move the location of the Obj folder to C:TempBUILD. You have to do it per csproj file, but it is a great solution.

这里是链接:VisualStudio:如何保存obj 文件夹在别处

请注意,我使用一个变量作为项目名称.R:TempBuildDebug$(MSBuildProjectName)

Note that I am using a variable for the project name. R:TempBuildDebug$(MSBuildProjectName)

我的所有项目(包括类项目)的调试和发布部分都有上述行.我的构建路径是速度的 ram 驱动器.有关更多信息,请参阅此 SO:如何访问 csproj 文件中的宏变量?

I have the above line in both debug and release sections for all my projects, including class projects. My build path is a ram drive for speed. See this SO for more info: How to access macro variables within csproj file?

这篇关于allowDefinition='MachineToApplication' msbuild 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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