fstream cannot open file installed by Wix toolset 3 - visual-c++

Recently I have created an installer using Wix Toolset 3. What it does is it installs png and json files onto the user's PC, as well as an exe file for a game I've been working on that requires all of the pngs and the json file to work properly. The program uses fstream to read the json file and convert the numbers inside of it to tiles for the map system. However, when the user installs my program using the installer, my program is unable to read the file. I have verified it using an if statement to test if the file can be opened, and if it can't, to not even attempt to generate a map. Also, if the user copies the json file they get, pastes it somewhere else, remove the original one that the installer put on their PC, and replaces it with the one the copied, the program is able to open the file. Here is the code from the map reading class (Map.cpp and Map.h) and the code for the installer (Product.wxs):
(In Map.h):
#pragma once
#include <string>
class Map {
public:
Map();
~Map();
static void LoadMap(std::string path, int sizeX, int sizeY, int layers);
};
(In Map.cpp):
#include "Map.h"
#include "Game.h"
#include <fstream>
Map::Map() {
}
Map::~Map() {
}
void Map::LoadMap(std::string path, int sizeX, int sizeY, int layers) {
char tile;
std::fstream mapFile;
mapFile.open(path);
if (mapFile.is_open()) {
for (int l = 0; l < layers; l++) {
for (int y = 0; y < sizeY; y++) {
for (int x = 0; x < sizeX; x++) {
mapFile.get(tile);
Game::AddTile(atoi(&tile), x * 64, y * 64);
mapFile.ignore();
}
}
}
}
mapFile.close();
}
(In Product.wxs):
<?xm version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="fb88098c-8720-4f04-bb0d-38432fb62c1b"
Name="Ophicyte"
Language="1033"
Version="0.0.0.1"
Manufacturer="U-Bit Company"
UpgradeCode="49eaae97-93b9-4e34-ab73-d21c5e3b74d1">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of Ophicyte is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="Ophicyte" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<Icon Id="mainicon.ico" SourceFile="..\UBitEngine\assets\mainicon.ico"/>
<Feature Id="Uninstall">
<ComponentRef Id="UninstallFolder" Primary="yes"/>
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="DesktopFolder" Name="Desktop" >
<Component Id="OphicyteDesktopShortcut" Guid="95ba12b1-e9d7-467e-9008-e46630122a1a">
<Shortcut Id="OphicyteShortcutDesktop"
Name="Ophicyte"
Target="$(var.UBitEngine.TargetFileName)"
WorkingDirectory="TARGETDIR"
Icon="mainicon.ico"
IconIndex="0"
Advertise="no"/>
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue
Root="HKCU"
Key="Software/Ophicyte"
Name="installed"
Type="integer"
Value="1"
KeyPath="yes"/>
</Component>
</Directory>
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Ophicyte" >
<Directory Id="ASSETSDIR" Name="assets">
<Component Id="ASSETSFOLDER" Guid="c18af068-440c-4faf-8fb0-22da79ddfa53"
SharedDllRefCount="no" KeyPath="no" NeverOverwrite="no" Permanent="no" Transitive="no" Win64="no" Location="either">
<RemoveFolder Id="ASSETSFOLDER" Directory="ASSETSDIR" On="uninstall"/>
<CreateFolder/>
</Component>
<!--Icons:-->
<Component Id='mainicon' Guid='a4788915-ff9a-4244-a330-d4084fa3aa59'>
<File Id='mainicon' Name='mainicon.ico' Source='..\UBitEngine\assets\mainicon.ico' KeyPath='yes'/>
<!--Sprites:-->
</Component>
<Component Id="CharacterFemale" Guid="f9e432c2-f74f-49ae-bb0c-e27d7184f578">
<File Id='CharacterFemale' Name='Character(female).png' Source="..\UBitEngine\assets\Character(female).png" KeyPath='yes' />
</Component>
<Component Id='Character' Guid='52a62880-5e56-4128-94e9-38fd9b7908c9'>
<File Id='Character' Name='Character.png' Source='..\UBitEngine\assets\Character.png' KeyPath='yes'/>
</Component>
<Component Id='GrassTufts1' Guid='24241c90-0af1-417c-984a-9e6d18d22315'>
<File Id='GrassTufts1' Name='Grass Tufts1.png' Source='..\UBitEngine\assets\Grass Tufts1.png' KeyPath='yes'/>
</Component>
<Component Id='Grass1' Guid='aab9b2fa-4583-4d11-b355-09e09cd20f63'>
<File Id='Grass1' Name='Grass1.png' Source='..\UBitEngine\assets\Grass1.png' KeyPath='yes'/>
</Component>
<Component Id='Ocean1' Guid='aae24e29-3eba-4880-9242-8d29fc2559e9'>
<File Id='Ocean1' Name='Ocean1.png' Source='..\UBitEngine\assets\Ocean1.png' KeyPath='yes'/>
</Component>
<Component Id='Tree2night' Guid='c9493e18-2814-408d-b750-15127b218d44'>
<File Id='Tree2night' Name='Tree2(night).png' Source='..\UBitEngine\assets\Tree2(night).png' KeyPath='yes'/>
</Component>
<Component Id='Tree2' Guid='75e4804c-d96f-4190-a411-06affe9e9ad9'>
<File Id='Tree2' Name='Tree2.png' Source='..\UBitEngine\assets\Tree2.png' KeyPath='yes'/>
</Component>
<!--Sound effects:-->
<Component Id='Slash3' Guid='03a64a3b-6234-4db8-b4e7-970a1d557979'>
<File Id='Slash3' Name='Slash3.wav' Source='..\UBitEngine\assets\Slash3.wav' KeyPath='yes'/>
</Component>
<!--Maps:-->
<Component Id='Overworld' Guid='cc8bb3a0-b0a3-48f2-8df6-2b7c5d96aa2d'>
<File Id='Overworld' Name='Overworld.json' Source='..\UBitEngine\assets\Overworld.json' KeyPath='yes'/>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<!--Features for icons:-->
<Feature Id="CREATEMAINICON" Title="mainicon.ico" Level="1">
<ComponentRef Id="mainicon"/>
</Feature>
<!--Features for shortcuts:-->
<Feature Id='SHORTCUT' Title='Ophicyte' Level='1'>
<ComponentRef Id='OphicyteDesktopShortcut'/>
</Feature>
<!--Features for folders:-->
<Feature Id="CREATEASSETSFOLDER" Title="assets" Level="1">
<ComponentRef Id="ASSETSFOLDER"/>
</Feature>
<!--Features for sprites:-->
<Feature Id="CREATECHARACTERFEMALE" Title="Character(female).png" Level="1">
<ComponentRef Id="CharacterFemale"/>
</Feature>
<Feature Id="CREATECHARACTER" Title="Character.png" Level="1">
<ComponentRef Id="Character"/>
</Feature>
<Feature Id="CREATEGRASSTUFTS1" Title="Grass Tufts1.png" Level="1">
<ComponentRef Id="GrassTufts1"/>
</Feature>
<Feature Id="CREATEGRASS1" Title="Grass1.png" Level="1">
<ComponentRef Id="Grass1"/>
</Feature>
<Feature Id="CREATEOCEAN1" Title="Ocean1.png" Level="1">
<ComponentRef Id="Ocean1"/>
</Feature>
<Feature Id="CREATETREE2NIGHT" Title="Tree2(night).png" Level="1">
<ComponentRef Id="Tree2night"/>
</Feature>
<Feature Id="CREATETREE2" Title="Tree2.png" Level="1">
<ComponentRef Id="Tree2"/>
</Feature>
<!--Features for sound effects:-->
<Feature Id="CREATESLASH3" Title="Slash3.wav" Level="1">
<ComponentRef Id="Slash3"/>
</Feature>
<!--Features for maps:-->
<Feature Id="CREATEOVERWORLD" Title="Overworld.json" Level="1">
<ComponentRef Id="Overworld"/>
</Feature>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent">
<File Source="$(var.UBitEngine.TargetPath)" />
</Component>
<Component Id="libpng" Guid="60fb99cf-5a5f-4dc2-8928-9c0b5232d046">
<File Id='libpng' Name='libpng16-16.dll' Source="..\UBitEngine\libpng16-16.dll" KeyPath='yes' />
</Component>
<Component Id="SDL2" Guid="9ee9481a-d57d-499d-8732-574ac6338980">
<File Id='SDL2' Name='SDL2.dll' Source="..\UBitEngine\SDL2.dll" KeyPath='yes' />
</Component>
<Component Id="SDL2image" Guid="bc104401-71d7-4bbd-a2fc-00f7b31045c9">
<File Id='SDL2image' Name='SDL2_image.dll' Source="..\UBitEngine\SDL2_image.dll" KeyPath='yes' />
</Component>
<Component Id='zlib' Guid='a9732a61-c65f-4cfc-ac82-48da7d2f9808'>
<File Id='zlib' Name='zlib1.dll' Source='..\UBitEngine\zlib1.dll' KeyPath='yes'/>
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="Assets" Directory="ASSETSFOLDER"/>
</Fragment>
<Fragment>
<Component Id="NEWCOMP" Guid="6b94d818-8cbc-45c7-8ded-37fc8048cc71" Directory="INSTALLFOLDER">
<RemoveFile Id="RemoveInstallFolder2" Name="Ophicyte" On="uninstall" />
</Component>
</Fragment>
<Fragment Id="FolderUninstall">
<?define RegDir="SYSTEM\ControlSet001\services\[UBitEngine]:[Ophicyte]"?>
<?define RegValueName=InstallDir?>
<Property Id="INSTALLFOLDER">
<RegistrySearch Root="HKLM" Key="$(var.RegDir)" Type="raw" Id="APPLICATIONFOLDER_REGSEARCH" Name="$(var.RegValueName)" />
</Property>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="UninstallFolder" Guid="4e61c6b1-fe6f-4cbb-8000-b94cf5f333d8">
<CreateFolder Directory="INSTALLFOLDER"/>
<util:RemoveFolderEx Property="INSTALLFOLDER" On="uninstall"/>
<RemoveFolder Id="INSTALLFOLDER" On="uninstall"/>
<RegistryValue Root="HKLM" Key="$(var.RegDir)" Name="$(var.RegValueName)" Type="string" Value="[INSTALLFOLDER]" KeyPath="yes"/>
</Component>
</DirectoryRef>
</Fragment>
</Wix>
Also, the value passed in the LoadMap function for path is "assets/Overworld.json". I am certain that the problem is not caused by not having the correct references or not giving the user all of the necessary files. If anyone has any idea how to fix this, your help would be greatly appreciated. Also, Overworld.json looks exactly like this:
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,1,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,1,3,1,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,1,3,1,3,1,3,1,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,1,3,1,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,1,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,1,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,1,3,2,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,2,3,2,3,2,3,2,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,1,3,2,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,1,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3

