Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The target MvcBuildViews listed in a BeforeTargets attribute at Microsoft.Web.Publishing.targets does not exist in the project, and will be ignored

In TeamCity build I see a bunch (between 80 to 120 or so) lines that look exactly like the following (with only the timestamp changing) and I have no clue what they do or how to resolve them (the build in total succeeds):

[05:58:44][Step 1/3] The target "MvcBuildViews" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets (839,131)" does not exist in the project, and will be ignored.

Or, in shorter form without the logger's garbage:

The target "MvcBuildViews" listed in a BeforeTargets attribute at Microsoft.Web.Publishing.targets (839,131) does not exist in the project, and will be ignored.

Besides being strange that they appear at all and are repeated over and over, recently somewhere in the middle of the list, there's a large gap in time:

[05:58:44][Step 1/3] The target "MvcBuildViews" [...]
[06:19:38][Step 1/3] The target "MvcBuildViews" [...]

Leading to our builds running in total about 30 minutes as opposed to the "normal" 5 minutes or so.

Googling for this message gave me no hits at all, so I estimate my chances on resolving this to be rather slim, but if anyone has encountered this before and knows what's causing this, I'd be very interested to know about a resolution.

This project is build with VS 2010 (yes, we need to update, really), and TeamCity's version is 9.1.3.

PS: hints as to what this warning may entail (apart from apparently related to MVC) and to where to start searching for a solution are of course just as welcome ;)

like image 655
Abel Avatar asked Nov 30 '15 06:11

Abel


People also ask

Where can I find the target for mvcbuildviews?

The target "MvcBuildViews" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets (852,131)" does not exist in the project, and will be ignored.

What is target MSBuild in Visual Studio?

MSBuild targets. Targets group tasks together in a particular order and allow the build process to be factored into smaller units. For example, one target may delete all files in the output directory to prepare for the build, while another compiles the inputs for the project and places them in the empty directory.

What happens if there are no initial targets in MSBuild?

If there are no initial targets, default targets, or command-line targets, then MSBuild runs the first target it encounters in the project file or any imported project files. Targets can describe dependency relationships with each other. The DependsOnTargets attribute indicates that a target depends on other targets.

What is the defaulttargets attribute in Visual Studio?

The DefaultTargets attribute of the Project element specifies which target or targets are built if a target isn't specified explicitly in a command line. The value of the DefaultTargets attribute can be a semicolon-delimited, ordered list of default targets. The following example specifies that the Clean target runs, and then the Build target runs.


1 Answers

I had the same issue with one of my projects. In my particular scenario, it was caused by a missing 'Target' element in my csproj file. Adding the following to the bottom of the csproj fixed the issue.

<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
  <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
like image 113
James H Avatar answered Oct 10 '22 13:10

James H