A property cannot be set while building

Topics: General Questions
Sep 18, 2009 at 4:25 PM

Hi all,

I am quite new to DocProject. I just installed it and cretaed a testing project, and it worked great. Then I tried to add the DocProject to one of my existing projects, and the build fails with "A property cannot be set while building". I cannot find any more details about what may be wrong. Any hint would be very appreciated.

 

LiborV

Sep 18, 2009 at 8:30 PM

Hi LiborV,

That error appears to be from MSBuild - complaining that an MSBuild property cannot be set during a build.  To be sure, the full stack trace would be helpful.  Please look at the build output window for more information and also check the Windows Event Log for related error events.

Do you have the latest versions of DocProject and Sandcastle installed?

Were there any customizations made to the BuildProcess.cs file or elsewhere?

Did you try restarting Visual Studio?  Your computer?

- Dave

Sep 25, 2009 at 9:06 PM

Hi

During my test with DocProject i also ran into this error.

The solution for the probleem seemed to delete the "buildhelp" folder manually before building it again. Sometimes this doesn't help but deleting it again once more does the trick.
After a succesfull build the problem would however rise again. The same method as before will fix it again.

I did not make any changes to the BuildProcess.cs file that was created. I did play around with the "Include Project Output Dialog" settings tough. And they are currently set as following:
Apply to all default: False
Include project output default: True
Don't ask me this again: True

The following callstacks appeared in the eventlog:
Doing a "Rebuild solution":

Event: Clean project.

System.InvalidOperationException: A property cannot be set while building.
at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args)
at Microsoft.Build.BuildEngine.BuildPropertyGroup.SetProperty(BuildProperty newProperty)
at Microsoft.Build.BuildEngine.BuildPropertyGroup.SetProperty(String propertyName, String propertyValue, Boolean treatPropertyValueAsLiteral)
at Microsoft.VisualStudio.Build.ComInteropWrapper.BuildPropertyGroupShim.SetPropertyLiteral(String propertyName, String propertyValue)
at EnvDTE.ProjectItems.Item(Object index)
at DaveSexton.DocProject.VSProjectItem.GetProjectItem(Boolean createInvalidParts, VSProjectItem dependencyItem)
at DaveSexton.DocProject.VSProjectItem.get_IsVisible()
at DaveSexton.DocProject.Engine.BuildEngine`2.CleanProjectDirectory(String path)
at DaveSexton.DocProject.Engine.BuildEngine`2.CleanProjectSubdirectory(String relativePath)
at DaveSexton.DocProject.Sandcastle.SandcastleBuildEngine.CleanInternal(BuildContext context)
at DaveSexton.DocProject.Engine.BuildEngine`2.Clean(BuildContext context)


Doing a "Build solution":

Event: Build process preparation.

System.InvalidOperationException: A property cannot be set while building.
at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args)
at Microsoft.Build.BuildEngine.BuildPropertyGroup.SetProperty(BuildProperty newProperty)
at Microsoft.Build.BuildEngine.BuildPropertyGroup.SetProperty(String propertyName, String propertyValue, Boolean treatPropertyValueAsLiteral)
at Microsoft.VisualStudio.Build.ComInteropWrapper.BuildPropertyGroupShim.SetPropertyLiteral(String propertyName, String propertyValue)
at EnvDTE.ProjectItems.Item(Object index)
at DaveSexton.DocProject.VSProjectItem.GetProjectItem(Boolean createInvalidParts, VSProjectItem dependencyItem)
at DaveSexton.DocProject.VSProjectItem.Delete()
at DaveSexton.DocProject.Engine.BuildEngine`2.DeleteTargetSubdirectory(String relativePath)
at DaveSexton.DocProject.Sandcastle.SandcastleBuildEngine.PrepareWorkingDirectory(Boolean fullClean)
at DaveSexton.DocProject.Sandcastle.SandcastleBuildEngine.PrepareTargetDirectory(BuildContext context)
at DaveSexton.DocProject.Engine.BuildEngine`2.EnsureOutputDirectoryStructure(BuildContext context)
at DaveSexton.DocProject.Engine.BuildEngine`2.PrepareForBuild(BuildContext context)
at DaveSexton.DocProject.Engine.BuildEngine`2.BuildInternal(BuildContext context)

I hope this information is helpfull. I stored the project in it's current state in case you are interested in more details.

- Jan-Peter

Sep 26, 2009 at 10:50 AM

Hi Jan-Peter,

Thanks for providing this information.  If you could send me your test project that would be useful as well.  Please tell me your email address on my online contact form and I'll send you mine:

http://davesexton.com/Contact/Default.aspx 

Thanks,
Dave

Sep 30, 2009 at 11:09 PM

Hi,

I found a way to make the problem disappear by changing some DocProject properties and excluding some files from the project.

I changed the "Include Project Output Dialog" settings to the following:
Apply to all default: True
Include project output default: False
Don't ask me this again: True

Next i excluded the "/bin" folder, the  "/Help/html" and all the non folder items in "/Help" folder from the project.
I also deleted these files and folders from the filesystem itself, but i don't think this was really needed as DocProject just puts them back and nothing bad comes from that.

It won't add the generated content to the project anymore now, but i actually like it that way so for me theres no problem there.

A new issue did appear where conime.exe kept a lock on the "/buildhelp" folder (turned out the issue was there all along, but suppressed by the method i used to let it manually remove this folder).
This turned out to be a bug of Windows Vista and i managed to "fix" this by removing all the languages in the windows language toolbar ( http://social.msdn.microsoft.com/Forums/en-US/windowscompatibility/thread/c609f41a-e78c-43e6-81fd-1cf76384bb01 ).

Hope this helps,
Jan-Peter

Oct 3, 2009 at 4:47 PM

Hi Jan-Peter,

Thanks for following-up with this.  From your analysis it seems that the issue is caused when build output is included as project items that appear in Solution Explorer.

I'll try to repro again when I get some time and see if I can fix the problem.

Thanks, 
Dave

Oct 3, 2009 at 4:52 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.