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

查看:63
本文介绍了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):错误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文件-在我们的情况下没有.我真的可以使用一些帮助找到说明,并找到永久的(无hack)修复程序.

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.

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

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:\Temp\BUILD.您必须对每个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:\Temp\BUILD. You have to do it per csproj file, but it is a great solution.

此处是链接: VisualStudio:如何保存obj文件夹在其他地方

请注意,我正在使用变量作为项目名称. R:\ Temp \ Build \ Debug \ $(MSBuildProjectName)

Note that I am using a variable for the project name. R:\Temp\Build\Debug\$(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天全站免登陆