{"action":"closed","issue":{"url":"https://api.github.com/repos/Microsoft/msbuild/issues/274","repository_url":"https://api.github.com/repos/Microsoft/msbuild","labels_url":"https://api.github.com/repos/Microsoft/msbuild/issues/274/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/msbuild/issues/274/comments","events_url":"https://api.github.com/repos/Microsoft/msbuild/issues/274/events","html_url":"https://github.com/Microsoft/msbuild/issues/274","id":111345559,"number":274,"title":"MSBuid Target fires when project has been modified","user":{"login":"samuilovaa","id":5283752,"avatar_url":"https://avatars.githubusercontent.com/u/5283752?v=3","gravatar_id":"","url":"https://api.github.com/users/samuilovaa","html_url":"https://github.com/samuilovaa","followers_url":"https://api.github.com/users/samuilovaa/followers","following_url":"https://api.github.com/users/samuilovaa/following{/other_user}","gists_url":"https://api.github.com/users/samuilovaa/gists{/gist_id}","starred_url":"https://api.github.com/users/samuilovaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samuilovaa/subscriptions","organizations_url":"https://api.github.com/users/samuilovaa/orgs","repos_url":"https://api.github.com/users/samuilovaa/repos","events_url":"https://api.github.com/users/samuilovaa/events{/privacy}","received_events_url":"https://api.github.com/users/samuilovaa/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-14T08:09:04Z","updated_at":"2016-06-01T19:45:25Z","closed_at":"2016-06-01T19:45:25Z","body":"I want do some work with compiled DLL after compilation and before build ended. I write next Test.targets:\r\n```xml\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Target Name=\"TrueFakeTarget\" AfterTargets=\"AfterCompile\" DependsOnTargets=\"$(CoreCompile)\">\r\n    <Message Text=\"### AfterCompile ###\" Importance=\"high\" />\r\n    <Exec Command=\"calc.exe\"/>\r\n</Target>\r\n```\r\nAnd .csproj file:\r\n```xml\r\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\r\n  <PropertyGroup>\r\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\r\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\r\n    <ProjectGuid>{17321175-38FF-44EF-8573-82CBC0BA60D8}</ProjectGuid>\r\n    <OutputType>Exe</OutputType>\r\n    <AppDesignerFolder>Properties</AppDesignerFolder>\r\n    <RootNamespace>TestAfterCompile</RootNamespace>\r\n    <AssemblyName>TestAfterCompile</AssemblyName>\r\n    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>\r\n    <FileAlignment>512</FileAlignment>\r\n    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>\r\n    <NuGetPackageImportStamp>\r\n    </NuGetPackageImportStamp>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\r\n    <PlatformTarget>AnyCPU</PlatformTarget>\r\n    <DebugSymbols>true</DebugSymbols>\r\n    <DebugType>full</DebugType>\r\n    <Optimize>false</Optimize>\r\n    <OutputPath>bin\\Debug\\</OutputPath>\r\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\r\n    <PlatformTarget>AnyCPU</PlatformTarget>\r\n    <DebugType>pdbonly</DebugType>\r\n    <Optimize>true</Optimize>\r\n    <OutputPath>bin\\Release\\</OutputPath>\r\n    <DefineConstants>TRACE</DefineConstants>\r\n    <ErrorReport>prompt</ErrorReport>\r\n    <WarningLevel>4</WarningLevel>\r\n  </PropertyGroup>\r\n  <ItemGroup>\r\n    <Reference Include=\"Accessibility\" />\r\n    <Reference Include=\"CustomMarshalers\" />\r\n    <Reference Include=\"ISymWrapper\" />\r\n    <Reference Include=\"Microsoft.Activities.Build\" />\r\n    <Reference Include=\"Microsoft.Build\" />\r\n    <Reference Include=\"Microsoft.Build.Engine\" />\r\n    <Reference Include=\"System\" />\r\n    <Reference Include=\"System.Core\" />\r\n    <Reference Include=\"System.Xml.Linq\" />\r\n    <Reference Include=\"System.Data.DataSetExtensions\" />\r\n    <Reference Include=\"Microsoft.CSharp\" />\r\n    <Reference Include=\"System.Data\" />\r\n    <Reference Include=\"System.Net.Http\" />\r\n    <Reference Include=\"System.Xml\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <Compile Include=\"Program.cs\" />\r\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <None Include=\"App.config\" />\r\n  </ItemGroup>\r\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\r\n  <Import Project=\"$(SolutionDir)\\Test.targets\" />\r\n</Project>\r\n```\r\nAfter compile works perfect, but when you change project, for example, add file, add references target fires again.\r\n\r\nHow to prevent target execution if project was not compiled??"}}
{"actor":{"display_login":"rainersigwald"}}