.NET Framework Bookmark and Share   
 index > MSBuild > MSBuild on SLN is calling AssignCulture in v3.5\Microsoft.Common.targets and setting culture to "" (blank)
 

MSBuild on SLN is calling AssignCulture in v3.5\Microsoft.Common.targets and setting culture to "" (blank)

Hi All,

I'm using MSBuild on a VS2008 SLN file. I've found that one project is always built...even if none of the files have changed.

I reran with /v:diag and here's a snippet from the resulting log:
==========
Target "SplitResourcesByCulture: (TargetId:644)" in file "C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets" from project "C:\Users\dougc\Documents\Programming\Backazon\v1.1\Backazon.Windows\Backazon.Windows.csproj":
Task "Warning" skipped, due to false condition; ('@(ResxWithNoCulture)'!='') was evaluated as (''!='').
Task "Warning" skipped, due to false condition; ('@(ResxWithCulture)'!='') was evaluated as (''!='').
Task "Warning" skipped, due to false condition; ('@(NonResxWithCulture)'!='') was evaluated as (''!='').
Task "Warning" skipped, due to false condition; ('@(NonResxWithNoCulture)'!='') was evaluated as (''!='').
Task "AssignCulture" (TaskId:398)
Culture of "" was assigned to file "AmazonLocation.resx". (TaskId:398)
Culture of "" was assigned to file "BackupJobSpecs\JobFormError.resx". (TaskId:398)
Culture of "" was assigned to file "AmazonCosts.resx". (TaskId:398)
==========

It appears that all of the Embedded Resources in the project are getting assigned a culture of "" or blank. The change in the resx file then forces the resources file to be built which leads to the whole EXE being rebuilt.

The embedded resources affected are the ones created automatically by VS2008 when you create a WinForm or UserControl.

This project was recently converted from VS2005, but I don't know if that matters.

