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 67481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:16:00+00:00 2026-05-10T19:16:00+00:00

I have a simple Word to Pdf converter as an MSBuild Task. The task

  • 0

I have a simple Word to Pdf converter as an MSBuild Task. The task takes Word files (ITaskItems) as input and Pdf files (ITaskItems) as output. The script uses a Target transform for conversion:

<Project DefaultTargets='Build' xmlns='http://schemas.microsoft.com/developer/msbuild/2003' ToolsVersion='3.5'>   <UsingTask AssemblyFile='$(MSBuildExtensionsPath)\MyTasks.dll' TaskName='MyTasks.DocToPdf' />   <Target Name='Build' DependsOnTargets='Convert' />   <Target Name='Convert'           Inputs='@(WordDocuments)'           Outputs='@(WordDocuments->'%(FileName).pdf')'>     <DocToPdf Inputs='@(WordDocuments)'               Outputs='%(FileName).pdf'>       <Output TaskParameter='ConvertedFiles' ItemName='PdfDocuments' />     </DocToPdf>   </Target>   <ItemGroup>     <WordDocuments Include='One.doc' />     <WordDocuments Include='SubDir\Two.doc' />      <WordDocuments Include='**\*.doc' />   </ItemGroup> </Project> 

What’s happening is that SubDir\Two.doc gets converted on every incremental build, One.doc does not (ie MSBuild correctly skips that file because it was already converted). If I use the recursive items spec (the third one above), I get the same behaviour (ie. One.doc only gets converted if the PDF is out of date or missing, but all documents in subdirectories always get converted regardless).

What am I doing wrong here?

  • 1 1 Answer
  • 3 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. 2026-05-10T19:16:01+00:00Added an answer on May 10, 2026 at 7:16 pm

    I found the problem. It turns out that I had some logic in the Task that would turn any relative path specified for a PDF file into an absolute path. Once I removed that and changed the script to this:

      <Target Name='Convert'           Inputs='@(WordDocuments)'           Outputs='@(WordDocuments->'%(RelativeDir)%(FileName).pdf')'>     <DocToPdf Inputs='%(WordDocuments.Identity)'               Outputs='%(RelativeDir)%(FileName).pdf'>       <Output TaskParameter='ConvertedFiles' ItemName='PdfDocuments' />     </DocToPdf>   </Target> 

    I got the behaviour I expected.

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

Sidebar

Related Questions

I have simple form. <form target=_blank action=somescript.php method=Post id=simpleForm> <input type=hidden name=url value=http://...> <input
I have another csv file where I am trying to do a simple word
I have a very simple Office utility question. Open Microsoft word (2003 or 2007),
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script
I'm trying to understand this: http://tcs.uj.edu.pl/~walczak/fibonacci.pdf I have a word created from a concatenation
Say if I want to convert 1000s of word files to pdf then would
I have a couple of PDF template files with complex content and several blank
I have built a simple word addin that interacts with a company intranet. For
I have a very simple Word sub in a dotm template: Sub YHelloThar(msg As
I have following simple code for a word/tag in a tagcloud: <a about=http://localhost/d456c6 href=http://localhost/d456c6

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.