Question

I try to create unmanaged dll in C# (VS2010) using Robert Giesecke's Unmanaged Exports. This is my code for test:

using RGiesecke.DllExport;

namespace UnmanagedDllTest
{
    public class TestClass
    {
        [DllExport]
        public static int Add1(int n)
        {
            return n + 1;
        }
    }
}

When I build this, I get an error:

UnmanagedDllTest -> D:\Dev\UnmanagedDllTest\UnmanagedDllTest\bin\x86\Debug\UnmanagedDllTest.dll
D:\Dev\UnmanagedDllTest\packages\UnmanagedExports.1.2.6\tools\RGiesecke.DllExport.targets(42,5): error : C:\Users\user\AppData\Local\Temp\tmpD5A0\UnmanagedDllTest.il(60) : error : syntax error at token '{' in:   {
D:\Dev\UnmanagedDllTest\packages\UnmanagedExports.1.2.6\tools\RGiesecke.DllExport.targets(42,5): error : 

What am I doing wrong?

Was it helpful?

Solution

I spent whole day trying to solve this issue and finnaly I found the solution! I also have russian windows and after updating VS2012 to VS2013 my projects started to show the same error:

error : syntax error at token '{' in: {

I tried to change environment variables, but this did not help. The only thing that helped me was changing default language of non-unicode programs. You can find this setting in "Control Panel > Language and Regional Settings > Additional > Change language for applications that dont support Unicode". I changed language to english, rebooted ... and profit!

OTHER TIPS

The problem is probably in Russian version of Windows. User z3d1k from Russia and I am too. In .li file enter comments in Russian.

This bug has been fixed in the forked release.
DllExport/changelog.txt at 1f6b2d90599d17614782784c6b5bb37f05a2dea9 · 3F/DllExport

You can fix it by re-installing with the following command.

UnInstall-Package UnmanagedExports 
Install-Package DllExport 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top