I have a simple library that I made on C++/CLI just for testing:
#pragma once
using namespace System;
namespace ClassLibrary2 {
public ref class Class1
{
public:int ReturnInt()
{
return 40;
}
};
}
It works good, when i'm adding it as a reference to my C# application. But when i'm adding in a code #include <Windows.h>
string after the #pragma once
string, error LNK 2022 became:
MSVCMRT.lib(mstartup.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0001e2). MSVCMRT.lib(mstartup.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0001e6). MSVCMRT.lib(managdeh.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0000c0). MSVCMRT.lib(managdeh.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0000c2). MSVCMRT.lib(mehvecdtr.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0000a6). MSVCMRT.lib(mehvecdtr.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0000a9). MSVCMRT.lib(ManagedMain.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0000bf). MSVCMRT.lib(ManagedMain.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0000c1). MSVCMRT.lib(msilexit.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0000e9). MSVCMRT.lib(msilexit.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0000ec). MSVCMRT.lib(pureMSILcode.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c000199). MSVCMRT.lib(pureMSILcode.obj) : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c00019a). LINK : fatal error LNK1255: link failed because of metadata errors
How can I fix it ?