VS 2010 pre-compile web sites with build process?

后端 未结 4 410
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-20 06:56

VS 2010; TFS 2010; ASP.Net 4.0; Web Deployment Projects 2010;

I am using the build process templates in order to do one-click deploys (for dev and QA only). I want m

相关标签:
4条回答
  • 2020-12-20 07:13

    You can do this by adding the following to your .csproj file

    <PropertyGroup>
    <PrecompileVirtualPath>/whatever</PrecompileVirtualPath>
    <PrecompilePhysicalPath>.</PrecompilePhysicalPath>
    <PrecompileTargetPath>..\precompiled</PrecompileTargetPath>
    <PrecompileForce>true</PrecompileForce>
    <PrecompileUpdateable>false</PrecompileUpdateable>
    </PropertyGroup>
    
     <Target Name="PrecompileWeb" DependsOnTargets="Build">
    <Message Importance="high" Text="Precompiling to $(PrecompileTargetPath)" />
    <GetFullPath path="$(PrecompileTargetPath)">
      <Output TaskParameter="fullPath" PropertyName="PrecompileTargetFullPath" />
    </GetFullPath>
    <Message Importance="high" Text="Precompiling to fullpath: $(PrecompileTargetFullPath)" />
    <GetFullPath path="$(PrecompilePhysicalPath)">
      <Output TaskParameter="fullPath" PropertyName="PrecompilePhysicalFullPath" />
    </GetFullPath>
    <Message Importance="high" Text="Precompiling from fullpath: $(PrecompilePhysicalFullPath)" />
    <AspNetCompiler PhysicalPath="$(PrecompilePhysicalPath)" VirtualPath="$(PrecompileVirtualPath)" TargetPath="$(PrecompileTargetPath)" Debug="true" Force="$(PrecompileForce)" Updateable="$(PrecompileUpdateable)" FixedNames="true" />
    

    Then in TFS2010's default template

    • your build definition
    • Process tab
    • Advanced parameters section
    • MSBuild Arguments
    • set /target="PrecompileWeb"
    0 讨论(0)
  • 2020-12-20 07:14

    We have a website that is stored in TFS2010 as a Web application. I use a MSBuild command to deploy from TFS2010. If you open your project in VS2010 Team Explorer you will see there is a "Builds" option. If you add a build and in the process tab use a build argument like ...:/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:CreatePackageOnPublish=True /p:MSDeployPublishMethod=RemoteAgent /p:MSDeployServiceUrl=http://111.111.111.111/msdeployagentservice /p:DeployIisAppPath=MySiteNameInIIS /p:UserName=myDomain\BuildUser /p:Password=BuildUserPassword In the Process tab where it says "Items to Build" you just point it to your .sln file (might work with a .cspro but then the syntax changes slightly)

    We have a TFS2010 server and I deploy a few of our sites to a dev, qa, pre-production or production IIS server. I do unit testing on the dev build and if the test fail then I do not deploy.

    The MSBuild command does the pre-compile, would that work for you?

    0 讨论(0)
  • 2020-12-20 07:25

    A setting for precompiling has been added. The following works in Visual Studio 2015

    1. Open a solution
    2. Right click on the project
    3. Select "Publish..."
    4. Go to settings, expand "File
    5. Check "Precompile during Publishing"
    0 讨论(0)
  • 2020-12-20 07:27

    As it currently stands, I can not find any IDE option to pre-compile websites using the build process templates. I would love to be proved wrong, as using the command line aspnet_compiler requires us (in our setup) to crack open the actual build process template, which we are trying to avoid.

    I would love to be proved wrong! :)

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