Request a topic or
contact an Arke consultant
404-812-3123
ASP.NET

Arke Systems Blog

Useful technical and business information straight from Arke.

About the author

Author Name is someone.
E-mail me Send mail

Recent comments

Archive

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2018

The new CRM 4 SDK is out

Just an FYI to anyone not aware, the new CRM 4 SDK has been released.

This one includes full support for LINQ, more support for development in CRM Online, and other goodies. There's also a whole new microsoft.xrm folder with samples and walkthroughs!

The Microsoft Dynamics SDK documentation website hasn't been updated yet, but I'm sure it will soon.


Posted by Wayne Walton on Thursday, May 6, 2010 4:40 PM
Permalink | Comments (0) | Post RSSRSS comment feed

CRM Custom Workflows and “This workflow includes an invalid reference”

When using a custom workflow dll in CRM, make sure to register it with the same GUIDs on production as you do on your dev CRM server.  You can do this easily by using export/import from the plugin registration tool.

When you make a workflow, anything that uses a step from the custom workflow will end up referring to it by GUID.  So if the guids don’t match for the dll, you can’t import/export workflows between the environments. And it’s not an easy fix by editing guids in the customization export file, because workflows are serialized inside this file.

If you find out about the problem early, you can unregister and reregister the dll with the right GUID.  If you find out about the problem late, after someone has already developed workflows separately in both environments, you may need to delete anything that uses data from the custom dll and recreate those workflow steps.

It shows up as an error message of “This workflow contains errors and cannot be published”, and “This workflow includes an invalid reference”.  (The invalid reference message is a generic there-is-a-guid-that-doesnt-match error, it could also be referring to a record like a system user.)


Posted by David Eison on Saturday, April 17, 2010 1:37 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Deploying IIS dlls, part 2

