0
votes

What is Write Lines to File task in MS Build. I am trying to set up a deploy for an website I inherited. I am not that familiar with the MS Build internals. I am not even sure if this is a common thing for all the projects or if something was specifically enabled for this project. What is it?

[Package] CallTarget (2s)
[17:10:43][CallTarget] PackageUsingManifest (2s)
[17:10:45][PackageUsingManifest] CallTarget
[17:10:45][CallTarget] GenerateSampleDeployScript
[17:10:45][GenerateSampleDeployScript] WriteLinesToFile
[17:10:45][WriteLinesToFile] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3025, 23): error MSB4064: The "Encoding" parameter is not supported by the "WriteLinesToFile" task. Verify the parameter exists on the task, and it is a settable public instance property.
[17:10:45][WriteLinesToFile] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3023, 5): error MSB4063: The "WriteLinesToFile" task could not be initialized with its input parameters.

2

2 Answers

4
votes

Looks like you're building for .Net 2.0 or at least with the 2.0 version of the buildtools. Your script depends on the 4.0 msbuild tools version.

Only the 4.0 version of WriteLinesToFile has an encoding property.

In Visual Studio goto the Project properties (menu Project > Project name properties..), on the application tab check targetFramework to be 4.0

If you are building from the commandline add the /tv:4.0 setting.

0
votes

Great answer from Rene - it saved my life today :)

Forcing the toolversion in Project header also works :

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
  ToolsVersion="12.0">

See : https://msdn.microsoft.com/en-us/library/bb383985.aspx