tag:help.appveyor.com,2012-11-13:/discussions/kb/1-mvc-precompile-publishAppVeyor: Discussion 2018-10-19T08:16:42Ztag:help.appveyor.com,2012-11-13:Comment/342263902014-08-21T20:00:20Z2014-08-21T20:00:20ZMVC precompile publish<div><p>Hi Kristoffer,</p>
<p>It's not yet support out of the box. Do you have any
recommendations about how it could look in AppVeyor though?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/342263902014-08-21T20:25:43Z2014-08-21T21:18:22ZMVC precompile publish<div><p>Ok, then I know that it's not supported. I will see what I come
up with and let you guys know if I find a nice/clean way of doing
it.</p></div>kristoffertag:help.appveyor.com,2012-11-13:Comment/342263902014-08-21T21:57:51Z2014-08-21T22:05:35ZMVC precompile publish<div><pre>
<code><?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ExcludeApp_Data>True</ExcludeApp_Data>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>False</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
</PropertyGroup>
</Project></code>
</pre>
<p>This seems to generate the correct
obj\Release\Package<projectname>.zip file when placed in
projectname.wpp.targets file next to the webproject.csproj</p>
<p>Parts of it is from the publishprofile I usually use.</p>
<p>It does indeed package the app correctly and precompiles it
(verified through unzip and checking views with false and true for
<em>PrecompileBeforePublish</em>) <strong>also noticed that it
compiles the App_Code folder (razor helpers) when run with
PrecompileBeforePublish</strong> in the wpp.targets file</p>
<p>Ran it with :<br></p>
<pre>
<code>> "C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe" "projectname.csproj" /property:Configuration=Release /p:DeployOnBuild=True</code>
</pre>
<p><strong>I will give this configuration a try tomorrow through an
appVeyor build.</strong></p></div>kristoffertag:help.appveyor.com,2012-11-13:Comment/342263902014-08-21T22:09:06Z2014-08-21T22:09:06ZMVC precompile publish<div><p>Wow, thanks for the great howto!</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/342263902014-08-21T22:18:00Z2014-08-21T23:39:40ZMVC precompile publish<div><p>Thank you Feodor,</p>
<p>Just ran an AppVeyor build (Couldn't wait until tomorrow ;) )
and sure enough the web deploy artifact is precompiled.<br>
The only thing needed was that the file is present and the default
MSBUILD command that appveyor runs takes care of the rest.</p>
<p>Noticed one thing though! if you have<br></p>
<pre>
<code><MvcBuildViews>true</MvcBuildViews></code>
</pre>
<p>in the csproj for the configuration used for deploy then it can
fail because that will result in two aspnetcompiler calls and the
second one will fail.<br>
But that is no problem leaving it at false for RELEASE
configuration or removing it since it will be compiled either way
with the precompile</p>
<p><strong>More info about wpp.targets and what it is</strong></p>
<p>When you want to configure settings that apply to all profiles
you use in a project, you create a .wpp.targets file. The
.wpp.targets file must be located in the project folder and must be
named projectname.wpp.targets.<br>
<a href=
"http://msdn.microsoft.com/en-us/library/ff398069(v=vs.110).aspx">http://msdn.microsoft.com/en-us/library/ff398069(v=vs.110).aspx</a></p></div>kristoffertag:help.appveyor.com,2012-11-13:Comment/342263902014-08-22T14:30:08Z2014-08-22T14:30:09ZMVC precompile publish<div><p>Noticed that the projectname.wpp.targets can override the
<strong>MvcBuildViews</strong> so if we add it there we don't need
to change the csproj if we have it enabled there to find errors in
the views during development.<br></p>
<pre>
<code><?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IncludeSetACLProviderOnDestination>False</IncludeSetACLProviderOnDestination>
<ExcludeApp_Data>True</ExcludeApp_Data>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>False</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
<MvcBuildViews>False</MvcBuildViews>
</PropertyGroup>
</Project></code>
</pre></div>kristoffertag:help.appveyor.com,2012-11-13:Comment/342263902017-07-04T19:13:44Z2017-07-04T19:13:44ZMVC precompile publish<div><p><em>Addition note from another customer:</em></p>
<p>The only thing I've done differently is to use a Condition attribute on the PropertyGroup element in the wpp.targets file so that we can do things differently for our <em>dev</em> build and <em>staging</em> build etc.</p>
<p>e.g. <code>Condition="'$(Configuration)|$(Platform)' == 'Production|AnyCPU'</code></p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/342263902017-07-05T07:48:14Z2017-07-05T07:48:17ZMVC precompile publish<div><p>For completeness, this is what my wpp.targets file looks like with conditional PropertyGroups</p>
<pre>
<code><?xml version="1.0"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<ExcludeApp_Data>True</ExcludeApp_Data>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>False</PrecompileBeforePublish>
<EnableUpdateable>False</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
<MvcBuildViews>False</MvcBuildViews>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Development|AnyCPU'">
<ExcludeApp_Data>True</ExcludeApp_Data>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>False</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
<UseMerge>True</UseMerge>
<SingleAssemblyName>CompiledViews</SingleAssemblyName>
<MvcBuildViews>False</MvcBuildViews>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Production|AnyCPU'">
<ExcludeApp_Data>True</ExcludeApp_Data>
<DeleteExistingFiles>True</DeleteExistingFiles>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>False</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
<UseMerge>True</UseMerge>
<SingleAssemblyName>CompiledViews</SingleAssemblyName>
<MvcBuildViews>False</MvcBuildViews>
</PropertyGroup>
</Project></code>
</pre></div>Øyvind Valland