First, use msbuild for compilation.
Msbuild mypro. csproj/P: configration = release
Then publish with aspnet_compiler
Example:
Aspnet_compiler-V/deployment-p c: \ Inetpub \ wwwroot \ myprojects \ developer \ deployment c: \ compiled
-V is a virtual directory. You can specify
-P is the solution directory
Targetdir is the target directory of the release, where C: \ compiled
-U, no pre-compilation, so that the pre-compilation will only be performed when the page is accessed for the first time. The page can be modified on the website and will be compiled at the next visit, however, after each modification, the first access speed slows down. If this parameter is not added ,. NO content in pages such as aspx
-F: delete all contents in the directory folder before publishing.
-Fixednames: fixed the DLL name generated on each page during pre-compilation. In this way, a DLL is generated for each page, but this facilitates future update.