开发者

MSBuild "Debug" configuration not working in VS 2010 Beta 2

开发者 https://www.devze.com 2022-12-17 06:45 出处:网络
I\'m trying to set up my environment for developing, debugging and deploying Windows Desktop Gadgets.I\'ve hit a bit of a roadblock in my project, where I can\'t run a build on my gadget when the conf

I'm trying to set up my environment for developing, debugging and deploying Windows Desktop Gadgets. I've hit a bit of a roadblock in my project, where I can't run a build on my gadget when the configuration is set to "Debug". If the configuration is set to "Release", the build goes through the following custom tasks:

  1. Copy gadget contents to a seperate folder.
  2. Minify/obfuscate the javascript files, removing comments and whitespace.
  3. Package the files into a CAB file.
  4. Sign the CAB file with a digital certificate.

This runs just fine, my "Debug" configuration has the following tasks defined

  1. Copy gadget folder to AppData\Local\Microsoft\Windows Sidebar\Gadgets\.
  2. Start the gadget using the IDesktopGadget interface.

If I copy those two tasks to the "Release" configuration, they run just fine - no problems whatsoever. I've tried creating a seperate configuration called "Test", copied from the "Release" configuration.

If I try to build any configuration other than "Release", I get an instant message saying "Build succeeded" but no tasks have run at all.

EDIT: I've started a bounty because I still have the same problem with VS 2010 RC and it's very frustrating.

FURTHER EDIT:

Thanks to John I was able to debug the build process. It led me to realize that the <Target&g开发者_如何学Got; element with condition for debugging was being completely ignored (not even processed). When I swapped the position of my <Target> elements, it worked:

<Target Name="Build" Condition="'$(Configuration)' == 'Release'">
  <!--
      <Obfuscate PathToJasob="C:\Program Files (x86)\Jasob.com\Jasob 3.5" Path="$(GadgetFolder)" Output="$(GadgetName)_obf" log="jasob_log.txt" />
  -->
  <BuildGadget BuildFormat="CAB" Path="$(GadgetFolder)" Target="$(GadgetName).gadget" />
  <SignGadget CertName="Cert1" TimestampURL="http://timestamp.comodoca.com/authenticode" Target="$(GadgetName).gadget" />
</Target>
<Target Name="Build" Condition="'$(Configuration)' == 'Debug'">
  <CopyToGadgets GadgetFolder="$(GadgetFolder)" GadgetName="$(GadgetName)" />
  <RunGadget GadgetName="$(GadgetName)" />
</Target>

So it looks like the second <Target Name="Build"> element overrides the first, despite the Condition attribute being present. What can I do?


As Joe suggests:

Change your output path like this, and see if that fixes the issue:

<OutputPath>bin\Debug\</OutputPath>

Update

Have you tried running msbuild /verbosity:diagnostic ?

Can you try that and show the output?

Second Update

Make one target 'build', and then make two tasks in that target:

<Target Name="Build">
    <CallTarget Targets="BuildRelease" Condition="'$(Configuration)' == 'Release'" />
    <CallTarget Targets="BuildDebug" Condition="'$(Configuration)' == 'Debug'" />
</Target>

<Target Name="BuildRelease">
    <!--
        <Obfuscate PathToJasob="C:\Program Files (x86)\Jasob.com\Jasob 3.5" Path="$(GadgetFolder)" Output="$(GadgetName)_obf" log="jasob_log.txt" />
    -->
    <BuildGadget BuildFormat="CAB" Path="$(GadgetFolder)" Target="$(GadgetName).gadget" />
    <SignGadget CertName="Cert1" TimestampURL="http://timestamp.comodoca.com/authenticode" Target="$(GadgetName).gadget" />
</Target>

<Target Name="BuildDebug">
  <CopyToGadgets GadgetFolder="$(GadgetFolder)" GadgetName="$(GadgetName)" />
  <RunGadget GadgetName="$(GadgetName)" />
</Target>


Just a guess:

Your Debug build has its output path set to bin\Release\. The timestamps of the files in bin\Release\ are probably causing MSBuild to conclude that the debug build is already up to date. Try changing the the output path to bin\Debug\ for debug builds.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号