473,594 Members | 2,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detecting mscorlib.dll?

I have a header that is included from some files that use mscorlib and some that don't use it. One of the macros in this file uses the __pin keyword. When this header is compiled with a source file that doesn't use mscorlib I get the following error:

fatal error C1190: managed targeted code requires '#using <mscorlib.dll >' and '/clr' optio

I'd like something like the following
#ifnusing mscorlib.dl
#define MY_MACRO(x) __pin
#els
#define MY_MACRO(x)
#endi

Its the first line I'm having trouble with.
Nov 17 '05 #1
6 3244
I'd like something like the following:
#ifnusing mscorlib.dll


#ifdef _MANAGED

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 17 '05 #2
Thanks for the reply

It doesn't work exactly right. It seems to indicate whether the /clr option is used. The way the project is setup now, the entire project has this option and only certain files have the #using statement. So they all end up having _MANAGED defined

If there are no other suggestions I might just change the /clr option on a per file basis.
Nov 17 '05 #3
Hi Mccoyn
i have the same problem and i solve it in the following way
1) Go To ---Project Property->Configuratio n Property --->c/c++ --->/cl
2) Go To ---Project Property->Configuratio n Property --->Code Generation-->Basic Runtime Checks-->Default
3) Go To ---Project Property->Configuratio n Property --->Code Generation-->Enable Minimal Rebuild--> N
4) Go To ---Project Property->Configuratio n Property --->c/c++ -->General-->Debug Information Format-->Program Database (/Zi
5) Go To ---Project Property->Configuratio n Property --->Code Generation-->Runtime Library--><inherit from project defaults

those settings solve the proble
try it
but remember its change the entire project propert
have a nice day
Gabi
Nov 17 '05 #4
your 1.) doesn't make sense. set what to /clr?

I am trying to use XMLTextWriter in a managed code project and got the
same error indicated above.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 17 '05 #5
if I add /clr to command line under C++ which is what I guess you
meant.

I get:
Command line error D2016 : '/RTC1' and '/clr' command-line options are
incompatible
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 17 '05 #6
i gave up on trying to get XMLTextWriter to work in managed code.
:cry:
This is an e-mail I sent to a microsoft rep and they didn't know why
it wouldn't work.

I am trying to use the XmlTextWriter
class.

I have this in header of a dialog class within project:
#using <System.xml.dll >
using namespace System::Xml;
I have this in the OnInitDialog() as a test:

#pragma push_macro("new ")
#undef new
XmlTextWriter *writer = new
XmlTextWriter(" c:\\titles.xml" , 0);
// Set the formatting
writer->Formatting = Formatting::Ind ented; // Write the standard document start
writer->WriteStartDocu ment();

writer->WriteStartElem ent("geology");
// Start the volcano element
writer->WriteStartElem ent("volcano");
// Do the name attribute
writer->WriteAttribute String("name", "Mount St.Helens"); // Write the location element

writer->WriteStartElem ent("location") ;
writer->WriteString("W ashington State, USA"); writer->WriteEndElemen t();

writer->WriteEndElemen t();
writer->WriteEndElemen t();
// Flush and close
writer->Flush();
writer->Close();
#pragma pop_macro("new" )
This compiles fine in Debug but not in Release mode which causes the following error message:
"An unhandled exception of type 'System.NullRef erenceException ' occurred in Project.exe
Additional information: Object reference not set to an instance of an object."

I have adjusted compile switch settings repleatedly to try to get this
to work.


Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
306
by: Tom van Dijck | last post by:
Hi I'm currently in the process of writing my own mscorlib.dll, this in order to write my own Virtual Machine. Now all may seem a bit useless, but I'd like to use C# as scripting for our game engine, since basically all needed feature are already available in C#, and hell... why think of something new, if something else is already available Mono, dotGNU and Rotor are totally useless for me, since they are GPL or some custom microsoft license...
2
3148
by: MFRASER | last post by:
I am getting a System.Security.SecurityException when I try and laod a dataset from an xml file any ideas on what would cause this? System.Security.SecurityException' occurred in mscorlib.dll Additional information: Request for the permission of type System.Security.Permissions.StrongNameIdentityPermission, mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
0
2830
by: Michael R. Pierotti | last post by:
Has anyone seen this error before when trying to make the install on a program. ------ Starting pre-build validation for project 'HafaSMPPInstall' ------ WARNING: Unable to find dependency 'mscorlib' (Signature='B77A5C561934E089' Version='1.0.5000.0') of assembly 'Devshock.Protocol.SmppClient.DLL' WARNING: Unable to find dependency 'mscorlib' (Signature='B77A5C561934E089' Version='1.0.5000.0') of assembly 'System.dll' WARNING: Unable to...
4
6887
by: Earl | last post by:
Created a .dll to use in multiple projects. Very simple, one class to return a purpose for a particular version. But when I added it as a reference to one of my other projects, I get a build error (even before I try to build it): "Error: The dependency 'mscorlib, Version= 1.0.5000.0, Culture=neutral," I put the dll in the bin directory below my project and then add it as a reference. What am I overlooking here?
3
7190
by: DJTN | last post by:
I'm getting the following error when I try to compile my setup project in VS 2002. I have re-installed the .net framework 1.1 and it didnt solve the problem. WARNING: Unable to find dependency 'mscorlib' (Signature='B77A5C561934E089' Version='1.0.5000.0') of assembly 'System.dll' WARNING: Unable to find dependency 'mscorlib' (Signature='B77A5C561934E089' Version='1.0.5000.0') of assembly 'System.Windows.Forms.dll' WARNING: Unable to...
0
3007
by: qiang | last post by:
Hi everyone, Could you please take a look at an exception for ASP.NET application? My ASP.NET application is using Infragistics WebChart control. I encounter an exception below when deploying the application into a third-part host.
0
1362
by: paulodonnell99 | last post by:
Hi, I am trying to build an installer application to run on the compact framework, I want to produce a netmodule using CSC.exe, then use AL.exe to embed resouce files and produce an exe. My problem is, when I use CSC.exe to produce my netmodule it keeps throwing in an extra reference to mscorlib - such that when the netmodule is opened with Ildasm the assembly manifest looks like this:
3
12042
by: Mike | last post by:
Hi I have problem as folow: Caught Exception: System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. (machine.config) ---> System.Security.SecurityException: Request for the permission of type
13
1490
by: John W. | last post by:
Hi there, Does anyone know if there's a (simple) way to detect whether an arbitrary "System.Type" originates from the .NET framework opposed to a user-defined assembly. Thanks.
0
7947
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7880
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8010
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8242
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6665
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5739
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1486
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.