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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:41:37+00:00 2026-06-05T10:41:37+00:00

When I run MSDeploy from a build script, I get this NullReferenceException. The funny

  • 0

When I run MSDeploy from a build script, I get this NullReferenceException. The funny thing is, the project deploys. This has been driving me crazy. Note: This is a web site project, not a web application project.

I’m using this in my build targets file:

    <ItemGroup>     
        <DeploySource Include="DirPath">
            <Path>C:\TFS\MySiteBranch\PrecompiledWeb\Source</Path>
            <ComputerName>myComputer</ComputerName>
            <UserName>anAdminAccount</UserName>
            <Password>itsPassword</Password>
        </DeploySource>
    </ItemGroup>

    <ItemGroup>
        <TestDeployDest Include="DirPath">
            <Path>C:\TFS_Build\POC\Test</Path>
            <ComputerName>myComputer</ComputerName>
            <UserName>anAdminAccount</UserName>
            <Password>itsPassword</Password>
        </TestDeployDest>
    </ItemGroup>    

    <Target name="Deploy">

        <PropertyGroup>
            <WhatIf Condition="'$(WhatIf)'==''">false</WhatIf>
            <MSDeployPath Condition="'$(MSDeployPath)'==''">C:\Program Files\IIS\Microsoft Web Deploy V2</MSDeployPath>
        </PropertyGroup>

        <MSDeploy Condition="'@(TestDeployDest)'!=''"
            Whatif="$(WhatIf)"
            Verb="sync"
            Source="@(DeploySource)"
            Destination="@(TestDeployDest)"
            ExePath="$(MSDeployPath)"
        />
</target>

Here’s the error:

"C:\TFS\MySiteBranch\Source\source.csproj" (Deploy target) (1) ->
(Deploy target) ->  

C:\TFS\MySiteBranch\Source\Deploy.Targets(54,3): error MSB4018: The "MSDeploy" task failed unexpectedly.\r [C:\TFS\MySiteBranch\Source\source.csproj]

C:\TFS\MySiteBranch\Source\Deploy.Targets(54,3): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object.\r [C:\TFS\MySiteBranch\Source\source.csproj]

C:\TFS\MySiteBranch\Source\Deploy.Targets(54,3): error MSB4018:    at Microsoft.Web.Publishing.Tasks.Common.Utility.MsDeployEndOfExecuteMessage(Boolean bSuccess, String destType, String destRoot, TaskLoggingHelper Log)\r [C:\TFS\MySiteBranch\Source\source.csproj]

C:\TFS\MySiteBranch\Source\Deploy.Targets(54,3): error MSB4018:    at Microsoft.Web.Publishing.Tasks.MSDeploy.Execute()\r [C:\TFS\MySiteBranch\Source\source.csproj]

C:\TFS\MySiteBranch\Source\Deploy.Targets(54,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r [C:\TFS\MySiteBranch\Source\source.csproj]

C:\TFS\MySiteBranch\Source\Deploy.Targets(54,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutio

Any ideas for something I can try?

  • 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-05T10:41:39+00:00Added an answer on June 5, 2026 at 10:41 am

    I was able to get the deploy working with a Web Deploy Project.

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

Sidebar

Related Questions

I received this error when trying to run a build from within VS2010. C:\Program
Run jsLint on this fiddle . The script runs, but what is jsLint telling
I have been working on a build script for a website that we have.
I run my program from some project ,using Configuration Properties -> Debugging When I
I run this code here <html> <script type=text/javascript src=lib/jquery-ui-1.8.21.custom.min.js></script> <script src=http://127.0.0.1:5984/_utils/script/jquery.couch.js></script> <!--<script type=text/javascript src=lib/jquery-1.7.2.js></script>-->
I run several queries from mysql command line on my linux box (Fedora Os).
I have been running an MSDEPLOY command successfully for the past couple weeks until
We're using msdeploy to deploy our sites to various environments from our continuous integration
I run through a few loops to build out a 32 x 32 block
I run my own business from home and started use Python 2 days ago.

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.