PrecompileBeforePublish using Msbuild

前端 未结 3 1865
悲哀的现实
悲哀的现实 2021-02-01 23:50

We are using Windows Azure to host our application on a Cloud Service and use Powershell to build and package the website using msbu

相关标签:
3条回答
  • 2021-02-02 00:33

    rex the solution to your problem is, add a new web deployment project for your website which will automatically pre-compile your website and the project will contain pre-compiled web outputs. If you don't get the web deployment project in your right click please download the tool for Visual Studio with respect to either 32 or 64 bit which will be added to your visual studio Or if you want to do it through MS Build you need to refer to https://msdn.microsoft.com/en-us/library/ms227972.aspx or you can also refer to http://www.asp.net/web-forms/overview/older-versions-getting-started/deploying-web-site-projects/precompiling-your-website-vb I hope I helped you in some way.

    0 讨论(0)
  • 2021-02-02 00:36

    I think, your problem is not pre-compilation and I see, you have done precompiling well.

    I think your project is too big (Check your final bin directory size) IIS read every dll, and debug symbols and load them in to memory before running any line of code.

    If your project size too big, and your virtual environment resorces are low, magnetic disk, low ram, low cpu, so there is no magic in it.

    Recommendations:

    1. Try to reduce size of the project output. (Removing debug symbols can be an option).
    2. Remove all not used references... (Both .net and 3rd Party) (edit, added)
    3. Scale up your environment configuration.

    Regards...

    0 讨论(0)
  • 2021-02-02 00:45

    It's been a while since this question was posted and there is still no good answer. Recently I wanted to change the way MSBuild runs aspnet_compiler.exe but found no documentation. I did a bit of digging around and here is my experience.

    Precompiling will only happen if you use both the DeployOnBuild and PrecompileBeforePublish parameters. Other usable parameters are EnableUpdateable and UseFixedNames.

    msbuild Web.sln /p:DeployOnBuild=true /p:PrecompileBeforePublish=true /p:EnableUpdateable=false /p:UseFixedNames=true
    

    You can achieve a similar result if you change precompile options in Visual Studio. This can be done at Project > Publish > Configure > Settings > File Publish Options > Precompile during publishing > Configure.

    link to image

    This is how the parameters should appear in your .pubxml file:

        <PrecompileBeforePublish>True</PrecompileBeforePublish>
        <EnableUpdateable>False</EnableUpdateable>
        <DebugSymbols>True</DebugSymbols>
        <WDPMergeOption>CreateSeparateAssembly</WDPMergeOption>
        <UseFixedNames>True</UseFixedNames>
    

    Since there is no documentation to be found you might want to change these options and see the resulting .pubxml file to see what further parameters to use in the command line.

    0 讨论(0)
提交回复
热议问题