scottdurow / SparkleXrm

An open-source library for building Dynamics CRM XRM solutions using Script#, jQuery & Knockoutjs.
MIT License
266 stars 197 forks source link

Allow Unpack to both Managed and Unmanaged in the same execution #246

Open namurdock opened 6 years ago

namurdock commented 6 years ago

This is an extension of #208

We source control the unpacked files for both managed and unmanaged solutions.

It allows us to perform a pack within VSTS to both managed and unmanaged zip files.

Would it be possible to extend the unpack task to allow this.

e.g.

 "solutions": [
    {
      "profile": "default,debug",
      "solution_uniquename": "SolutionName",
      "packagepath": "..\\Solution",
      "solutionpath": "solution_{0}_{1}_{2}_{3}.zip",
      "packagetype": "unmanaged,managed"
    }
]
scottdurow commented 6 years ago

Thanks for your suggestion - the way I do it is having two separate profiles - one for managed and one for unmanaged. Would that work for you?

namurdock commented 6 years ago

Thanks Scott. It probably would. Do you target two separate package folders for your unpack?

Further question...

When you pack in VSTS do you use an execute bat step? If so is there any documentation or examples of how to specify the output path so that the zip can be published as an artifact?

Thanks again. I really don't know how you have the time to do this and everything else you do!

scottdurow commented 6 years ago

Yes - two separate folders - one for managed and the other unmanaged.

When I'm packing in VSTS I use one similar to pack+import.bat that just uses the 'pack' task. The published artifact is the solution zip that is copied to the drop location.

namurdock commented 6 years ago

Thanks, when running the two profiles is it necessary to have the bat run spkl twice? (i.e. prompt for connection twice) or is it possible to run the two profiles using the same connection details?

namurdock commented 6 years ago

I am fairly sure this is user error but i cannot get the solution to pack. Issue happens when the packer hits my plugin assemblies. I have played around with the paths but with no success. (would you like me to log this as a different issue?) (the webresources folder map works fine, and the unpack task is also working fine)

My VS solution layout is:

`

Maps i am using

 {
      "profile": "release",
      "solution_uniquename": "<SolutionName>",
      "packagepath": "managed",
      "solutionpath": "<SolutionName>_{0}_{1}_{2}_{3}_managed.zip",
      "filePath": "..\\SolutionProject",
      "packagetype": "managed",
      "increment_on_import": false,
       "map": [
        {
          "map": "path",
          "from": "PluginAssemblies\\**\\Plugins.dll",
          "to": "..\\..\\PluginProject\\bin\\Debug\\"
        },
        {
          "map": "path",
          "from": "PluginAssemblies\\**\\Workflows.dll",
          "to": "..\\..\\WorkflowProject\\bin\\Debug\\"
        },
        {
          "map": "folder",
          "from": "WebResources\\chorus_",
          "to": "..\\..\\WebResourcesProject\\Webresources\\"
        }
      ]
}

Error received:

Error Matched file 'C:\Repos\xxxxx\xxxxx\RunnersProject\managed\PluginAssemblies/Plugins-76C6CA04-A69C-4F8D-9DFB-032C1EF0731F/Plugins.dll' was not found in any mapping. Pack operation is aborted.

It appears that the pack is looking for a relative path, so i guess my bat is incorrect:

@echo off
set package_root=..\..\
REM Find the spkl in the package folder (irrespective of version)
For /R %package_root% %%G IN (spkl.exe) do (
    IF EXIST "%%G" (set spkl_path=%%G
    goto :continue)
    )

:continue
@echo Using '%spkl_path%' 

REM spkl instrument [path] [connection-string] [/p:release]
"%spkl_path%" pack /p:release
pause

Update: I think i have resolved the path issue by going to a file mapping rather than a path one.

wajihqidwai commented 4 years ago

I am having similar problem Error Matched file 'C:\Repos\xxxxx\xxxxx\RunnersProject\managed\PluginAssemblies/Plugins-76C6CA04-A69C-4F8D-9DFB-032C1EF0731F/Plugins.dll' was not found in any mapping. Pack operation is aborted.

Any idea how to solve it