Thursday, April 29, 2010

Visual Studio 2010

Hello,

I was playing around with the brand new Visual Studio 2010 and have found a really cool new feature. Actually this is something I'm waiting for years.

The problem:

Every new Visual Studio version requires you to create a new project and maintain it along the other versions. I had a situation once that I need to keep VS2005, VS2005 and VS2008 projects. What a pain! As soon as you add a new class to your project you need to replicate that to the other versions. It was chaotic!

The new feature:

VS2010 have introduced a new cool feature called "Platform Toolset". It allows you to target your build using specific VS libraries which allow you to build binaries as if you are using previous VS versions. Natively it comes with v100 and v90 platforms (v100 is the default). I did some testing targeting v90 and it really works. The generated DLL (in my case an ARX module) was totally compatible with the Host application (in this case AutoCAD).

More than that, with the ability to create your custom targets open a totally new world of VS projects management which will save you hours copying thing to keep your source code updated.

Further reading:

VS 2010 Enhancements

VS 2010 native Multi-targeting

I have used Visual Studio 2010 Professional Trial version to test this and you can download it from here:

Visual Studio 2010 Trial Download

Cheers!

11 comments :

Jon Smith said...

There is also a pre-made v80 toolset available on the Visual C++ blog here: http://blogs.msdn.com/vcblog/archive/2009/12/08/c-native-multi-targeting.aspx. Requires a bit of hacking to get it working for x64 builds, but it compiles AutoCAD 2007/8/9 projects great.

Anonymous said...

Is it possible to use this feature with VS2010 express edition?

Fernando Malard said...

Hello,

I have not tested this feature inside Express edition.

Prem Kumar U said...

It is really a cool feature. But the problem when developing ObjectARX in visual studio 2010 is it is pain without ObjectARX wizards. Is there any work around to install ObjectARX wizard in VS 2010?
Thanks for your information.

Fernando Malard said...

Hello,

None that I'm aware of.

Probably only when the DWG binary compatibility is broken supported VS version will change to 2010.

Regards.

Bukhari said...

Hi Fernando!

First of all sorry for posting the query here!

Just having some problem related to calling a simple dll from arx. And, i am passing wstring from arx to my dll both are unicode.

But the problem i am facing the when i receive the wstring in dll it turns into garbage.

During debugging i see that the data is in its correct form when i am in arx but as i step in the dll the wstring turns alien. Whereas, if i pass int, double they work totally fine.

Looking forward to hear from you.

Fernando Malard said...

Hi Bukhari,

Have you tried to encapsulate your string into a CString class and pass it as LPCTSTR?

As long as you don't need to do a string roundtrip I always prefer to use LPCTSTR.

Regards,

Bukhari said...

Fernando!

Not using MFC in the dll. Its a plan c++ dll.

Therefore, cannot wrap in CString.

Fernando Malard said...

Bukhari,

I think you will need to use UNICODE conversion functions from Windows API:

http://msdn.microsoft.com/en-us/library/dd374085(v=vs.85).aspx

Take a look at both MultiByteToWideChar and WideCharToMultiByte.

Hope it works for you.
Regards,

Bukhari said...

There is not need to use this function when both ARX and DLL are unicode.

Correct me if am wrong?

Fernando Malard said...

wasting does not carry encoding information so you still need to convert

take a look here for more information:

http://stackoverflow.com/questions/402283/stdwstring-vs-stdstring

Regards,