MVC Project does not build from command line

Sam Kenny
Sam Kenny’s a(musing)
1 min readFeb 3, 2013

A new MVC project that produced errors related to invalid target,’ publishtofilesystem’ when integrating it into a Bamboo build process. Searching through the project settings in the Visual Studio GUI did not reveal any solutions.

The fix was to embed the following into the .csproj file (which is really just XML):

These first 3 lines are the point at which to insert).

<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
<Target Name="PublishToFileSystem" DependsOnTargets="PipelinePreDeployCopyAllFilesToOneFolder">
<Error Condition="'$(PublishDestination)'==''" Text="The PublishDestination property must be set to the intended publishing destination." />
<MakeDir Condition="!Exists($(PublishDestination))" Directories="$(PublishDestination)" />
<ItemGroup>
<PublishFiles Include="$(_PackageTempDir)\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(PublishFiles)" DestinationFiles="@(PublishFiles->'$(PublishDestination)\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="True" />
</Target>

--

--