VS 2010 pre-compile web sites with build process?
Asked Answered
H

4

1

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 my sites to be pre-compiled. I can do it with the command line, using:

 C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler 
-v /site_name 
-p "C:\...\site_name" 
-f "C:\...\site_name1"

and this works fine if I copy the files over from site_name1 to site_name...

but is there an option in the IDE for this?? It seems really silly to have to do this from the command line. I've read a lot about different options, but none seem applicable to building with the build definitions.

Hygrometric answered 26/9, 2011 at 19:44 Comment(0)
H
0

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! :)

Hygrometric answered 29/9, 2011 at 16:40 Comment(1)
you do NOT have to crack open the build process templateHarcourt
H
3

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"
Harcourt answered 5/12, 2011 at 20:29 Comment(0)
H
0

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! :)

Hygrometric answered 29/9, 2011 at 16:40 Comment(1)
you do NOT have to crack open the build process templateHarcourt
S
0

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?

Sacerdotalism answered 26/1, 2012 at 18:15 Comment(0)
A
0

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"
Achernar answered 31/8, 2016 at 14:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.