4

We have a solution containing a web application project (mostly webforms) and two separate "config" projects that are copied over depending on which client's specific output is needed.

Presently to "deploy" we zip up the web application folder, but of course it picks up files that were do not want such as project files and code files.

I would like to be able to use publish, but it seems to miss a lot of the files that come from one of the config projects during build. I have suspected its because it is not in the web app project, while being on the file system.

Are there any ways I can correct this? It is very unlikely we can change the way the config projects exist.

2
  • 1
    Um, batch files and XCopy? – Robert Harvey Feb 3 '17 at 20:09
  • Make a copy of the solution, change the files around you suspect and hit publish to a dummy location. See if it works. Try it to a dummy location without changing anything first. – johnny Apr 4 '17 at 21:31
1

Write a shell script which compiles your project in Release mode, copies exactly the files you like to deploy into a new folder and finally create the zip file.

5
  • That's one way to do it Doc, but MsBuild supports this natively. – RubberDuck Apr 4 '17 at 21:13
  • @RubberDuck: there is more than one way to do it, but I guess your supposed solution will not be simpler than using a shell script. – Doc Brown Apr 4 '17 at 21:59
  • Depends on your definition of simpler I suppose. My solution would work from inside of the IDE as well as on the CLI. – RubberDuck Apr 4 '17 at 22:01
  • @RubberDuck: well, using a shell script decouples this intentionally. – Doc Brown Apr 5 '17 at 5:41
  • ... and the syntax for copying files, creating folders, and calling an external zip program is IMHO simpler in a shell script than in MsBuild. A tool like MsBuild pays off, however, if one needs to manage the build dependencies here and make sure the "zip" file is created always and immediately when one part of the content was changed, for example. – Doc Brown Apr 5 '17 at 5:57
0

Add a Copy Task to your project (mdbuild) file that copies in the correct files. Depending on the complexity of your project, you might want to add an afterbuild target to the solution itself.

In order to get your project to dynamically copy the correct files, you'll need to add a build configuration that allows you to switch between the two.

1
  • 1
    Presently it looks like we are using xcopy in the two "config" projects in post build command line fields. – Jeffrey Drake Apr 10 '17 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.