Any ideas on how to stop MSBuild or more to the point Microsoft.Common.targets v3.51 (I'm running on the RTM version of Win 7) from changing my resx files??

Best regards, Doug
Doug Clutter
Hi Doug,

AssignCulture task won't change the resource file. It shouldn't be the cause of this issue.

In MSBuild & VS, it checks the timestamp of output dll and pdb files under obj folder with all source code, projectfiles and resource files. Based on this, you'd better check following points:

1. Before build, check if timestamp of all source code and project files and compare it with DLL and PDB files in obj folder
2. Before build, check all .resources files in obj folder and compare them timestamp with DLL and PDB files
3. After build, check all source and resource files above and check if there is any file updated during a build
4. If there is any file updated, search its name in build log and identify why it is updated
5. If the file is resource file, the target "GenerateResource" is the one to generate those resource files

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Hongye Sun
Hongye,

To trace it, I've isolated it to a single file (AmazonLocation.resx) but this problem seems to occur for all of the WinForm/UserControl objects.

I traced it per your instructions, and here's what I found:

1. The date/time of the AmazonLocation.cs/AmazonLocation.Designer.cs/AmazonLocation.resx files are all 9/12 @ 12:28pm. The date/time of the EXE/PDB is 9/15 @ 9:45am, so this should not trigger the build.

2. The date/time of the obj/Release/AmazonLocation.resources is 9/15 @ 9:45am. The date/time of the EXE/PDB is 9/15 @ 9:45am. If I sort the directory by date/time, the EXE/PDB comes AFTER the resources file, so this should not trigger the build UNLESS the date/time compare is not looking at the FULL time (9:45.01034am).

3. The AmazonLocation.cs/resx are not updated by the build. The build log shows the following code where the resx is compiled into the resources file:

Target "CoreResGen: (TargetId:649)" in file "C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets" from project "C:\Users\dougc\Documents\Programming\Backazon\v1.1\Backazon.Windows\Backazon.Windows.csproj":
Task "GenerateResource" (TaskId:401)
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\Resgen.exe" /useSourcePath /r:C:\Users\dougc\Documents\Programming\Backazon\Artifacts\Reactor.Source\AmazonServices.dll /r:C:\Users\dougc\Documents\Programming\Backazon\Artifacts\Reactor.Source\Backazon.dll /r:C:\Users\dougc\Documents\Programming\Backazon\Artifacts\Reactor.Source\Backazon.Shared.dll /r:C:\Users\dougc\Documents\Programming\Backazon\Artifacts\Reactor.Source\DA.Common.dll /r:..\Tools\DevExpress.DLL\DevExpress.Data.v7.3.dll /r:..\Tools\DevExpress.DLL\DevExpress.Utils.v7.3.dll /r:..\Tools\DevExpress.DLL\DevExpress.Xpo.v7.3.dll /r:..\Tools\DevExpress.DLL\DevExpress.XtraBars.v7.3.dll /r:..\Tools\DevExpress.DLL\DevExpress.XtraEditors.v7.3.dll /r:..\Tools\DevExpress.DLL\DevExpress.XtraGrid.v7.3.dll /r:..\Tools\DevExpress.DLL\DevExpress.XtraNavBar.v7.3.dll /r:..\Tools\DevExpress.DLL\DevExpress.XtraPrinting.v7.3.dll /r:..\Tools\DevExpress.DLL\DevExpress.XtraReports.v7.3.dll /r:..\Tools\DevExpress.DLL\DevExpress.XtraRichTextEdit.v7.3.dll /r:..\Tools\DevExpress.DLL\DevExpress.XtraTreeList.v7.3.dll /r:..\Tools\Reactor\License.dll /r:..\Tools\NUnit\nunit.framework.dll /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Design.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.EnterpriseServices.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Security.dll /r:..\..\..\..\..\..\..\Windows\assembly\GAC_MSIL\System.ServiceProcess\2.0.0.0__b03f5f7f11d50a3a\System.ServiceProcess.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /r:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /r:..\Tools\TypeMock.NET\Typemock.ArrangeActAssert.Dll /r:..\Tools\TypeMock.NET\TypeMock.dll /compile AmazonLocation.resx,obj\Release\Backazon.Windows.AmazonLocation.resources BackupJobSpecs\JobFormError.resx,obj\Release\Backazon.Windows.BackupJobSpecs.JobFormError.resources AmazonCosts.resx,obj\Release\Backazon.Windows.AmazonCosts.resources CrateControls\AddCrateWizard.resx,obj\Release\Backazon.Windows.CrateControls.AddCrateWizard.resources CrateControls\BrowseAmazonFiles.resx,obj\Release\Backazon.Windows.CrateControls.BrowseAmazonFiles.resources CredentialsControls\AmazonCredentialsForm.resx,obj\Release\Backazon.Windows.CredentialsControls.AmazonCredentialsForm.resources CredentialsControls\CredentialsList.resx,obj\Release\Backazon.Windows.CredentialsControls.CredentialsList.resources CredentialsControls\CredentialsPanel.resx,obj\Release\Backazon.Windows.CredentialsControls.CredentialsPanel.resources CredentialsControls\CredentialsEdit.resx,obj\Release\Backazon.Windows.CredentialsControls.CredentialsEdit.resources CredentialsControls\WindowsCredentialsForm.resx,obj\Release\Backazon.Windows.CredentialsControls.WindowsCredentialsForm.resources HelpLink.resx,obj\Release\Backazon.Windows.HelpLink.resources InfoPopup\CrateInfoLink.resx,obj\Release\Backazon.Windows.InfoPopup.CrateInfoLink.resources CrateControls\ChangePassword.resx,obj\Release\Backazon.Windows.CrateControls.ChangePassword.resources EstimatedCosts.resx,obj\Release\Backazon.Windows.EstimatedCosts.resources Licensing\LicenseExpired.resx,obj\Release\Backazon.Windows.Licensing.LicenseExpired.resources Licensing\LicenseSuccess.resx,obj\Release\Backazon.Windows.Licensing.LicenseSuccess.resources InfoPopup\PasswordInfo.resx,obj\Release\Backazon.Windows.InfoPopup.PasswordInfo.resources BackupJobSpecs\QuickPicks.resx,obj\Release\Backazon.Windows.BackupJobSpecs.QuickPicks.resources Licensing\TrialLicense.resx,obj\Release\Backazon.Windows.Licensing.TrialLicense.resources Licensing\MissingLicense.resx,obj\Release\Backazon.Windows.Licensing.MissingLicense.resources CopyFiles.resx,obj\Release\Backazon.Windows.CopyFiles.resources Licensing\EnterSerialNumber.resx,obj\Release\Backazon.Windows.Licensing.EnterSerialNumber.resources CopyTo.resx,obj\Release\Backazon.Windows.CopyTo.resources BackupJobSpecs\JobSummary.resx,obj\Release\Backazon.Windows.BackupJobSpecs.JobSummary.resources Licensing\SubscriptionLicense.resx,obj\Release\Backazon.Windows.Licensing.SubscriptionLicense.resources LogListControl.resx,obj\Release\Backazon.Windows.LogListControl.resources Logs.resx,obj\Release\Backazon.Windows.Logs.resources LogViewer.resx,obj\Release\Backazon.Windows.LogViewer.resources Licensing\NoLicenseFile.resx,obj\Release\Backazon.Windows.Licensing.NoLicenseFile.resources CrateControls\RequestPassword.resx,obj\Release\Backazon.Windows.CrateControls.RequestPassword.resources RestoreWizard.resx,obj\Release\Backazon.Windows.RestoreWizard.resources SelectCrateCan.resx,obj\Release\Backazon.Windows.SelectCrateCan.resources CopyToForm.resx,obj\Release\Backazon.Windows.CopyToForm.resources InfoPopup\InfoLink.resx,obj\Release\Backazon.Windows.InfoPopup.InfoLink.resources CrateControls\CrateList.resx,obj\Release\Backazon.Windows.CrateControls.CrateList.resources CrateControls\Crates.resx,obj\Release\Backazon.Windows.CrateControls.Crates.resources ContentWithTitle.resx,obj\Release\Backazon.Windows.ContentWithTitle.resources BackupJobSpecs\DefineJob.resx,obj\Release\Backazon.Windows.BackupJobSpecs.DefineJob.resources ErrorMessage.resx,obj\Release\Backazon.Windows.ErrorMessage.resources BackupJobSpecs\JobForm.resx,obj\Release\Backazon.Windows.BackupJobSpecs.JobForm.resources BackupJobSpecs\JobList.resx,obj\Release\Backazon.Windows.BackupJobSpecs.JobList.resources BackupJobSpecs\Jobs.resx,obj\Release\Backazon.Windows.BackupJobSpecs.Jobs.resources BackupJobSpecs\JobSchedule.resx,obj\Release\Backazon.Windows.BackupJobSpecs.JobSchedule.resources BackupJobSpecs\JobStartNow.resx,obj\Release\Backazon.Windows.BackupJobSpecs.JobStartNow.resources MainForm.resx,obj\Release\Backazon.Windows.MainForm.resources InfoPopup\PopupInfo.resx,obj\Release\Backazon.Windows.InfoPopup.PopupInfo.resources Properties\Resources.resx,obj\Release\Backazon.Windows.Properties.Resources.resources BackupJobSpecs\QuickPickCheckbox.resx,obj\Release\Backazon.Windows.BackupJobSpecs.QuickPickCheckbox.resources Restore.resx,obj\Release\Backazon.Windows.Restore.resources InfoPopup\CanInfo.resx,obj\Release\Backazon.Windows.InfoPopup.CanInfo.resources BackupJobSpecs\SelectBackupSources.resx,obj\Release\Backazon.Windows.BackupJobSpecs.SelectBackupSources.resources BackupJobSpecs\SpecialFolderCheckbox.resx,obj\Release\Backazon.Windows.BackupJobSpecs.SpecialFolderCheckbox.resources Splash.resx,obj\Release\Backazon.Windows.Splash.resources StatusContents.resx,obj\Release\Backazon.Windows.StatusContents.resources Update.resx,obj\Release\Backazon.Windows.Update.resources CrateControls\ViewContents.resx,obj\Release\Backazon.Windows.CrateControls.ViewContents.resources WaitMessage.resx,obj\Release\Backazon.Windows.WaitMessage.resources Status.resx,obj\Release\Backazon.Windows.Status.resources (TaskId:401)
Creating a separate AppDomain because "NeverLockTypeAssemblies" evaluated to 'true'. (TaskId:401)
Processing resource file "AmazonLocation.resx" into "obj\Release\Backazon.Windows.AmazonLocation.resources". (TaskId:401)
Processing 1 resources from file "AmazonLocation.resx". (TaskId:401)

So, the question remains, why is the AmazonLocation.resx being processed into the AmazonLocation.resources when it has not changed?

Best regards, Doug
Doug Clutter
Not sure if it is relevant to this issue. I saw that you have turned on NeverLockTypeAssemblies switch in the build. Do you know why? Can you turn off it?
The switch turns on by specifying:
<GenerateResourceNeverLockTypeAssemblies>true</GenerateResourceNeverLockTypeAssemblies>
in the project file.

GenerateResources task will do a comparision of the last modified timestamp between the existing AmazonLocation.resxand obj\Release\Backazon.Windows.AmazonLocation.resources files. Can you make sure if the file obj\Release\Backazon.Windows.AmazonLocation.resources has never been deleted before in the msbuild log.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Hongye Sun
<GenerateResourceNeverLockTypeAssemblies>true</GenerateResourceNeverLockTypeAssemblies>


I removed this line, and it did not affect the problem.

The AmazonLocation.resx is dated 9/12
The obj/Release/Backazon.Windows.AmazonLocation.resources is dated 9/17 (not even close!)

What else could cause the GenerateResources task to fire off?
Doug Clutter
Not sure if this would (should) affect things, but I'm calling this build from within a proj...rather than building the SLN directly from the cmd line.

C> msbuild file1.proj

file1.proj content snip

  <Target Name ="BuildPrograms" DependsOnTargets="CreateTargetDirectories;SetAssemblyVersion">
    <MSBuild Projects="Build.proj"
             Properties="Configuration=Release;Platform=Any CPU;BuildTarget=$(BuildTarget)\" >
    </MSBuild>
  </Target>

build.proj snip

  <Target Name ="Build" DependsOnTargets="CreateTargetDirectories">
    <Error Condition=" '$(BuildTarget)' == '' " Text="Build.proj needs the BuildTarget property set to the target directory (eg - /p:BuildTarget=c:\here\ - trailing slash is required)" />
    <MSBuild Projects="$(SolutionFileName)"
             Properties="Configuration=$(Configuration);Platform=$(Platform);OutDir=$(BuildTarget)"
             BuildInParallel="true"
             StopOnFirstFailure="true" >
      <Output TaskParameter="TargetOutputs" ItemName="AssembliesBuilt" />
    </MSBuild>
  </Target>
The reason I mention this is because I don't get the problem if I call build.proj directly from the command line. The problem only comes up when I call file1.proj.

Any ideas?
Doug Clutter
Hi Doug,

I was unable to reproduce the issue on my side. Since this is a project specific issue,it will be very helpful if you cancreate a simplifiedrepro project and solution and send them to me?

My email is hongyes@online.microsoft.com, please remove 'online'.

If it is impossible, can you create a new sln file and readd the projects and check if the issue occurs again.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Hongye Sun
Hi Doug,

Are you still working on this issue?
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Hongye Sun
Hongye -
Yes...this continues to be a problem, but I've not had time to get a repro for you. Will try to work on that tomorrow.
Best regards, Doug
Doug Clutter

You can use google to search for other answers

Custom Search

More Threads

• Problem :: Project dependency and configuration
• virtual directories
• MS Build targets for C# 1.1
• AssemblyInfoTask .. Where is it now?
• VS 2005 WindowsApplication Deployment Dilemna ...
• Build not working due to dll reference.
• Copy and CopĆ®edFiles Output
• Relative Path In Build rule
• What is Homesite
• StackOverflowException using logger on a command line