views:

72

answers:

3

I have a post build event that combines my JavaScript files and outputs to Production.js, however if Production.js is not checked out, the build fails.

Is it possible to automatically check Production.js out when a project is built?

[Edit] If possible using a post-build event, does anyone know how to do this? I am using Visual Studio 2008.

+1  A: 

I think the simplest solution is to have a post-build step which checks out the Production.js file.

Setting options like automatic checkout of files won't work here because Visual Studio will only automatically check out files for actions it considers edits. It doesn't understand your post / pre build steps and hence won't do a check out.

JaredPar
This is what I thought. I guess my next question would be, does anyone know how to check out a file use a post-build step?
Jamie Carruthers
$jamieslucky7 depends on what Source Control provider you're using. If it's tfs then just `tf checkout path\to\the\file`
JaredPar
I am using Microsoft Visual SourceSafe
Jamie Carruthers
For SourceSafe, you can use ss Checkout <target file>.
Catherine
A: 

Checkout the target file with the tf commandline:

tf checkout $(TargetFile)
Scott Stafford
A: 

@JaredPar has the correct tricks to autocheckout a file on a post build event.


My question (warning?) to you is : why are you trying to OVERRIDE the source file with a minified/combined javascript file?

In my opinion, if your doing some post-build event to minify/combine some javascript files into a new destination file (Production.js) which is never touched .. it's just the output of post-build event ... i would suggest you don't do this in a post build event, but part of some proper source control deployment scenario.

For example, I've put up a video how to use TFS2008 with YUICompressor.NET which shows how you can make sure that your javascript are minified/combined whenever a checkin occurs.

Then again, you're using Visual Source Safe and that is a serious issue which I would address before -anything- else.

alt text

Pure.Krome