(Quote from Igor Tandetnik):
"Replace fstream with ifstream. The former attempts to open the file for both reading and writing by default. But directories under C:\Program Files are non-writable by non-admins by default, for security reasons. That's why your program works when copied elsewhere."

Related

Alfresco custom data list layout

I have created a custom data list in Alfresco, and have populated its model with the desired data columns. However, when I view the list in Alfresco share, the order is completely off, and there are elements that I have not defined in the model.
I have searched extensively as to how to fix this, and have not been successful. From what I understand, I need to define the layout in the share-config-custom.xml, which I have attempted below (snippet of only what I added):
<config evaluator="model-type" condition="orpdl:orpList">
<forms>
<form>
<field-visibility>
<show id="orpdl:programName" />
</field-visibility>
<create-form template="../data-lists/forms/dataitem.ftl" />
<appearance>
<field id="orpdl:programName">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
<config evaluator="node-type" condition="orpdl:orpList">
<forms>
<form>
<field-visibility>
<show id="orpdl:programName" />
</field-visibility>
<create-form template="../data-lists/forms/dataitem.ftl" />
<appearance>
<field id="orpdl:programName">
<control template="/org/alfresco/components/form/controls/textarea.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
Content model:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="orpdl:orpDataListModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Information retrieved from the Opportunity Registration Process workflow form.</description>
<author>Alan George</author>
<version>1.0</version>
<!-- Imports are required to allow references to definitions in other models -->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
<import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl" />
</imports>
<!-- Introduction of new namespaces defined by this model -->
<namespaces>
<namespace uri="http://www.test.com/model/orpDataListModel/1.0" prefix="orpdl" />
</namespaces>
<constraints>
<constraint name="orpdl:contractTypeList" type="LIST">
<parameter name="allowedValues">
<list>
<value>T&M</value>
<value>FFP</value>
<value>CPFF</value>
<value>CPIF</value>
</list>
</parameter>
</constraint>
</constraints>
<types>
<type name="orpdl:orpList">
<title>Opportunity Registration Process</title>
<description>Information retrieved from the Opportunity Registration Process workflow form.</description>
<parent>dl:dataListItem</parent>
<properties>
<property name="orpdl:programName">
<title>Program Name</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="orpdl:programDescription">
<title>Program Description</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="orpdl:client">
<title>Client</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="orpdl:contractType">
<title>Contract Type</title>
<type>d:text</type>
<mandatory>true</mandatory>
<constraints>
<constraint ref="orpdl:contractTypeList" />
</constraints>
</property>
<property name="orpdl:value">
<title>Value</title>
<type>d:text</type>
<mandatory>true</mandatory>
</property>
</properties>
</type>
</types>
</model>
The goal of this code is to have only the programName text box appear. But this is what I'm seeing:
What am I missing?
You are entering wrong condition in <config> tag.
Below
<config evaluator="model-type" condition="orpdl:orpDataListModel">
should replace with
<config evaluator="model-type" condition="orpdl:issuesList">
This will also apply to node-type.

