Background
As mentioned in a previous post, and because Daxif is now Open Source, I will be blogposting on a weekly series of How to Daxif: …. The first topic will be how to setup Daxif as part of a Visual Studio project.
Our XrmFramework is (was) based on the Developer Toolkit for Microsoft Dynamics CRM but since it’s not been updated lately, we have decided that we will follow our own path.
Note: The only thing we needed to do was to remove the following lines from our .SLN files
The reason we followed Microsoft on this matter was that we see a lot of other consultancies creating monolithic frameworks which are almost impossible to get away from. We would like to think that our approach is a bit more fair in the way that if our customers would like to replace us, the consultancy taking over, just need to have the basic understanding on how the Developer Toolkit for Microsoft Dynamics CRM works.
As you can see it’s more or less the same: Plug-in and Workflow projects are the same and the CrmPackage is just replaced by Daxif. We have added the BusinessDomain, generated code from the MS CRM datamodel, and the BusinessLogic, reusability of code projects; as well as the Blueprint project to store the MS CRM solution in our source control system.
Daxif has helped us out where the Developer Toolkit for Microsoft Dynamics CRM wasn’t good enough:
-
Easily generate strongly typed proxy classes without having to run CrmSvcUtil.exe
- Issues with the MetadataProvider as well as creating OptionSets in a local language. All these issues are no longer relevant as we now generate our typesafe classes with Delegate.XrmContext.
-
Edit and register plug-ins without using the Plug-in registration tool
- This component has never worked properly and to solve this issue, we have added the syncSolution to Daxifs Plugins module. There will be a blogpost on this topic very soon.
-
Create new web resources or extract existing web resources, add them to your solution, edit them, and deploy changes all within Visual Studio.
- When adding files to this componenet, it actually moves web ressources to a specific container (HTML Page, JScript File, Style Sheet, … folders) which most certanly would break any HTML5 app that was built for MS CRM, no relative path will work. We have taken the approach that what you see locally in your source control, should be mapped 1:1 to your MS CRM solution (code should always be master). We handle this matter in Daxif with the syncSolution in the WebResources modules. There will also be a blogpost on this topic soon.
-
…
Install Daxif from Nuget and keep updated
Back to the setup of Daxif, the only thing that is needed is to add the Daxif NuGet package to the Daxif project in Visual Studio:
and ensure regularly that is updated:
Nuget limitations
The final thing that needs to be done is to execute from inside Visual Studio the DG.EnsureAssemblies.fsx. This is needed due to some limitations in Nuget:
-
Open the script file
-
Mark all the text (CTRL+A) and send to F# Interactive (ALT+ENTER)
And you should see the following output:
Note: The reason we use F# scripts is:
Intellisense and autocompletion when updating scripts in Visual Studio.
Executing scripts from Visual Studio, no need to leave the IDE.
Re-usability of code made in Daxif.
Typesafe scripts: Scripts will be checked for inconsistency before executed by the F# interpreter. Neither Cmd or PowerShell can provide this.
Update Auth and Config information
Now all Daxif scripts can be executed but you will still need to update these two scripts files so their match your current setup:
DG.Delegate.HowToDaxif.AuthInfo.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
[<Literal>]
let usr = @"[email protected]"
[<Literal>]
let domain = @""
[<Literal>]
let pwd = @"pass@word1"
[<Literal>]
let usr' = @"usr"
[<Literal>]
let domain' = @"domain"
[<Literal>]
let pwd' = @"pwd"
DG.Delegate.HowToDaxif.Config.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#r @"Microsoft.Xrm.Sdk.dll"
#r @"Delegate.Daxif.dll"
(** Open loaded libraries for use *)
open Microsoft.Xrm.Sdk.Client
open DG.Daxif
let log = LogLevel.Verbose
(** Serialize Type *)
let xml = SerializeType.XML
(** Auth information *)
#load @"DG.Delegate.HowToDaxif.AuthInfo.fsx"
[<Literal>]
let authType = AuthenticationProviderType.OnlineFederation
(** Dev auth & environment information *)
[<Literal>]
let usrDev = DG.Delegate.HowToDaxif.AuthInfo.usr
[<Literal>]
let pwdDev = DG.Delegate.HowToDaxif.AuthInfo.pwd
[<Literal>]
let domainDev = DG.Delegate.HowToDaxif.AuthInfo.domain
[<Literal>]
let wsdlDev = @"https://mydev.crm4.dynamics.com/XRMServices/2011/Organization.svc"
let wsdlDev' = Uri(wsdlDev)
(** Test auth & environment information *)
[<Literal>]
let usrTest = DG.Delegate.HowToDaxif.AuthInfo.usr
[<Literal>]
let pwdTest = DG.Delegate.HowToDaxif.AuthInfo.pwd
[<Literal>]
let domainTest = DG.Delegate.HowToDaxif.AuthInfo.domain
[<Literal>]
let wsdlTest = @"https://mytest.crm4.dynamics.com/XRMServices/2011/Organization.svc"
let wsdlTest' = Uri(wsdlTest)
(** Prod auth & environment information *)
[<Literal>]
let usrProd = DG.Delegate.HowToDaxif.AuthInfo.usr
[<Literal>]
let pwdProd = DG.Delegate.HowToDaxif.AuthInfo.pwd
[<Literal>]
let domainProd = DG.Delegate.HowToDaxif.AuthInfo.domain
[<Literal>]
let wsdlProd = @"https://myprod.crm4.dynamics.com/XRMServices/2011/Organization.svc"
let wsdlProd' = Uri(wsdlProd)
(** Source auth & environment information for data migration *)
[<Literal>]
let usrSource = DG.Delegate.HowToDaxif.AuthInfo.usr
[<Literal>]
let pwdSource = DG.Delegate.HowToDaxif.AuthInfo.pwd
[<Literal>]
let domainSource = DG.Delegate.HowToDaxif.AuthInfo.domain
[<Literal>]
let wsdlSource = @"https://SOURCE.api.crm4.dynamics.com/XRMServices/2011/Organization.svc"
let wsdlSource' = Uri(wsdlSource)
(** Target auth & environment information for data migration *)
[<Literal>]
let usrTarget = DG.Delegate.HowToDaxif.AuthInfo.usr'
[<Literal>]
let pwdTarget = DG.Delegate.HowToDaxif.AuthInfo.pwd'
[<Literal>]
let domainTarget = DG.Delegate.HowToDaxif.AuthInfo.domain'
[<Literal>]
let wsdlTarget = @"https://TARGET.api.crm4.dynamics.com/XRMServices/2011/Organization.svc"
let wsdlTarget' = Uri(wsdlTarget)
(** Shared environment information *)
let rootFolder = __SOURCE_DIRECTORY__
let solutions = rootFolder + @"\solutions\"
let translations = rootFolder + @"\translations\"
let metadata = rootFolder + @"\metadata\"
let data = rootFolder + @"\data\"
let state = rootFolder + @"\state\"
let associations = rootFolder + @"\associations\"
let mapping = rootFolder + @"\mapping\"
let imported = rootFolder + @"\imported\"
let webresources = rootFolder + @"\..\..\WebResources\src\"
let tools = rootFolder + @"\..\..\..\Tools\"
let pubPrefix = @"dg"
let pubName = @"delegateas"
let pubDisplay = @"Delegate A/S"
let solution = @"HowToDaxif"
let solDisplay = @"HowToDaxif"
Create your publisher and solution
When this is done, you should be able to create your Publisher and Solution by executing:
DG.Delegate.HowToDaxif.SolutionCreateDev.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#load @"DG.Delegate.HowToDaxif.Config.fsx"
module cfg = DG.Delegate.HowToDaxif.Config
open DG.Daxif.Modules
Solution.createPublisher
cfg.wsdlDev'
cfg.pubName cfg.pubDisplay cfg.pubPrefix
cfg.authType cfg.usrDev cfg.pwdDev cfg.domainDev
cfg.log;;
Solution.create
cfg.wsdlDev'
cfg.solution cfg.solDisplay cfg.pubPrefix
cfg.authType cfg.usrDev cfg.pwdDev cfg.domainDev
cfg.log
Note: As I created the publisher before, Daxif will give an error as duplicate publishers are not allowed
We don’t make MS CRM solutions, but software solutions
We tend to say that we don’t create MS CRM solution but software solutions. As you can see, by combining Daxif with our XrmFramework (MS Developer Toolkit) We are able to spend less time with the technical stuff that just should work everytime, automation by removing the human part will always ensure a more robust approach, and by spending more time implementing business logic, we think that we are giving our customers more value for their money.
More info:
- NUGET package: https://www.nuget.org/packages/Delegate.Daxif/
- Github website with documentation and API Description: http://delegateas.github.io/Delegate.Daxif/
- Is constantly being developed: http://delegateas.github.io/Delegate.Daxif/RELEASE_NOTES.html
References:
- Daxif: