MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Fixing MSB4064 When Building VS2010 Web Solutions with NAnt

Originally published on 2010-03-09; fully revised and updated.

This article covers a legacy build issue that still appears in older enterprise codebases: a solution with web projects compiles in Visual Studio 2010, but fails from the command line through NAnt with Copy task errors. You will learn what is happening, why the temporary workaround does not hold, and how to align NAnt configuration with the installed .NET 4 runtime.

VS2010 web project compile issue from NAnt

Symptoms and error signature

In the reported case, the build succeeded in the IDE and failed from NAnt with these errors:

Error MSB4064: The "Retries" parameter is not supported by the "Copy" task.
Error MSB4063: The "Copy" task could not be initialized with its input parameter.Code language: JavaScript (javascript)

This pattern typically indicates that the command-line build is loading a different MSBuild/.NET toolchain than the one used by Visual Studio.

Why changing project files to 9.0 is only a temporary workaround

A workaround was found by editing project files to point from the v10.0 web application build targets back to 9.0. That allowed compilation once, but reopening in VS2010 reverted those edits. So it is not a stable fix for active development.

Troubleshooting workflow

flowchart TD
    A[Build works in Visual Studio 2010] --> B[NAnt command line build fails]
    B --> C{MSB4064 or MSB4063?}
    C -- yes --> D[Target NAnt to .NET 4 tools]
    D --> E[Add .NET 4 framework section in nant.exe.config]
    E --> F[Set vendor to Microsoft]
    F --> G[Match version token to installed Framework directory]
    G --> H[Run NAnt build again]
    C -- no --> I[Investigate other build errors]

Resolution options compared

OptionWhat happensDurability
Edit project files to use 9.0 web build targetsCan make command-line build pass temporarilyLow (VS2010 rewrites settings)
Switch NAnt target to .NET 4 without config updatesLeads to config/runtime errors (for example missing vendor attribute)Low
Update nant.exe.config for .NET 4 and correct version tokensReported as the working fix in the original caseHigh for this legacy stack

Step-by-step fix for the reported scenario

1) Confirm installed .NET Framework directories

dir C:\Windows\Microsoft.NET\FrameworkCode language: CSS (css)

Use this to verify the exact v4.0 folder/version available on the build machine.

2) Update NAnt to use .NET 4 framework definitions

The original report required extending nant.exe.config with .NET 4 framework entries because the existing config did not support the new target yet.

3) Add the missing vendor attribute and align version tokens

<!-- Example pattern inside the .NET 4 framework entry in nant.exe.config -->
<framework ... vendor="Microsoft" ... />

<!-- Update copied values to match what exists on disk -->
v4.0.20506 -> v4.0.30128Code language: HTML, XML (xml)

The key point is not the sample numbers themselves, but that your config must match the actual framework version present on the server.

4) Re-run the command-line build

nant

Common pitfalls

  • Relying on project-file downgrades that VS2010 will overwrite.
  • Copying a .NET 4 config block but missing required attributes such as vendor.
  • Using hard-coded framework version tokens that do not match the machine.
  • Changing build config without backing up nant.exe.config first.

For legacy pipelines, keep Visual Studio version, target framework, and NAnt framework mappings explicitly documented and version-controlled to prevent environment drift.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Msbuild slower than devenv

scmuser created the topic: msbuild slower than devenv Hi, I’m experiencing performance inconsistencies with regards to build duration when building a VS2008 solution file with either devenv…

Read More

Team Foundation Build 2010: Architecture, Build Definitions, and Migration from TFS 2008

Team Foundation Build 2010 introduced a controller/agent build architecture, richer build definitions, and gated check-in workflows for TFS teams. This revised guide turns the original topic list into a practical reference for setup, customization, and migration planning.

Read More

MSBuild for Beginners: Project File Fundamentals, Build Flow, and Practical Commands

Learn how MSBuild project files are structured, how targets and tasks execute, and which commands are most useful in CI/CD. This revised guide also preserves the original learning links from the post.

Read More

MSBuild File Extensions Explained: .proj, .targets, .props, .tasks, and *proj Types

Understand what common MSBuild-related file extensions do and how they fit together in real .NET build pipelines. This revised guide includes a comparison table, import-flow diagram, and practical XML examples.

Read More

.NET Build and Release Training: Curriculum, Toolchain, Workflow, and Enrollment

A structured, engineer-friendly rewrite of the original .NET Build and Release course page. Review objectives, tool coverage, CI/CD workflow, prerequisites, fees, and key links in one place.

Read More

MSBuild Training Guide: Basics, Custom Targets, Logging, and Troubleshooting

A practical, updated MSBuild training reference based on the original course outline. Learn how MSBuild works, how to customize builds, and how to troubleshoot slow or failing pipelines.

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Puja kushwaha
Puja kushwaha
1 month ago

Compiling Visual Studio 2010 web projects through NAnt can be tricky when build tools expect different settings or file paths. A useful first step is to compare the local build setup with the automated build environment. Checking project references, framework versions, and required build targets can help reveal the real cause of failures. Keeping these settings explicit also makes the build easier to repeat across machines. This reduces time spent debugging and helps legacy web projects remain reliable in continuous integration.

1
0
Would love your thoughts, please comment.x
()
x