MVC precompile publish
What is the recommended way in AppVeyor for web deploy with precompilation of a MVC project?
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Feodor Fitsner on 21 Aug, 2014 08:00 PM
Hi Kristoffer,
It's not yet support out of the box. Do you have any recommendations about how it could look in AppVeyor though?
2 Posted by kristoffer on 21 Aug, 2014 08:25 PM
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.
3 Posted by kristoffer on 21 Aug, 2014 09:57 PM
This seems to generate the correct obj\Release\Package<projectname>.zip file when placed in projectname.wpp.targets file next to the webproject.csproj
Parts of it is from the publishprofile I usually use.
It does indeed package the app correctly and precompiles it (verified through unzip and checking views with false and true for PrecompileBeforePublish) also noticed that it compiles the App_Code folder (razor helpers) when run with PrecompileBeforePublish in the wpp.targets file
Ran it with :
I will give this configuration a try tomorrow through an appVeyor build.
Support Staff 4 Posted by Feodor Fitsner on 21 Aug, 2014 10:09 PM
Wow, thanks for the great howto!
5 Posted by kristoffer on 21 Aug, 2014 10:18 PM
Thank you Feodor,
Just ran an AppVeyor build (Couldn't wait until tomorrow ;) ) and sure enough the web deploy artifact is precompiled.
The only thing needed was that the file is present and the default MSBUILD command that appveyor runs takes care of the rest.
Noticed one thing though! if you have
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.
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
More info about wpp.targets and what it is
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.
http://msdn.microsoft.com/en-us/library/ff398069(v=vs.110).aspx
6 Posted by kristoffer on 22 Aug, 2014 02:30 PM
Noticed that the projectname.wpp.targets can override the MvcBuildViews 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.
kristoffer closed this discussion on 25 Aug, 2014 03:30 PM.
Ilya Finkelshteyn re-opened this discussion on 04 Jul, 2017 07:13 PM
7 Posted by Ilya Finkelshte... on 04 Jul, 2017 07:13 PM
Addition note from another customer:
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 dev build and staging build etc.
e.g.
Condition="'$(Configuration)|$(Platform)' == 'Production|AnyCPU'
8 Posted by Øyvind Valland on 05 Jul, 2017 07:48 AM
For completeness, this is what my wpp.targets file looks like with conditional PropertyGroups
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:18 AM.