Reputation: 93
I'm trying to compile the sample code for Sync Framework 4.0 for Windows Phone, however I've encountered an error in few files. One of those files is:
#if SERVER
namespace Microsoft.Synchronization.Services
#elif CLIENT
namespace Microsoft.Synchronization.ClientServices
#endif
{
/// <summary>
/// Represents the base interface that all offline cacheable object should derive from.
/// </summary>
public interface IOfflineEntity
{
/// <summary>
/// Represents the sync and OData metadata used for the entity
/// </summary>
OfflineEntityMetadata ServiceMetadata { get; set; }
}
}
There are two errors:
I've searched through the google for both of those errors and I've found lots of answers for such errors - however none of those can be applied to my case (afaik there are no missing parentheses).
Upvotes: 3
Views: 2598
Reputation: 1609
I was getting this error because my .TT file had UNIX style line breaks in it, presumably because the line breaks were converted by git. Copying the .tt file into a text editor, saving it in PC format, and then copying back into Visual Studio solved the problem for me.
Upvotes: 0
Reputation: 6217
You get this error because you have neither SERVER nor CLIENT conditional symbol defined. After preprocessing phase eliminates text in #if...#endif directives, compiler sees only this code:
{
/// <summary>
/// Represents the base interface that all offline cacheable object should derive from.
/// </summary>
public interface IOfflineEntity
{
/// <summary>
/// Represents the sync and OData metadata used for the entity
/// </summary>
OfflineEntityMetadata ServiceMetadata { get; set; }
}
}
which is not valid C# code (because "namespace xyz" is missing before opening curly brace).
In Visual Studio go to project properties and on page Build set Conditional compilation symbols to SERVER or CLIENT (names are case sensitive).
Upvotes: 4