If I use aspnet_compiler to publish an ASP.NET MVC web site, does it do the same tasks that devenv would do? Or is it just pre-compiling to minimize the startup delay?
I.E. my requirnment is to be able to compile and publish an ASP.NET web site. in this case, should I use devenv first to build the web site, and then use aspnet_compiler to pre-compile and copy the files over (Publish)?
Or if I just use aspnet_compiler would that also do the building (compiling) of the source and reference projects to relevent开发者_如何学JAVA dlls?
Your responses are highly appreciated. Thanks a lot.
Lets start from short answer - aspnet_compiler.exe
is not related to ASP.NET MVC
.
MVC projects are compiled either by devenv.exe
or msbuild.exe
or whatever else is out there (Roslyn anyone?). But those 2 are provided with VS installation.
aspnet_compiler
is used [in compilation sense] to compile WSP - web site projects. In WSP each code behind is compiled into separate DLL. But MVC projects compile into single DLL like WAP - web application project.
I doubt you have WSP and MVC, and even if you had one - still, it is better compile using devenv
because devenv compiles ashx
files and aspnet_compiler doesn't. This could lead to failures at runtime.
To understand problem better research on
web site projects vs web application project
Although, I believe in VS15 WSP is gone
I don't know if ther is such thing as aspnet_compiler. Have a look at part of 'Visual C# -> ASP.NET Web Application' project file:
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.\WebApplications\Microsoft.WebApplication.targets" />
First line is standard C# target. Second, is more interesting as it is ASP.NET specyfic. If you look into its content you will find definition of of Publish target and that is probably what you are looking for.
For building and publishing your project you can use (or even just Publish if there are predefined dependencies, I haven't check it)
msbuild /t:Build,Publish <project file>
精彩评论