WDP in VS2k8 dosen't copy files to output dir if there are any targets

Last post 07-07-2008 1:24 PM by jles. 9 replies.

Sort Posts:

  • WDP in VS2k8 dosen't copy files to output dir if there are any targets

    12-03-2007, 12:13 PM
    • Loading...
    • napnet
    • Joined on 03-15-2007, 7:51 PM
    • Tallahassee, FL
    • Posts 4

    If i don't have any targets in the deployment file, it publishes the files to the outputpath specified.  But if i include any targets, it won't. 

     Here is the build results with no <target>

    C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\aspnet_merge.exe .\TempBuildDir -o VS2008Test1 -a  -debug -copyattrs
    Successfully merged '.\TempBuildDir'.
    if exist "c:\temp\vs2008test1\" rd /s /q "c:\temp\vs2008test1\"
    if not exist "c:\temp\vs2008test1\" md "c:\temp\vs2008test1\"
    if exist ".\TempBuildDir\" rd /s /q ".\TempBuildDir\"
    ========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========

     If i add <Target Name="AfterBuild"><MakeDir Directories="c:\temp\out\" /></Target> then it doesn't copy them out of the .\TempBuildDir\

     C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\aspnet_merge.exe .\TempBuildDir -o VS2008Test1 -a  -debug -copyattrs
    Successfully merged '.\TempBuildDir'.
    ========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========

     That's with the same 'hello world' project but just adding that target... any ideas?

  • Re: WDP in VS2k8 dosen't copy files to output dir if there are any targets

    12-04-2007, 6:41 PM
    • Loading...
    • sbeeler
    • Joined on 05-22-2007, 5:48 PM
    • Posts 5

    I'm seeing the exact same problem with an afterbuild target.  This worked fine in VS 2005.  If I comment out the afterbuild target, it works.

  • Re: WDP in VS2k8 dosen't copy files to output dir if there are any targets

    12-06-2007, 10:56 AM
    • Loading...
    • sbeeler
    • Joined on 05-22-2007, 5:48 PM
    • Posts 5

    It couldn't be easier to reproduce this bug, but Microsoft so far says they can't reproduce and will just close this issue.

    https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=315472

    Please log in to the above Microsoft Connect feedback issue and vote for it if this is impacting you.

    The above issue includes a sample project and steps to reproduce the bug.

  • Re: WDP in VS2k8 dosen't copy files to output dir if there are any targets

    12-06-2007, 11:19 AM
    Answer
    • Loading...
    • napnet
    • Joined on 03-15-2007, 7:51 PM
    • Tallahassee, FL
    • Posts 4

    I found one work around on another post here... (sorry i can't find it now) but if you add this target, it seems to work fine

    	<Target Name="AfterMerge">
    		<CreateItem Include="$(TempBuildDir)\**\*.*">
    			<Output ItemName="CompiledFiles" TaskParameter="Include" />
    		</CreateItem>
    		<Exec Command="if exist "$(WDTargetDir)" rd /s /q "$(WDTargetDir)"" />
    		<Exec Command="if not exist "$(WDTargetDir)" md "$(WDTargetDir)"" />
    		<Copy SourceFiles="@(CompiledFiles)" DestinationFolder="$(WDTargetDir)\%(CompiledFiles.SubFolder)%(CompiledFiles.RecursiveDir)" />
    		<Exec Command="if exist "$(TempBuildDir)" rd /s /q "$(TempBuildDir)"" />
    	</Target>
     Hope that helps.... so far all my AfterBuild targets work and the files are published in the correct place.
  • Re: WDP in VS2k8 dosen't copy files to output dir if there are any targets

    12-06-2007, 12:42 PM
    • Loading...
    • sbeeler
    • Joined on 05-22-2007, 5:48 PM
    • Posts 5

    Adding this AfterMerge target appears to have worked for me as well.  Wasn't necessary in VS 2005.

    Thanks!

  • Re: WDP in VS2k8 dosen't copy files to output dir if there are any targets

    12-07-2007, 6:46 AM
    • Loading...
    • stmarti
    • Joined on 06-06-2006, 12:20 PM
    • Posts 706

     I've found the workaround here:

    Missing section appSettings

    It seems that it cures many problem Smile (for me web config replacement fails) 

     

  • Re: WDP in VS2k8 dosen't copy files to output dir if there are any targets

    12-07-2007, 7:22 AM
    • Loading...
    • napnet
    • Joined on 03-15-2007, 7:51 PM
    • Tallahassee, FL
    • Posts 4

    Ah theres the post i found my solution from... yeah that's worked like a charm... odd it didn't work without it

  • Re: WDP in VS2k8 dosen't copy files to output dir if there are any targets

    07-03-2008, 2:48 PM
    • Loading...
    • jles
    • Joined on 07-03-2008, 2:09 PM
    • Posts 2

    At the bottom of the Missing Section appSettings discussion it mentions that the latest version of WDP fixes this issue.  I installed the latest version and did not find that it made any difference.

    The work around did fix the problem for me other than one minor issue.

      if exist ".\TempBuildDir\" rd /s /q ".\TempBuildDir\"
      .\TempBuildDir\bin - The process cannot access the file because it is being used by another process.

    The fix was simple and is included below.

      <!-- This is a workaround for a VS2008 bug that ignores the output directory and uses "TempBuildDir" instead -->
        <Target Name="AfterMerge">
            <CreateItem Include="$(TempBuildDir)\**\*.*">
                <Output ItemName="CompiledFiles" TaskParameter="Include" />
            </CreateItem>
            <Exec Command='if exist "$(WDTargetDir)" rd /s /q "$(WDTargetDir)"' />
            <Exec Command='if not exist "$(WDTargetDir)" md "$(WDTargetDir)"' />
            <Copy SourceFiles="@(CompiledFiles)" DestinationFolder="$(WDTargetDir)\%(CompiledFiles.SubFolder)%(CompiledFiles.RecursiveDir)" />
            <!--<Exec Command='if exist "$(TempBuildDir)" rd /s /q "$(TempBuildDir)"' />-->
        </Target>
      <Target Name="AfterBuild">
        <!-- Remove Unneeded Directory -->
        <RemoveDir Directories="$(TempBuildDir)" />
      </Target>
    
    
  • Re: WDP in VS2k8 dosen't copy files to output dir if there are any targets

    07-04-2008, 3:00 AM
    • Loading...
    • stmarti
    • Joined on 06-06-2006, 12:20 PM
    • Posts 706

    I think this bug was really fixed in the latest version. I uninstalled the ctp, installed the latest, and I commented out the hack, and it works.

    Maybe you have a corrupted installation. You can also try to create a new wdp project file and migrate your custum settings, just to be sure that the porject file has correct settings.

  • Re: WDP in VS2k8 dosen't copy files to output dir if there are any targets

    07-07-2008, 1:24 PM
    • Loading...
    • jles
    • Joined on 07-03-2008, 2:09 PM
    • Posts 2

    I tried creating a new WDP project and migrating my custom settings.  It still did not work without the work around.

     I then set up a Virtual Machine (VM) and in the VM installed Microsoft Visual Studio Team System 2008 Database Edition and WDP and tried creating a new WDP project and adding my settings.  It still required the work around to work.

     I then discovered that it works on our build system that is not using a Team System version of VS2008.  I set up a new VM with VS2008 Pro and WDP.  It worked fine without the workaround without even setting up a new WDP project.

     Unfortunately the group I work in requires VS2008 Team DB edition as we have unit tests for all of our SQL scripts in it.  My work around was to add conditions to the after merge step for debug only and release build to skip this step.  That way my debug build will still work on my system and the release will work for our build system.

     It is a bit of a hack but it all works.  If you have any other ideas I would be happy to try them.

Page 1 of 1 (10 items)
Microsoft Communities
Page view counter