Groups | Blog | Home
all groups > visual c > october 2004 >

visual c : Changing default namespace in assembly



Edward Diener
10/29/2004 7:16:56 PM
In the explanation to the ToolboxBitmapAttribute it is mentioned that new
bitmaps added to an assembly by Visual Studio .NET get the name of the
default namespace prepened to the name of the bitmap, and that the default
namespace is the assembly name. It then mentions that one can change the
default namespace through a project property, but there is no project
property to change this in VC++ .NET projects. Is there a way to chaneg the
default namespace in VC++ .NET IDE projects ?

Tarek Madkour [MSFT]
11/11/2004 2:57:56 PM
"Edward Diener" <eddielee@tropicsoft.com> wrote in
news:OaOHj1gvEHA.3200@TK2MSFTNGP14.phx.gbl:

[quoted text, click to view]

This behavior is only for VB and C#. When you select "embed" for
bitmap files in C# or VB, the build system automatically creates a
namespace.filename.bmp file for you and embeds that as a resource
in the final assembly. This is different for C++. The
documentation you were reading is incomplete. Can you point me to
the documentaiton you were referring to so that I can make sure
that gets fixed.

For C++, to embed a resource, you need to add the bitmap file to
your project then pass a /ASSEMBLYREFERNCE:filename.bmp to the
linker (this is a property on the linker section of the project
property pages). ToolboxBitmapAttribute("filename.bmp") would just
work then.

Thanks,
--
Tarek Madkour, Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers
Edward Diener
11/14/2004 9:03:44 PM
[quoted text, click to view]

The documentation on the web for MSDN, at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingtoolboxbitmapattributeclassctortopic2.asp
does have "[C#]" for the explanation while my own local documentation, which
is an earlier version of the library, did not. Therefore I consider this my
error for not checking the online documentation first.

[quoted text, click to view]

Thanks for the explanation. It needs to be in the official documentation. I
assume that the bitmap file needs to be added as a managed resource. This is
another area where I do not believe there is any explanation of how to add a
managed resource to a C++ project in the VS Studio IDE.

Tarek Madkour [MSFT]
11/15/2004 12:56:30 PM
"Edward Diener" <eddielee@tropicsoft.com> wrote in
news:uHaAXdryEHA.4004@tk2msftngp13.phx.gbl:

[quoted text, click to view]

Yes. I'm forwarding this to our writers.

[quoted text, click to view]

You either need to pass the .bmp file to the linker using the
/ASSEMBLYREFERENCE argument or you can create a .resx file and
have it link to the .bmp file.

VS2005 makes managing managed resources using .resx files a lot
simpler.

Thanks,
--
Tarek Madkour, Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers
AddThis Social Bookmark Button