1

This code fails when run from VisualStudio 2010 csproj file. Please help.

<PropertyGroup>
    <IntelliLockLocation>"C:\Program Files (x86)\Eziriz\IntelliLock\INTELLILOCK.exe"</IntelliLockLocation>
    <IntelliLockProject>"C:\Downloads\intellilock.ilproj"</IntelliLockProject>
  </PropertyGroup>

<Target Name="AfterCompile">
    <Exec Command="$(IntelliLockLocation) -project $(IntelliLockProject) -file &quot;$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)&quot; -targetfile &quot;$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)&quot;" />
  </Target>
mmm
  • 61
  • 1
  • 9
  • 1
    Please be more specific. What do you expect to happen? What fails? – stijn Jan 06 '14 at 09:04
  • Visual Studio cannot load project when I add these lines of code there. I want to execute something after DLLs are compiled but before the project and ClickOnce signature is built. – mmm Jan 06 '14 at 11:15
  • 1
    Then also post the exact error you're getting. If I copy the code above and paste it inside a project file (at the end of it) it loads just fine here and it executes the command as well. – stijn Jan 06 '14 at 13:21

1 Answers1

2

The solution is to use custom Microsoft.VisualStudio.Tools.Office.targets without problematic targets.

<Import Project="..\Microsoft.VisualStudio.Tools.Office.targets" />
<Target Name="AfterCompile">
    <Exec Command="$(IntelliLockLocation) -project $(IntelliLockProject) -file &quot;$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)&quot; -targetfile &quot;$(ProjectDir)$(IntermediateOutputPath)$(TargetFileName)&quot;  -snkeypair &quot;$(ProjectDir)$(AssemblyOriginatorKeyFile)&quot; -snpassword *****" />
  </Target>
mmm
  • 61
  • 1
  • 9