在大$ P $错误CS0433 pcompiled Asp.net网站项目错误、项目、网站、Asp

2023-09-07 15:01:32 作者:姜子牙疼

背景

我已经接管了一个非常大的asp.net网站项目。旧的部署过程是的.cs,的.aspx和.ascx文件复制到IIS和有它建立在飞。我想precompile,并使用TeamCity的自动部署。我已经与其他一些网站的项目做到了这一点。

I've taken over a very large asp.net website project. The old deploy process was to copy .cs, .aspx, and .ascx files to IIS and have it build on the fly. I want to precompile it and use TeamCity to automatically deploy it. I've done this with some of the other website projects.

该项目已被很好地组织到文件夹,但用于所有的地方约350用户控件。控制从其他文件夹中引用,彼此......基本上是一个循环文件​​引用的噩梦。

The project has about 350 user controls that are nicely organized in folders but are used all over the place. Controls referenced from other folders, from each other... Basically a circular file reference nightmare.

我尝试

我的第一次尝试是建立它像其他人。 MSBUILD整个vs2012的解决方案。我跑进吨的循环文件引用不准。来了解一下这些精美的组织控制的使用无处不在,有循环引用的所有的地方。 I读这和我交换的web.config文件为编纂一批=假,然后在构建设置现场不更新和使用固定的命名集。该网站建立,但需要从字面上25分钟编译我的四核,SSD,16GB内存dev的框。这是不可接受的编译时间。

My first attempt was to build it like the others. MSbuild the whole vs2012 solution. I ran into tons of "circular file references are not allowed". Come to find out all these nicely organized controls are used everywhere and there are circular references are all over the place. I read this and I switched the "web.config" to compilation batch="false" and then in the build set the site to "not be updateable" and "use fixed naming assemblies". The site builds but takes literally 25 minutes to compile on my quad core, ssd, 16gb ram dev box. This is unacceptable build times.

我知道,如果我关掉使用固定的命名组件,该网站将显著加快建设。 (我在的小网站1证明了它,它去了4分钟45秒)。当我删除的设置我得到奇怪的生成错误:

I know that if I turn off "use fixed naming assemblies" that the site would build significantly faster. (I've proven it on one of the smaller websites. It went from 4 minutes to 45 seconds). When I do remove that setting I'm getting weird build errors:

c:\Projects\Web\Site.master(146): error CS0433: The type 'ASP.usercontrols_modules_viewprofilepopup_ascx' exists in both 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web\8d37b2c6\4c39f0a\App_Web_viewprofilepopup.ascx.4101713c.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web\8d37b2c6\4c39f0a\App_Web_xa514so5.dll'

c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web\8d37b2c6\4c39f0a\App_Web_site.master.cdcab7d2.0.cs(927): error CS0433: The type 'ASP.usercontrols_modules_viewprofilepopup_ascx' exists in both 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web\8d37b2c6\4c39f0a\App_Web_viewprofilepopup.ascx.4101713c.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web\8d37b2c6\4c39f0a\App_Web_xa514so5.dll'

error ASPPARSE: c:\Projects\web\Web\UserControls\Modules\JobsLeftMenu.ascx(128): error CS0433: The type 'ASP.usercontrols_modules_imagesgallerymodule_ascx' exists in both 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web\8d37b2c6\4c39f0a\App_Web_imagesgallerymodule.ascx.4101713c.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web\8d37b2c6\4c39f0a\App_Web_nvrj33tx.dll'

error ASPPARSE: c:\Projects\web\Web\Site.master(146): error CS0433: The type 'ASP.usercontrols_modules_viewprofilepopup_ascx' exists in both 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web\8d37b2c6\4c39f0a\App_Web_viewprofilepopup.ascx.4101713c.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web\8d37b2c6\4c39f0a\App_Web_xa514so5.dll'

下面是确切的aspnet_compiler.exe命令:

Here is the exact aspnet_compiler.exe command:

aspnet_compiler.exe -v /网络-p网络\ -fpcompiled $ P $网站

aspnet_compiler.exe -v /web -p Web\ -f "Precompiled Web"

我用Google搜索周围的答案。不,他们没有被复制在code的任何地方。他们只是刚好在不同的文件夹,在不同的文件夹使用的其他控件。我有一种感觉,这是由于循环文件引用的事情。好的。我删除了其中的几个用法,看它是否会建立和构建过程只是移动到其他错误,就像这一个。我不能只是删除code遍,以适应这个...我如何解决这些错误不打开使用固定命名assembilies?

I googled around for answers. NO, they aren't duplicated in the code anywhere. They just happen to be in different folders, used by other controls in different folders. I have a feeling this is due to the circular file reference thing. Ok... Fine. I removed the usage of a few of these to see if it would build and the build process just moves onto other errors just like this one. I can't just remove code all over to accommodate this... How can I fix these errors without turning on "use fixed naming assembilies"?

东西的我试过

清除 ASP.NET临时文件所有在我的系统。 在尝试了发布从Visual Studio 2012年同样的错误之内的权利。 试过网站转换为Web应用程序,但得到(向上600+)太多的错误。 还是那句话:确信,没有重复的文件和code,将解释。我的文字搜索用记事本++整个解决方案的文件夹,以验证有没有同名的另一个控件。 经过这一点。 在我的MSBuild性能调整开启: / M / P:CreateHardLinksForCopyLocalIf​​Possible = TRUE /号码:BuildInParallel = TRUE Cleared the Temporary ASP.NET Files all throughout my system. Tried a "publish" right from within visual studio 2012. Same errors. Tried converting the site to a Web Application but got too many errors (upwards of 600+). Again: made sure that there was no duplicate files and code that would explain it. I text searched the entire solution folder with notepad++ to validate that there wasn't another control with the same name. Checked this. I have msbuild performance tweaks turned on: /m /p:CreateHardLinksForCopyLocalIfPossible=true /p:BuildInParallel=true

我难倒,似乎觉得我唯一的选择就是重新编写应用程序,通过错误苦干,我转换成一个Web应用程序,或继续部署源到Web服务器但它的自动化。

I'm stumped and seem to think my only option is to rewrite the app, slog through the errors as I convert to a Web Application, or continue deploy source to the webserver but do it automated.

推荐答案

我知道你已经尝试过了,但避免了循环引用将会在这里你最好的选择。注意,术语循环引用其实是不太正确的。什么是构建系统抱怨是在目录级,而不是文件级别的循环引用。

I known you've tried that already, but avoiding the circular references is going to be your best bet here. Note that the term 'circular reference' is actually not quite correct. What the build system complains about is circular references at the directory level, not the file level.

例如。 SUB1 \ page.aspx 使用 SUB 2 \ uc1.ascx 使用 SUB1 \ uc2.ascx

在文件层面,没有圈子,但在目录级别存在,并且搞砸的方式分批作品。

At the file level, there is no circle, but at the directory level there is, and that messed up with the way batching works.

虽然它可能看起来像你有这么多的这些情况,以使其无法修复的,我敢打赌,如果你看一下目录圆的细节,这是下降到没有那么多。绘制参考曲线可以帮助意义的事情。

While it may seem like you have so many of these situations as to make it unfixable, I'd bet that if you look at the details of the 'directory circles', it's down to not all that many. Drawing the reference graph might help make sense of things.

然后你只需要移动的罪犯到不同的文件夹,并相应地改变了链接。

Then you just need to move the offenders into a different folder and change the links accordingly.

是的,这是一个痛苦的过程,但它很可能可以解决的。

Yes, it's a painful process, but it is likely solvable.

 
精彩推荐
图片推荐