Following up on my previous post about copying some CRM Plugin DLLs after a build ( http://arkesystems.com/blog/post/2009/02/Recycling-IIS-app-pools.aspx ):

It turns out that the error checking in post-build events isn't reliable (it only checks errorlevel at the end of the script), and apppools don't stop instantly even when told to stop instead of recycle. 

So if my xcopy encounters a "sharing violation" (errorlevel 4) then the post-build event isn't smart enough to notice by default.

Luckily, it's just a bat file, so we can add some checking ourselves.  This is getting more complicated than I would like, but at least I build reliably now.

"sleep" isn't necessary, but it's a useful command to have around.  It comes with Windows 2003 Server Resource Kit: http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en ; restart visual studio after installing the kit.

A note on checking return codes in batch files: Equality checks are actually 'greater than or equal', so you will see people checking if errorlevel eq 1 often.  However, this only catches >= 1 error levels, and the occassional program that returns negative error codes will slip past.  Accordingly, always check "neq 0" instead of "eq 1".  Also, using "SETLOCAL ENABLEDELAYEDEXPANSION" and !ERORRLEVEL! is not strictly necessary in this script, but it's good practice to just always use delayed expansion when checking return values in batch files so that you don't screw up one day when you write an error check inside a loop.

So, hopefully my final iteration of a post-build script that needs to update some IIS dlls:

SETLOCAL ENABLEDELAYEDEXPANSION 
net pause KeepAliveService 
cscript /nologo "$(ProjectDir)\iis_stop_app_pool.vbs" "CRMAppPool" 
if !ERRORLEVEL! NEQ 0 GOTO FAIL 
set CRMDIR=C:\Program Files\Microsoft Dynamics CRM 
set loop=0 
:TRYCOPY 
set /a loop=%loop%+1 
xcopy "$(TargetPath)" "%CRMDIR%\Server\bin\assembly" /i /d /y 
if !ERRORLEVEL! NEQ 0 GOTO COPYFAIL 
xcopy "$(TargetDir)$(TargetName).pdb" "%CRMDIR%\Server\bin\assembly" /i /d /y 
if !ERRORLEVEL! NEQ 0 GOTO COPYFAIL 
cscript /nologo "$(ProjectDir)\iis_start_app_pool.vbs" "CRMAppPool" 
if !ERRORLEVEL! NEQ 0 GOTO FAIL 
net continue KeepAliveService 
GOTO OK 
:COPYFAIL 
if %LOOP% LEQ 10 GOTO TRYCOPYSLEEP 
goto FAIL 
:TRYCOPYSLEEP 
sleep 1 
goto TRYCOPY 
:FAIL 
echo "Failed with errorlevel !ERRORLEVEL!" 
exit 1 
:OK 
echo "OK" 

Edit 3/30/2010: For a 64 bit system, you can get silently redirected to SysWOW64 when a 32 bit process is trying to run something in system32.This causes iisapp.vbs to fail when run as a post build event. In Visual Studio, it shows as an exited with code 1 error. If you manually go to the [windows]\SysWOW64 folder and run iisapp.vbs, you can get an error like:Could not create an instance of the CmdLib object.Please register the Microsoft.CmdLib component.

One solution is to copy the necessary files to the SysWOW64 folder and reregister the dlls:
cd c:\windows\SysWOW64
copy ..\system32\iisapp.vbs .
copy ..\system32\IIsScHlp.wsc .
copy ..\system32\cmdlib.wsc .
regsvr32 cmdlib.wsc
regsvr32 IIsScHlp.wsc

 

Posted by David Eison on Friday, February 27, 2009 5:23 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Creating a Horizontal Tabbed Menu with the Menu Control

I needed to create a quick horizontal tabbed menu with the Menu control.  The tabs have rounded corners so we're using image backgrounds.  We also have different images for the selected tab and when you hover.

image

<asp:Menu runat="server" ID="Menu1" SkinID="MenuHorizontalTabs">
    <Items>
        <asp:MenuItem Text="Tab 1" Value="Tab1" Selected="true" />
        <asp:MenuItem Text="Tab 2" Value="Tab2" />
        <asp:MenuItem Text="Tab 3" Value="Tab3" />
        <asp:MenuItem Text="Tab 4" Value="Tab4" />
    </Items>
</asp:Menu>

Then I added MenuHorizontalTabs to my skins file. 

<asp:Menu runat="server" SkinID="MenuHorizontalTabs" Orientation="Horizontal">
    <StaticItemTemplate>
        <div>
            <span>
                <asp:Literal runat="server" ID="Literal1" Text='<%# Eval("Text") %>' />
            </span>
        </div>
    </StaticItemTemplate>
    <StaticSelectedStyle CssClass="MenuHorizontalTabsSelectedMenuItem" />
    <StaticHoverStyle CssClass="MenuHorizontalTabsHoverMenuItem" />
    <StaticMenuItemStyle CssClass="MenuHorizontalTabsMenuItem" />
</asp:Menu>

Now, let's look at the CSS file.

.MenuHorizontalTabsMenuItem * div
{
    background:url(/images/header/left_both.gif) no-repeat left top; 
    height: 22px; 
    padding-left: 9px; 
    cursor: pointer;
}
.MenuHorizontalTabsMenuItem * span
{
    background:url(/images/header/right_both.gif) no-repeat right top; 
    padding: 5px 15px 4px 6px; 
    font-size: 10px; 
    color: #333; 
    height: 22px;
}
.MenuHorizontalTabsSelectedMenuItem * div
{
    background-position: 0px -150px;
}
.MenuHorizontalTabsSelectedMenuItem * span
{
    background-position: 0px -150px;
}
.MenuHorizontalTabsHoverMenuItem * div
{
    background-position: 0px -150px;
    color: Blue;
    text-decoration: none;
}
.MenuHorizontalTabsHoverMenuItem * span
{
    background-position: 0px -150px;
    color: Blue;
    text-decoration: none;
}

And finally, let's see the images.

left_both

left_both.gif

right_both

right_both.gif


Categories: ASP.NET
Posted by eric stoll on Thursday, January 31, 2008 10:07 AM
Permalink | Comments (0) | Post RSSRSS comment feed