web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Best practice for depl...
Finance forum

Best practice for deploying custom code from Sandbox environment to Production environment

(0) ShareShare
ReportReport
Posted on by 365

Hello,

What is best practice to follow to deploy custom code and models from Sandbox to Production.

We create deployment package from visual studio but it create for whole model. but some of the development for another project in same model are still in progress. How to move only tested custom code.?

We have multiple project (eg. Project1 and Project2) in single model (eg. Model1). Now if we want to deploy objects from Project1 in Production environment we create deployment package for Model1. But it also includes object for Project2 which is in same model and development is in process which should not be moved into production.

What to do in such kind of case.? On what basis should we decide model creation?

Is it feasible to create separate model for each project if development is not related?

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    You will not deploy anything from sandbox to production. Instead you build deployable packages that you deploy to sandbox and production.

    You can consider splitting your code to more packages, because package is the smallest possible deployment artifact. But remember that the build server (which you should use) will normally add all such packages in the deployable package, where you have customized code.

    So I would say the answer to your question is to use branching in your VSTS. You should have the Trunk/Main branch from where you create the deployable packages. Any code that you don't want to deploy yet you should develop in a different branch. Once it's ready for deployment, it should be merged to the Trunk/Main.

  • kartikkp7 Profile Picture
    365 on at

    Hi, thanks for the suggestion. Is it possible to create such deployable package without 'build environment'.? We have 1 sandbox, 1 production, and 2 development environment (VHD downloaded from LCS) running on local server and we want to move such custom code from development env.

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    Yes you can create the deployable packages in a development environment. But that's highly not recommended, because then you can't be sure that all the code that you deploy is in the version control. Many many times the developer forgets to add something to version control.

    All D365FO subscriptions include one "dev" machine ("Sandbox: develop and test") that is hosted by Microsoft and which you can use as a build machine. It should be visible on the main page of your LCS implementation project.

    docs.microsoft.com/.../continuous-build-test-automation

  • kartikkp7 Profile Picture
    365 on at

    Ok... so we need to setup one build environment and follow the process for VSTS and deployable package generations which will be deployed on Sandbox and production using LCS. Can we connect local development VM running on-premise through VSTS on LCS? It would be grateful if you suggest some link for same..

  • Verified answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    Yes, you can connect the local development environments to VSTS. It doesn't matter where the dev vm is, as long as it has connection to internet. So you are not yet using any version control?

    In that case, in LCS you have most likely a notification for "Configure VSTS is not completed", right? When you complete that, LCS will create the correct configuration and folder structure for your VSTS project.

    Then you can connect your dev vm Visual Studios to VSTS and add all your changes to source control.

    Also deploying the build VM is really simple. Just click "Configure" for the "Sandbox: Develop and Test" environment, select topology "Build and Test", and everything will be configured automatically for you.

    Check this article, it's really helpful: https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/dev-tools/version-control-metadata-navigation

  • kartikkp7 Profile Picture
    365 on at

    On what basis model creation should be decided? Like if only one model for all developments or individual model for all modules etc.

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    I've seen both. You could have all your customization in one model, or split models according to functionalities (not necessarily modules).

    One thing to keep in mind when planning the packages is that you can't have circular package dependencies. (A referencing B and B referencing A). So if you have two customizations in different places, and they both need some object from the other customization, you should put them in the same package (and usually, same model).

  • kartikkp7 Profile Picture
    365 on at

    Okay... Got It.... Thanks for the suggestions.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans