Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8310991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:39:35+00:00 2026-06-08T19:39:35+00:00

I am trying to apply a transform to an HTML file. The transform works

  • 0

I am trying to apply a transform to an HTML file. The transform works correctly with divs and spans but as soon as I insert a P tag it will fail.

The HTML file I am transforming is:

<!DOCTYPE html>
<html>
  <head>
    <title>STREAM Interactive - UAT</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  </head>
    <body>
          <p>my para</p>
    </body>
</html>

The transform file is very simple:

<html xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
   <head>
     <title xdt:Transform="Replace">TITLEHEADINGHERE</title>
   </head>  

</html>

The project file that is used to do the transform is:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="TransformXml" AssemblyFile="C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.Dll"/>

    <PropertyGroup>
        <SourceFile>web.config</SourceFile>
        <TransformFile>web.debug.config</TransformFile>
        <OutputFile>final.config</OutputFile>
    </PropertyGroup>

    <Target Name="GenerateConfigs">
        <Message Text="Beginning Transformation." />
        <Message Text="$(SourceFile)" />
        <TransformXml Source="$(SourceFile)" Transform="$(TransformFile)" Destination="$(OutputFile)" />
        <Message Text="Completed Transformation." />
    </Target>

</Project>

The command used is:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe D:\SAM\SAMSite\bin\msbuild-transform-Template.xml /p:SourceFile="C:\temp\buildTest\BlueZone\2.3.10.5\PublishedClickOnce\index.html" /p:TransformFile="D:\SAM\SAMSite\bin\TransformTemplates\clickonce.index.transform.temp" /p:OutputFile="C:\temp\buildTest\BlueZone\2.3.10.5\PublishedClickOnce\index.html.temp"

The output / error I get is:

Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.269]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 02/07/2012 10:54:33.
Project "D:\SAM\SAMSite\bin\msbuild-    transform-Template.xml" on node 1 (default targets).
GenerateConfigs:
  Beginning Transformation.
  C:\temp\buildTest\BlueZone\2.3.10.5\PublishedClickOnce\index.html
  Transforming Source File:     C:\temp\buildTest\BlueZone\2.3.10.5\PublishedClickOnce\index.html
  Transformation succeeded
D:\SAM\SAMSite\bin\msbuild-transform-Template.xml(13,3): error MSB4018: The "TransformXml" task failed unexpectedly.
D:\SAM\SAMSite\bin\msbuild-transform-    Template.xml(13,3): error MSB4018: System.UriFormatException: Invalid URI: The URI is empty.
D:\SAM\SAMSite\bin\msbuild-transform-    Template.xml(13,3): error MSB4018:    at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
D:\SAM\SAMSite\bin\msbuild-transform-Template.xml(13,3): error MSB4018:    at Microsoft.Web.Publishing.Tasks.TransformXml.Execute()
D:\SAM\SAMSite\bin\msbuild-transform-Template.xml(13,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
D:\SAM\SAMSite\bin\msbuild-transform-Template.xml(13,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
Done Building Project "D:\SAM\SAMSite\bin\msbuild-transform-Template.xml" (default targets) -- FAILED.

Build FAILED.

"D:\SAM\SAMSite\bin\msbuild-transform-Template.xml" (default target) (1) ->
(GenerateConfigs target) -> 
  D:\SAM\SAMSite\bin\msbuild-transform-Template.xml(13,3): error MSB4018: The "TransformXml" task failed unexpectedly.
D:\SAM\SAMSite\bin\msbuild-transform-Template.xml(13,3): error MSB4018: System.UriFormatException: Invalid URI: The URI is empty.
D:\SAM\SAMSite\bin\msbuild-transform-Template.xml(13,3): error MSB4018:    at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
D:\SAM\SAMSite\bin\msbuild-transform-Template.xml(13,3): error MSB4018:    at Microsoft.Web.Publishing.Tasks.TransformXml.Execute()
D:\SAM\SAMSite\bin\msbuild-transform-Template.xml(13,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
D:\SAM\SAMSite\bin\msbuild-transform-Template.xml(13,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.09

The HTML has been stripped down to the barest possible, previously there have been div’s and spans in there. Interestingly, if I gave the P tag a class it works.

I have no idea why this would be the case.

EDIT

As per @Kieren’s suggestion I have tried to run using the TransformXml directly. I get a new error:

Data at the root level is invalid. Line 1, position 1.

   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlTextReader.Read()
   at Microsoft.Web.Publishing.Tasks.XmlAttributePreservationDict.ReadPreservationInfo(String elementStartTag)
   at Microsoft.Web.Publishing.Tasks.XmlAttributePreservationProvider.GetDictAtPosition(Int32 lineNumber, Int32 linePosition)
   at Microsoft.Web.Publishing.Tasks.XmlFileInfoDocument.XmlFileInfoElement..ctor(String prefix, String localName, String namespaceUri, XmlFileInfoDocument document)
   at Microsoft.Web.Publishing.Tasks.XmlFileInfoDocument.CreateElement(String prefix, String localName, String namespaceURI)
   at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
   at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at Microsoft.Web.Publishing.Tasks.XmlFileInfoDocument.LoadFromTextReader(TextReader textReader)
   at Microsoft.Web.Publishing.Tasks.XmlFileInfoDocument.LoadFromFileName(String     filename)
   at Microsoft.Web.Publishing.Tasks.XmlFileInfoDocument.Load(String filename)
   at QuickTests.TestTransformXml.OpenSourceFile(String sourceFile) in C:\Users\jon\Documents\Visual Studio 2010\Projects\QuickTests\QuickTests\TestTransformXmlTask.cs:line 140
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:39:37+00:00Added an answer on June 8, 2026 at 7:39 pm

    According to the bug report I filed this has now been fixed. Assuming it will be included in the next release of MsBuild, (don’t know when that will be):

    https://connect.microsoft.com/VisualStudio/feedback/details/752279/msbuild-tansform-failure-for-elements-with-only-one-character

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to apply a transform to my msi file. I've created the transform
I am trying to transform an RDF file to HTML using XSLT. I am
I'm trying to apply a transform to a 3D object in a STL File
I am trying to transform an xml file with xsl stylesheet into html. this
I am trying to apply smoothing filter to image . But I get this
I'm trying to apply a tooltip to a toolstripbutton but it keeps giving me
I'm trying to apply an xlst transformation using the following file. This is very
I have an XML file and I'm trying convert it into a (table( HTML
I am trying to apply the styles of a hyperlink in normal html to
I am trying to understand apply-templates but I do not understand why I don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.