Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

CrmPackage - PreBuildEvent

Posted on by Microsoft Employee

I'd like to perform a pre-build event and make it conditional on the configuration name specified.  I've added the following Xml to my project file:

  <PropertyGroup>
    <PreBuildEvent>
      echo $(ConfigurationName)
    </PreBuildEvent>
  </PropertyGroup>

The output is always Debug.  Is there another way to do conditional pre-build events for the CrmProject type?

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CrmPackage - PreBuildEvent

    I was not able to evercome the PreBuildEvent issue, the $(ConfigurationName) was always Debug.  I decided to focus on my ScriptSharp project as it's the Debug/Release output that I was ultimately interested in.  I attempted to use the PostBuild event, but I learned that it executed before the javascript file was created.  I noticed a BuildScript message in the output window.  I decided to try a <Target><Copy> approach.  With a Target I was able to use the AfterTargets attribute and set it to "BuildScript".  I was then able to specify the target and destination files in the Copy.  Following is the Xml that I used:

      <Target Name="CopyFiles" AfterTargets="BuildScript">

        <Copy Condition="$(ConfigurationName)==Debug"
              SourceFiles="$(OutDir)IGT.AG.LOGISTICS.CGB.ClientUI.debug.js"
              DestinationFiles="$(SolutionDir)CrmPackage\Webresources\js\IGT.AG.LOGISTICS.CGB.ClientUI.js">
        </Copy>
        <Copy Condition="$(ConfigurationName)==Release"
              SourceFiles="$(OutDir)IGT.AG.LOGISTICS.CGB.ClientUI.js"
              DestinationFiles="$(SolutionDir)CrmPackage\Webresources\js\IGT.AG.LOGISTICS.CGB.ClientUI.js">

        </Copy>

      </Target>

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans