Reputation: 4506
I'm using msbuild and have a post build step that generates a JavaScript file on the fly. I'd like to make sure that when msbuild is done, this files goes with it. This file is not in source control.
Whenever I kick off a build from visual studio 2012, the file gets generated along with everything else on the build server, but it never ends up on the webserver. I tried using xcopy to push it to a dozen places such as binaries/_publishedSites or /bin and everything I could think of (up to 5 different locations) but it all seems to ignore it and it never ends up on the target server.
Is there a specific folder that I need to copy my files to to make sure msbuild picks it up?
Thanks!
Upvotes: 0
Views: 490
Reputation: 9938
After you generate the file you need to add that file to the @(Content) item array. This needs to be done in a target, not statically, since the item will not exist when the static items are processed. The target that generates the file also needs to occur prior to the web packaging step, not after the build completes.
<Target Name="GenerateFiles"
BeforeTargets="Build">
... create the file named generated.js
<ItemGroup>
<Content Include="./path/to/generated.js">
<CopyTo... />
</Content>
</ItemGroup>
</Target>
Upvotes: 1