开发者

Problem Creating MSBUILD Script

开发者 https://www.devze.com 2023-02-03 10:02 出处:网络
I\'m having trouble with the <target> tag in my WPF project. What I\'m trying to do is implement a post-build event in the automated team build I have set up in TFS 2010 that triggers a piece o

I'm having trouble with the <target> tag in my WPF project.

What I'm trying to do is implement a post-build event in the automated team build I have set up in TFS 2010 that triggers a piece of integrated software for measuring code metrics called NDepend. NDepend's site gives some code samples of what I need to do, I believe. These code snippets are shown below:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild开发者_如何学JAVA/2003">
  <Target Name="NDepend"  >
    <PropertyGroup>
      <NDPath>c:\tools\NDepend\NDepend.console.exe</NDPath>
      <NDProject>$(SolutionDir)MyProject.ndproj</NDProject>
      <NDOut>$(TargetDir)NDepend</NDOut>
      <NDIn>$(TargetDir)</NDIn>
    </PropertyGroup>
    <Exec
      Command='"$(NDPath)" "$(NDProject)" /OutDir "$(NDOut)" /InDirs "$(NDIn)"'/>
  </Target>
</Project>

and

<Target Name="AfterCompile" >
    <BuildStep         TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
        BuildUri="$(BuildUri)"
        Message="Running NDepend analysis">
        <Output TaskParameter="Id" PropertyName="StepId" />
    </BuildStep>
    <PropertyGroup>
        <NDPath>c:\tools\NDepend\NDepend.console.exe</NDPath>
        <NDProject>$(SolutionRoot)\Main\src\MyProject.ndproj</NDProject>
        <NDOut>$(BinariesRoot)\NDepend</NDOut>
        <NDIn>$(BinariesRoot)\Release</NDIn>
    </PropertyGroup>
    <Exec 
      Command='$(NDPath) "$(NDProject)" /OutDir "$(NDOut)" /InDirs "$(NDIn)"'/>
    <BuildStep
        TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
        BuildUri="$(BuildUri)"
        Id="$(StepId)"
        Status="Succeeded" />
    <OnError ExecuteTargets="MarkBuildStepAsFailed" />
</Target>

<Target Name="MarkBuildStepAsFailed">
    <BuildStep
        TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
        BuildUri="$(BuildUri)"
        Id="$(StepId)"
        Status="Failed" />
</Target>

I run into trouble, though, when trying to find where to put this code. The website may be telling me everything I need to know and I'm just overlooking it or something, I don't know. But wherever I try typing in the <target> tags, VS just acts like it doesn't recognize it. In fact when I try typing just about all of the tags in the above snippets VS doesn't seem to recognize it.

Am I just missing an(some) assembly reference(s) somewhere?

I've written some XAML before, but I've never seen "target" as a tag, I've always seen it in the form of a property. So when I originally saw this code on their site, it looked a little strange to me, but I just thought it was because I haven't had a ton of exposure to XAML.

EDIT: The above paragraph is mistaken--As seen in the comments, the aforementioned code is XML, not XAML

The site does say that the code snippets given are for VS2008, which does make a difference, I understand. However, I didn't realize it was THAT big of a difference.

So could it be just a difference from 2008 to 2010? In which case, what is the difference in the code from 2008 given above and what it should be in 2010?


This is not WPF or XAML, it's just plain old XML.

This is a MSBuild script which typically goes in a .proj file not a .xaml file

0

精彩评论

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

关注公众号