Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent MVCBuildViews from deleting MSdeploy Package

I am trying to build and deploy my MVC project in VSO. I have only two steps in my Build definition and you can se them below: enter image description here

And here are my MSBuild Arguments:

/p:DeployOnBuild=true /p:PublishProfile=Project.TEST.pubxml /p:DesktopBuildPackageLocation="" /p:WebPublishPipelineProjectName=Project.TEST /p:AutoParameterizationWebConfigConnectionStrings=False

My issue here is that when every i try to build this definition i get an empty publish zip file. I found out it is because of i have set MVCBuildViewsto be true in my .csproj file. If the MvcBuildViews is set to true then the project will build the views from this target:

 <Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
  </Target>

I have tried to set the BaseIntermediateOutputPath to another location but this solveds nothing because the compiler deletes the package folder in both locations.

I can't seem to figure out what to do. is there a way to disable CleanupForBuildMvcViews because this is what seems to delete the package folder before building the views.

like image 202
Lahib Avatar asked Nov 07 '25 00:11

Lahib


1 Answers

Try adding the following attribute to your target:

 BeforeTargets="PipelineCollectFilesPhase"

I think you just need to compile the views sooner in the build process (before the files are pulled for packaging). Not sure exactly which Target you should run before but this one looks right to me.

like image 165
chief7 Avatar answered Nov 09 '25 17:11

chief7