26

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.

Olaj
  • 1,782
  • 4
  • 19
  • 36

8 Answers8

47

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" />
Ragge
  • 2,079
  • 1
  • 16
  • 8
  • 6
    If (like us) you are running a mixture of RTM and SP1b you can include the last import with a Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets')" which will prevent errors for those without the SP installed. – Ash Feb 09 '11 at 14:02
  • 2
    The above one is right solution and the following will work for 32 bit as well 64 bit versions. – manu Mar 11 '11 at 12:04
  • +1, ran into the same problem in final release of SP1 and adding the new import fixed it. However, I got a warning until I removed the old import so I guess the best solution if you are only using SP1 is to replace the import rather than adding a new one. – Yhrn Apr 08 '11 at 12:28
  • 2
    CopyBinDeployableAssemblies is _not_ in my Microsoft.WebApplication.targets file. What is the pre-req to get it added? I have SP1 (production) installed. – kindohm Jun 10 '11 at 12:24
  • Use the visual studio version path like this (yes I even get this error in 2018 with VS2017ENT) : $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\WebApplications\Microsoft.WebApplication.targets – hB0 Mar 23 '18 at 12:34
4

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

Community
  • 1
  • 1
Philippe Lavoie
  • 2,583
  • 5
  • 25
  • 39
3

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 :)

Nguyen Minh Hien
  • 455
  • 7
  • 10
1

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)' != ''" />
Edward Olamisan
  • 800
  • 1
  • 18
  • 28
1

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" />
bobnew
  • 11
  • 1
0

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.

adillon
  • 21
  • 4
0

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> 
bsiamionau
  • 8,099
  • 4
  • 46
  • 73
jacob justin
  • 156
  • 1
  • 5
0

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.

Olaj
  • 1,782
  • 4
  • 19
  • 36