aspnet_compiler -fixednames does not work?

情到浓时终转凉″ 提交于 2019-12-13 05:48:14

问题


I am unable to get the -fixednames switch to create dlls for the cs code behind files. The files in the bin folder are compiled aspx pages, but the code behind files are all compiled into one large websitename.dll file.

Here is my command with switches. aspnet_compiler -v / -p E:\Source\DotNet4\mysolution\website -f -d -fixednames E:\Source\DotNet4\CompiledWebSite

This produces many files in the bin folder.

website.dll and website.pdb (contains code behind) myform1.aspx.643c7876.dll (compiled aspx layout ui)

I have tested this over and over to make sure I am not missing anything. The test is place a label on myform1.aspx, and in the codebehind populate the label with some text. Compile the website with the above switches and deploy the website.

Make a change to the myform1 codebehind and change the label text. Compile and only deploy the myform1.aspx.643c7876.dll to the website. Result: label is still the same. Now deploy the website.dll and pdb and the label changes.

Can anyone tell me how to get -fixednames to create sinle dlls for codebehind?


回答1:


I think the difference really is in the Web Application vs. Web Site concept. I created two identical apps - one as a Web Application, and one as a Web Site, in Visual Studio. The page was default.aspx, and the class is "_Default". When I ran "aspnet_compiler -v / -p . -f -d -fixednames ..\CompiledSite" on the Web Application, there were 2 dlls in the new bin, one called WebApplication1.dll, and it contained the _Default class, and one called App_Web_default.aspx.cdcab7d2.dll, which contained the markup. When I compiled the WebSite with the exact same command line, it only created one DLL, with both the markup and the _Default class.

Don't ask me how it knew the difference between the two - the only thing I can think of is the fact that the csproj file exists for the Web Application.

From what I've read and the way I understood things, aspnet_compiler was designed for WebSite projects, not Web Application projects, which is why I assumed you were using a WebSite.

If you need your application designed to be single-paged DLLs, try building a new WebSite project, adding your .aspx and .aspx.cs files to that WebSite, and compiling with your aspnet_compiler command, and see what happens. You can start with just one or two pages for a sample.

You won't need to actually test and recompile etc. in order to determine if it worked - just look at the DLL files in Reflector, and see where your classes live - if they live in the same DLL as the markup, then it worked, otherwise, they must be in the centralized application DLL.

Hopefully that all made sense - good luck.



来源:https://stackoverflow.com/questions/2702111/aspnet-compiler-fixednames-does-not-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!