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.
Checkout the target file with the tf commandline:
tf checkout $(TargetFile)
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 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.
If you're in TFS2012 or later, use a local workspace. Then the file won't be readonly and you'll be good to go.
精彩评论