2

I developed a Sitecore Control in its own separate Visual Studio Project. In order for it to work, it needs (among other things) to have some of its files copied to the Startup Project.

I have been told to look at post-build events and xcopy, but none of the macros usable by default seems to do what I need.

Question 1: How do I copy an arbitrary group of files to the Startup Project (preserving folder structure) upon build?

Furthermore, I added a package with the Core database items my module needs in the project repo; Sure, I have built a Sitecore Package with everything ready, but I would like to make the source available as well. Thus,

Question 2: is there a better way to organize and share a developed Module other than a VS Project?

EDIT: to be more clear, my Control requires adding files under the /sitecore/shell folder. As I change them during development, I should copy them manually to the web root, so I'd rather have this done automatically.

2
  • I recommend to use TDS or Unicorn to share Sitecore items between developers. What do you mean by Startup project? Can you update your question with some screenshots, it is really hard to imagine what you are trying to achieve :) Jun 28, 2018 at 9:47
  • The Startup Project is the main web project - the one with the /sitecore folder, for instance. No screenshot would help to explain the issue, I will edit my question to be more accurate. Jun 28, 2018 at 10:45

1 Answer 1

2

Question 1 Answer:

  • Under your VS web project, create identical structure as you need for all files under your_sitecore_instance_path/Sitecore/ folder that you would like to deploy:

enter image description here

You just need to specify "Content" as their build action in Properties.

enter image description here

Create WDP package to webdeploy it or you can use TDS (see below).

  • Use TDS or Unicorn; If you use TDS -> create ClientName.TDS.Core project where you add all core database items that you would like to share / deploy to Sitecore. You can link TDS to your web VS project created in first step and you can create Sitecore update package. This can be then easily deployed to Sitecore (both Sitecore items for core db and also files in /sitecore/ folder)

Question 2 Answer:

Sounds legit :)

Best would be if your team uses Git or other code repository that supports branching. You should create branch for this feature. Add your VS project into solution based on what was written in Question 1 Answer and then commit, push and integrate your branch back to main / trunk or create pull request.

4
  • Thanks Peter. Do I have to set the Content flag for every single file individually? Jun 28, 2018 at 13:59
  • You need to set "Content" as build action only for files that you want to have under /sitecore/ folder or config files etc. For .cs files and so on this needs to be set as "Compile". Jun 28, 2018 at 14:44
  • This is not working for me - the highlighted file is not being copied to output directory: screencast.com/t/mRW2CgoR What am I doing wrong? EDIT - if I select "Copy Always" this is getting copied... under the /bin folder, not on the project root. Jun 29, 2018 at 9:03
  • 1
    I would build a NuGet package of the source files, the easiest way to keep the folder structure. For sure it is not easy to share the items with a NuGet package but some Powershell scripts can do that for you.
    – monkey.dsc
    Jul 2, 2018 at 8:56

Your Answer

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

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