1

I have a web project that has a post-build event that produces some minified files. Assume for the moment that this needs to remain a post- build event, and cannot be changed into a pre-build event.

I have successfully used a .wpp.targets file to package additional files:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
    <PropertyGroup>
        <SourceRoot>$(BuildDirectory)\Sources\Web</SourceRoot>
    </PropertyGroup>
    <ItemGroup>
        <FilesForPackagingFromProject Include="$(SourceRoot)\ExtraScripts\Normal.js">
            <DestinationRelativePath>Scripts\%(RecursiveDir)%(FileName)%(Extension)</DestinationRelativePath>
            <FromTarget>Web.wpp.targets</FromTarget>
        </FilesForPackagingFromProject>
    </ItemGroup>
</Project>

Unfortunately, this fails when I do the same thing for the files produced by the post-build step. This is because the CopyAllFilesToSingleFolderForMsdeploy target executes before the build. Even before the PrepareForBuild target.

Is there a way to add extra files and folders to the deploy package when they are produced during the build?

2
  • How are you triggering the deployment? If from the CLI, what flags are you using? Commented Apr 27, 2014 at 2:42
  • This is part of a TFS2010 build. Commented Apr 27, 2014 at 4:54

1 Answer 1

2
+50

There was a similar question before (Add Plugin DLL in MVC 4 Website after publish).

You can deploy files only if they have been a part of your project before.

What we usually do is that we include those files as dummy files in our project and overwrite them during the build process. Because those files are part of your project, this approach will publish those files.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.