DNI compilation error when trying to build source from revision 60483

Jan 20, 2011 at 1:26 PM

Hello
I am trying to build the dotnetinstaller 2.0.X on my machine. Since the update to revision 60483 this is not working. I am getting the follwing errors:

It looks like it is related to the introduction of uacelevetion.h and cpp.
Is there something I am doing wrong?

"D:\Source\DotNetInstallerTrunk\dni.proj" (all target) (1) ->
"D:\Source\DotNetInstallerTrunk\Dni.sln" (Build target) (2:2) ->
(dotNetInstallerLib target) ->
  d:\source\dotnetinstallertrunk\dotnetinstallertoolslib\uacelevation.h(22): error C2365: 'TokenElevationType' : redefinition; previous definition was 'enumerator'
  d:\source\dotnetinstallertrunk\dotnetinstallertoolslib\uacelevation.h(23): error C2365: 'TokenLinkedToken' : redefinition; previous definition was 'enumerator'
  d:\source\dotnetinstallertrunk\dotnetinstallertoolslib\uacelevation.h(24): error C2365: 'TokenElevation' : redefinition; previous definition was 'enumerator'
  d:\source\dotnetinstallertrunk\dotnetinstallertoolslib\uacelevation.h(25): error C2365: 'TokenHasRestrictions' : redefinition; previous definition was 'enumerator'
  d:\source\dotnetinstallertrunk\dotnetinstallertoolslib\uacelevation.h(26): error C2365: 'TokenAccessInformation' : redefinition; previous definition was 'enumerator'
  d:\source\dotnetinstallertrunk\dotnetinstallertoolslib\uacelevation.h(27): error C2365: 'TokenVirtualizationAllowed' : redefinition; previous definition was 'enumerator'
  d:\source\dotnetinstallertrunk\dotnetinstallertoolslib\uacelevation.h(28): error C2365: 'TokenVirtualizationEnabled': redefinition; previous definition was 'enumerator'
  d:\source\dotnetinstallertrunk\dotnetinstallertoolslib\uacelevation.h(29): error C2365: 'TokenIntegrityLevel' : redefinition; previous definition was 'enumerator'
  d:\source\dotnetinstallertrunk\dotnetinstallertoolslib\uacelevation.h(30): error C2365: 'TokenUIAccess' : redefinition; previous definition was 'enumerator'
  d:\source\dotnetinstallertrunk\dotnetinstallertoolslib\uacelevation.h(31): error C2365: 'TokenMandatoryPolicy' : redefinition; previous definition was 'enumerator'
  d:\source\dotnetinstallertrunk\dotnetinstallertoolslib\uacelevation.h(33): error C2365: 'TokenLogonSid' : redefinition; previous definition was 'enumerator'
  d:\source\dotnetinstallertrunk\dotnetinstallertoolslib\uacelevation.h(40): error C2011: '_TOKEN_ELEVATION_TYPE' : 'enum' type redefinition
  d:\source\dotnetinstallertrunk\dotnetinstallertoolslib\uacelevation.h(46): error C2011: '_TOKEN_ELEVATION' : 'struct' type redefinition

Best regards,

quirrel

Coordinator
Jan 20, 2011 at 1:41 PM

Visual Studio 2005? You probably have a newer SDK and need to edit the Token definitions with an #ifndef-type thing.  

Jan 20, 2011 at 2:21 PM
Edited Jan 20, 2011 at 2:36 PM

correct, I am not using VS2005, but 2008. This worked great so far, until now.

The uacelevation.h has allread a

#if !defined _TOKEN_ELEVATION_TYPE

in, but this does not seem to work. I know that there are other macros that can be checked to achieve the same.
For me replacing the line above with
#if _MSC_VER < 1500
did the trick.
Is it possible to change this, so DNI can be build with vs2008?

Thanks,
quirrel

 

edit: added macro that worked for me




 

Developer
Jan 21, 2011 at 6:40 AM

Could you raise a bug and assign it to me (nsleightholm), I will do some investigation. I was trying to find a way to not have to have the latest SDK installed because VS2005 doesn't reference them properly, I thought this would work but never checked! I think you solution should be ok.

Jan 21, 2011 at 6:57 AM

I just created http://dotnetinstaller.codeplex.com/workitem/8205, but could not assign any people to it.

Also submitted a patch with the suggested change.

 

Developer
Jan 21, 2011 at 7:47 AM

Thanks. Could you let me know if you have any Windows SDKs installed?

Jan 21, 2011 at 7:55 AM

yep, no problem:

I have installed windwos SDK 7.1, Windows SDK for VS2008 (.Net Framework Tools, headers and libraries, sdk reference assemblies and intellisense, sp1 tools, sp1 win32 tools)
at least this is what I get on "Software" in windows listed.

As far as my research told me,  _MSC_VER identifies the C++ Runtime version in some way.
hope it helps.



        
    
Developer
Jan 21, 2011 at 8:04 AM

That is useful. _MSC_VER does define the runtime but I think these definitions are coming from the SDK not the version of Visual Studio that is installed. I'll do a bit more research and see if I can come up with a generic solution.

Developer
Jan 21, 2011 at 5:11 PM

Could you try this for me:

#if !defined TOKEN_MANDATORY_POLICY_OFF // Only defined in later versions of SDK

This  should detect whether SDK version 6.0a or later is installed.

Jan 24, 2011 at 7:45 AM

I just did a rebuild with the line you suggested and there were also no build errors. So this seems to work also.

Developer
Jan 24, 2011 at 6:15 PM

This issue is now resolved: http://dotnetinstaller.codeplex.com/SourceControl/changeset/changes/60658.