Question

I installed Visual Studio 2010 SP1 the other day and now when i try to "publish" my apps i get this error on ALL of my projects.

The target "_CopyBinDeployableAssemblies" does not exist in the project.

I have no idea what the problem is here and i find nothing on the all mighty Google and that makes me a bit nervous.

Can anyone point me in the right direction here or maybe somebody else has the same problem? Because it happens in all of my projects so i'm kind of amazed im alone with this problem.

The sites are ASP.NET Web Applications, some of them are mixed Web forms/MVC but one is only Webforms. 1 site is super mega simple with almost no references and i still get the error.

Was it helpful?

Solution

I also experienced this problem after installing Visual Studio 2010 SP1 Beta.

The missing target _CopyBinDeployableAssemblies is defined in:

$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets

I solved the problem by adding an <Import> element to the broken project files.

So if you have a depdendency on the above targets, which you can find out by looking for the following <Import> in your project files:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets" />

You need to also import:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

OTHER TIPS

From joao-angelo's blog post, add the following to the project file (.csproj/.vbproj)

<Target Name="Noop"></Target>

<PropertyGroup>
  <CollectFilesFrom_binDeployableAssembliesDependsOn>
    Noop
  </CollectFilesFrom_binDeployableAssembliesDependsOn>
</PropertyGroup>

before importing

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets" />

That works for me using ClickOnce on VS2010 SP1 using App.config transform

Hoho, Jacob is right!

When we install VS 2010 SP1 the default MSBuild path will focus to folder

[C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0]

not

[C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0] any more.

And the [Microsoft.WebApplication.targets] file has a build target named [_CopyBinDeployableAssemblies].

So we just add a [_CopyBinDeployableAssemblies] target to our project file(can open it with Notepad :)) , the problem was solved

Ex: <Target Name="_CopyBinDeployableAssemblies"></Target>. Just need an empty target :)

The answer given above by Ragge was what I needed. But in my case, I only added the second line. The first line Ragge gave was already in the project file.

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

It's VS 2013 SP 3 and I'm still having this issue! In order to fix it I had to change the following line in the failing to build projects from:

<Import Project="$(VSToolsPath)\Web\Microsoft.Web.Publishing.targets" Condition="'$(VSToolsPath)' != ''" />

to the following line:

<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />

Well, spent 4h on this today and i solved it now. But unfortunately i do not have a definite answer what the problem was. Buit i will describe what i did.

  1. Uninstalled SP 1 and got a couple errors. These where because i didn't have the VS install media and it where asking for it.
  2. SP1 seemed to have been removed but i still got the error.
  3. Downloaded VS Ultimate Trial and tried to do a repair, didn't help.
  4. Downloaded VS 2010 SP1 again and installed it. Still the same problem.
  5. Uninstalled VS SP1 with access to VS Ultimate install media and i only got one error where it needed some VS Express stuff, i pressed cancel on that one and it said the uninstall failed.
  6. Launched Visual Studio and the problem where gone! Hallelujah!

And well, i don't blame MS for this at all. I knew it where a beta but i never had issues like this before.

Hope this solves the problem for somebody else.

The answer Ragge gave worked for us as well. I had a solution I hadn't opened since SP1 install that just refused to build with the same error. Edited the project file in Notepad to include those two statements and viola! issue solved. Thanks so much for your diligence!

Addition: A colleague mentioned that the addition of the import will cause builds happening outside of Visual Studio to likely complain (Command line msbuild, build server) because Microsoft.WebApplication.targets doesn't exist there. So we changed the import line to read:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="$(BuildingInsideVisualStudio) == true AND exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets')" />

These conditions were important for our builds as we do all deploys using the build server and msdeploy.

Undeploy the project and edit and add following code in project file at end of <Import>

<Target Name="_CopyBinDeployableAssemblies" 
        Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')">
    <CreateItem Include="$(MSBuildProjectDirectory)\_bin_deployableAssemblies\**\*.*" 
            Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')" 
            Exclude="$(MSBuildProjectDirectory)\_bin_deployableAssemblies\.svn\**\*">
        <Output ItemName="_binDeployableAssemblies" TaskParameter="Include" />
    </CreateItem>
    <Copy SourceFiles="@(_binDeployableAssemblies)" 
            DestinationFolder="$(OutDir)\%(RecursiveDir)" SkipUnchangedFiles="true" 
            Retries="$(CopyRetryCount)" 
            RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
</Target> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top