Can't embed image in as3 file while build with ant under linux(debian)

I embedded a png in as3, it's all fine on windows, either use FB4.6 or Ant. But while build with Ant under linux(debian), I got this Error. Image path is /var/lib/jenkins/workspace/q5/dev_Flash/code/Copper/src/assets/c001_up.png. Project name is /var/lib/jenkins/workspace/q5/dev_Flash/code/Copper.
[mxmlc] /var/lib/jenkins/workspace/q5/dev_Flash/code/Copper/src/com/copper/ui/skin/DefaultAssets.as(10): col: 3: Error: unable to resolve 'assets/c001_up.png' for transcoding
[mxmlc]
[mxmlc] [Embed(source = "assets/c001_up.png")]
[mxmlc] ^
[mxmlc]
[mxmlc] /var/lib/jenkins/workspace/q5/dev_Flash/code/Copper/src/com/copper/ui/skin/DefaultAssets.as(10): col: 3: Error: Unable to transcode assets/c001_up.png.
as3 file like this
package com.copper.ui.skin {
/**
*
* #author marzwu
*
*/
public class DefaultAssets extends Assets {
[Embed(source = "assets/c001_up.png")]
private var Button_Up:Class;
My ant file is:
<?xml version="1.0" encoding="UTF-8"?>
Q5客户端构建
<!-- 配置属性 -->
<property file="build.properties" />
<property environment="env" />
<property name="FLEX_HOME" value="${env.FLEX_HOME}" />
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<target name="compile">
<echo message="${basedir}/../src" />
<compc output="../bin/copper.swc" debug="false" incremental="true">
<!-- 指定Comman项目的源码目录 -->
<source-path path-element="${basedir}/../src" />
<!-- 指定编译的文件列表 -->
<include-sources dir="${basedir}/../src">
<include name="**/*.as" />
</include-sources>
<!-- 将Flex SDK 作为外部库进行引用 -->
<compiler.external-library-path dir="${FLEX_HOME}/frameworks">
<include name="**/*.swc" />
</compiler.external-library-path>
<!-- 添加项目中的SWC包,请注意这里是外部 -->
<compiler.external-library-path dir="../libs">
<include name="**/*.swc" />
</compiler.external-library-path>
<define name="CONFIG::Debug" value="true" />
<define name="CONFIG::Release" value="false" />
<jvmarg value="-Xmx2048m"/>
<jvmarg value="-Xms512m"/>
<jvmarg value="-XX:MaxPermSize=512m"/>
</compc>
<!-- 删除缓存文件 -->
<delete>
<fileset dir="../bin" includes="*.cache" />
</delete>
<echo message="complier Flex Library Project finished!" />
</target>
<target name="deploy">
<antcall target="compile" />
<!--antcall target="copy_to_bin" /-->
<echo>前往查看结果:http://10.0.1.69/q5d/</echo>
<echo message="执行发布" />
</target>
I use jenkins to build my as3 project. It's bother me for many day. Appreciate for your helping.
Oops, compiler can't resolve the path, because I did not notice the "u" between "c001_up.png" is an upper case letter. Windows are not sensitive of letter case, but linux are. My fault, thank you for your time.

Nillable SOAP headers

I would like to allow some of my SOAP header elements to be nillable. This is possible for body elements, but I am not sure if it is allowed from header elements.
In the sample message below, I would like to allow the MessageDateTime to be null.
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://mycompany.com/repositoryservice">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://mycompany.com/repositoryservice">
<element name="MessageDateTime" type="dateTime" />
<element name="SaveRequest">
<!-- complexType -->
</element>
</schema>
</types>
<message name="SaveRequest_Headers">
<part name="MessageDateTime" element="tns:MessageDateTime" />
</message>
<message name="SaveRequest">
<part name="parameters" element="tns:SaveRequest" />
</message>
<binding name="RepositoryServiceBinding" type="tns:IRepositoryService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="Save">
<soap:operation soapAction="http://mycompany.com/repositoryservice/Save" style="document" />
<input name="SaveRequest">
<soap:header message="tns:SaveRequest_Headers" part="MessageDateTime" use="literal" />
<soap:body use="literal" />
</input>
</operation>
</binding>
<!-- service, portType -->
</definitions>
It is allowed as long as the definition allows for it. In your case, all you have to do is add the nillable="true" to the element's definition. The result on .NET w/ WCF would look something like this:
[System.ServiceModel.MessageHeaderAttribute(Namespace="...")]
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public System.Nullable<System.DateTime> MessageDateTime;

CC Validator throws error for dashboard.config file - No loaded type is marked up with a Reflector Type attribute

Think I have messed up the config file for the dashboard.
Error -
No loaded type is marked up with a Reflector Type attribute that matches the XML node(dashboard).
Error comes up when I validate the dashboard.config file in the CC Validator.
This is my dashboard.config file
<?xml version="1.0" encoding="utf-8"?>
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<dashboard>
<remoteServices>
<servers>
<!-- Update this list to include all the servers you want to connect to. NB - each server name must be unique -->
<server name="local" url="tcp://localhost:21234/CruiseManager.rem" allowForceBuild="true" allowStartStopBuild="true" backwardsCompatible="false" />
</servers>
</remoteServices>
<plugins>
<farmPlugins>
<farmReportFarmPlugin categories="false" />
<cctrayDownloadPlugin />
<administrationPlugin password="" />
</farmPlugins>
<serverPlugins>
<serverReportServerPlugin />
</serverPlugins>
<projectPlugins>
<projectReportProjectPlugin />
<viewProjectStatusPlugin />
<latestBuildReportProjectPlugin />
<viewAllBuildsProjectPlugin />
</projectPlugins>
<buildPlugins>
<buildReportBuildPlugin>
<xslFileNames>
<xslFile>xsl\header.xsl</xslFile>
<xslFile>xsl\modifications.xsl</xslFile>
</xslFileNames>
</buildReportBuildPlugin>
<buildLogBuildPlugin />
</buildPlugins>
<securityPlugins>
<simpleSecurity />
</securityPlugins>
</plugins>
</dashboard>
</cruisecontrol>
Can anyone please help me on this, and also some tips on how to resolve similar issues would be helpful.
Your dashboard.config file looks a little strange, i dont think it should contain the cruisecontrol node.
I think it should be:
<?xml version="1.0" encoding="utf-8"?>
<dashboard>
<remoteServices>
<servers>
<!-- Update this list to include all the servers you want to connect to. NB - each server name must be unique -->
<server name="local" url="tcp://localhost:21234/CruiseManager.rem" allowForceBuild="true" allowStartStopBuild="true" backwardsCompatible="false" />
</servers>
</remoteServices>
<plugins>
<farmPlugins>
<farmReportFarmPlugin categories="false" />
<cctrayDownloadPlugin />
<administrationPlugin password="" />
</farmPlugins>
<serverPlugins>
<serverReportServerPlugin />
</serverPlugins>
<projectPlugins>
<projectReportProjectPlugin />
<viewProjectStatusPlugin />
<latestBuildReportProjectPlugin />
<viewAllBuildsProjectPlugin />
</projectPlugins>
<buildPlugins>
<buildReportBuildPlugin>
<xslFileNames>
<xslFile>xsl\header.xsl</xslFile>
<xslFile>xsl\modifications.xsl</xslFile>
</xslFileNames>
</buildReportBuildPlugin>
<buildLogBuildPlugin />
</buildPlugins>
<securityPlugins>
<simpleSecurity />
</securityPlugins>
</plugins>
</dashboard>

XmlDocuments Element ignored in Content Type?

I have a content type defined in Elements.xml and I want to add an Event Receiver. My Elements.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Announcement (0x0104) -->
<ContentType ID="0x0104008a424de98660457481eb7d8ddb5161ee"
Name="News Posting"
Group="News"
Description="$Resources:NewsCTypeDescription"
Inherits="TRUE"
Version="1"
Sealed="TRUE"
>
<FieldRefs>
<FieldRef ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Name="NewsExcerpt"/>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
<spe:Receivers xmlns:spe="http://schemas.microsoft.com/sharepoint/events">
<Receiver>
<Name>ItemAdded</Name>
<Type>ItemAdded</Type>
<Class>MyAssembly.NewsItemEventReceiver</Class>
<Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>
<SequenceNumber>10000</SequenceNumber>
<Synchronization>Synchronous</Synchronization>
<Data />
<Filter />
</Receiver>
</spe:Receivers>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>
The weird thing is that the Event Receiver never executes. I've checked the Schema with SharePoint Manager 2010, and it seems that the XmlDocuments element is ignored completely?
Here's the content type SchemaXml according to SharePoint Manager:
<?xml version="1.0" encoding="utf-16"?>
<ContentType ID="0x0104008A424DE98660457481EB7D8DDB5161EE" Name="News Posting" Group="News" Description="A News Posting" Sealed="TRUE" Version="1">
<Folder TargetName="_cts/News Posting" />
<Fields>
<Field ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ContentType" Group="_Hidden" Type="Computed" DisplayName="Content Type" Sealed="TRUE" Sortable="FALSE" RenderXMLUsingPattern="TRUE" PITarget="MicrosoftWindowsSharePointServices" PIAttribute="ContentTypeID" Customization="">
<FieldRefs>
<FieldRef ID="{03e45e84-1992-4d42-9116-26f756012634}" Name="ContentTypeId" />
</FieldRefs>
<DisplayPattern>
<MapToContentType>
<Column Name="ContentTypeId" />
</MapToContentType>
</DisplayPattern>
</Field>
<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" Group="_Hidden" Type="Text" DisplayName="Title" Required="TRUE" FromBaseType="TRUE" Customization="" ShowInNewForm="TRUE" ShowInEditForm="TRUE" />
<Field ID="{7662cd2c-f069-4dba-9e35-082cf976e170}" Name="Body" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Body" Group="_Hidden" Type="Note" RichText="TRUE" RichTextMode="FullHtml" IsolateStyles="TRUE" DisplayName="Body" Sortable="FALSE" NumLines="15" Customization="" />
<Field ID="{6a09e75b-8d17-4698-94a8-371eda1af1ac}" Name="Expires" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Expires" Group="_Hidden" Type="DateTime" DisplayName="Expires" Format="DateOnly" Customization="" />
<Field ID="{7EBC5918-CB79-440A-8DF3-480C6951C4EB}" Group="News" Name="NewsExcerpt" DisplayName="Excerpt of the Article" Description="165 Characters maximum" MaxLength="165" Type="Text" Customization="" />
</Field>
</Fields>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>ListForm</Display>
<Edit>ListForm</Edit>
<New>ListForm</New>
</FormTemplates>
</XmlDocument>
</XmlDocuments>
</ContentType>
I have tried adding a FormTemplates XmlDocument as well, just to see if that works, but even this is ignored (I've changed the ListForm to ListForm2, but the SchemaXml is unchanged.
I've deleted the entire Web Application and Content Database to make sure there was nothing stale/stuck, but the result is still the same.
Is XmlDocuments depreciated in SharePoint 2010? What are the alternatives?
You should add your event receiver as a feature, maybe even as a part of the same feature that installs the content type. We always do it this way and it works perfectly

Resources