Unable to apply publish properties for item X

17,821

Solution 1

It appears that the issue is related to ClickOnce. Navigate to the project, right click on it and click on properties. Go to the Publish tab and click on Application Files. Check the 'Show all files' checkbox and scroll through the list of files. Eventually, you will come across the file that has a yellow exclamation point on it. This file is orphaned and needs to be removed. Right click on the file and there should be a remove option.

Now build the solution and the warning should be gone.

Solution 2

The top voted answer is perfect as it stands, but those of us dealing with larger outbursts may benefit from this alternative answer. It describes an analogous fix on file level.

The warning is caused by an element like this:

<PublishFile Include="THIS IS USUALLY SOME IMAGINARY DLL">
  <Visible>False</Visible>
  <Group>
  </Group>
  <TargetPath>
  </TargetPath>
  <PublishState>Exclude</PublishState>
  <IncludeHash>True</IncludeHash>
  <FileType>Assembly</FileType>
</PublishFile>

...in the project file (.csproj) emitting the warning. Notice the PublishState "Exclude"; this element says "please don't publish the imaginary DLL"; this is obviously a needless instruction if no such DLL is anywhere around at publish time, but it is then also causing the warning because the publish process cannot evaluate the file's identity.

You can remove the entire PublishFile element for each deployment item mentioned in the warnings, as long as it has PublishState "Exclude". Do not mechanically remove every element with PublishState "Exclude", because if there was no warning about it, the file is probably available at publish time and it might end up published - which would be an unwanted product change as long as you only wanted to get rid of the warning.

Share:
17,821
Jonathan Nixon
Author by

Jonathan Nixon

I am a Senior .NET Developer for an non-profit in central IL. I have used VB6, VB.Net, C# along with various versions of SQL Server. I have used WPF, WinForms, ASP.NET and MVC. I have also been Admin for a TFS 2008 and TFS 2012 that included the installation, setup and maintenance as well. I have some experience with TFS 2010 as well.

Updated on June 07, 2022

Comments

  • Jonathan Nixon
    Jonathan Nixon almost 2 years

    Whenever we do a build in our main solution we receive the following warning:

    Unable to apply publish properties for item "microsoft.visualstudio.qualitytools.unittestframework".

    Has anyone seen anything like this before? Any ideas on how to fix this? It happens on all of our developer machines and also on our TFS build server as well. However, it only appears in Debug mode.

  • Nick Spreitzer
    Nick Spreitzer about 10 years
    That's twice I've googled that problem and found this answer. Eventually I'll learn. :p
  • MEMark
    MEMark over 7 years
    Show all files is the key here.
  • MEMark
    MEMark over 6 years
    @NickSpreitzer Third time for me. This time I was even surprised by my own comment.
  • Jerome
    Jerome about 5 years
    You can also update your csproj file taking care of 'PublishFile' section. Of course this has to be done very carefully.