2
Vote

Release Build Error

description

I'm using the project in VS2012 and I'm trying to get the template to create the package. I followed the instructions and Edited the values that were necessary. The project builds without error in Debug mode, but when I change to release mode to have it generate the pacakges, I get an error

Error 2 String was not recognized as a valid Boolean. TestProject

The error doesn't show a line number or any additional information. I have not idea how to track down this error. Has anyone seen this behavior before? I even compared my Project.targets file to that of the DNN FAQ module for any differences and only found that the DesktopFolder tag was missing, after adding that, still no luck. Any ideas?

comments

AlexMacGregor wrote Mar 13, 2014 at 11:21 PM

Root Cause

The issue is a result of no value being specified for the optional azureCompatible parameter of the DNNtc.PackageProperties attribute. The issue is in Components.cs at line #876:
azureCompatible = Convert.ToBoolean(properties[propCount - 1].Trim());
When no value is specified, propCount - 1 ends up trying to convert the value of the company email (e.g. "COMPANYEMAIL") to a boolean value (thus throwing an exception), instead of just defaulting to false.

** Note: ** If you're interested, this MSDN blog posting explains how to debug MSBuild Tasks
(How To: Debug a custom MSBuild task using Visual Studio). I just had to use the 3.5 version instead of 2.0

Workaround

The template creates View.ascx.cs decorated with the attribute without specifying a value, like this:
[DNNtc.PackageProperties("PACKAGENAME", 1, "FRIENDLYNAME", "DESCRIPTION", "ICONFILE", "YOURNAME", "YOURCOMPANY", "COMPANYURL", "COMPANYEMAIL")]
However, until this is fixed, you should be able to explicitly set the value for the azureCompatible parameter, like this:
[DNNtc.PackageProperties("PACKAGENAME", 1, "FRIENDLYNAME", "DESCRIPTION", "ICONFILE", "YOURNAME", "YOURCOMPANY", "COMPANYURL", "COMPANYEMAIL", azureCompatible: false)]

Permanent Solution

I'll submit a patch within the next several days to resolve this - once I figure out how with CodePlex. :-)

AlexMacGregor wrote Mar 14, 2014 at 2:56 PM

Update | Patch Submitted

Reference: Source Code > Patches > #15991

AlexMacGregor wrote Mar 14, 2014 at 3:40 PM

One correction to the workaround too. Don't include the name of the parameter, only the value.
For example:
// Incorrect and will cause a build error!
[DNNtc.PackageProperties("PACKAGENAME", 1, "FRIENDLYNAME", "DESCRIPTION", "ICONFILE", "YOURNAME", "YOURCOMPANY", "COMPANYURL", "COMPANYEMAIL", azureCompatible: false)]

// Correct way - will build successfully in Release
[DNNtc.PackageProperties("PACKAGENAME", 1, "FRIENDLYNAME", "DESCRIPTION", "ICONFILE", "YOURNAME", "YOURCOMPANY", "COMPANYURL", "COMPANYEMAIL", false)]