WPF - How to run WPF solution in VS2010 SP1

2

I am following the tutorial from the book "Pro C# 2010 and the .NET 4 Platform". After I load the sample code from MyXamlPad project under Chapter 27 and try to run it, I got an error from the compiler as follows:

Error   1   The "GenerateResource" task failed unexpectedly.
System.DllNotFoundException: Unable to load DLL 'FileTracker.dll': A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)
   at Microsoft.Build.Shared.NativeMethodsShared.InprocTracking.StartTrackingContextWithRoot(String intermediateDirectory, String taskName, String rootMarker)
   at Microsoft.Build.Utilities.FileTracker.StartTrackingContextWithRoot(String intermediateDirectory, String taskName, String rootMarkerResponseFile)
   at Microsoft.Build.Tasks.GenerateResource.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)   MyXamlPad


Reference:

http://www.apress.com/9781430225492
http://www.apress.com/downloadable/download/sample/sample_id/12/

What should I do to fix this problem? Or I just cannot run the WPF inside VS2010 and have to use the MSBUILD instead.

Thank you

wpf
asked on Stack Overflow May 24, 2011 by q0987

2 Answers

4

Make sure you have only one v4.0*** folder (you can rename if you don't wish to delete) in your C:\Windows\Microsoft.NET\Framework folder. That should do the trick.

If you already have only one of these v4.0*** folders you can try editing the Microsoft.Common.targets file within that folder and removing TrackFileAccess="$(TrackFileAccess)" and TrackerLogDirectory="$(TrackerLogDirectory)" entries from the GenerateResource node around line 1850.

answered on Stack Overflow May 24, 2011 by Dean Kuga
2

I have posted my comment above, and I'll add more details in this answer.

There could be some problem of running the sample itself. By default, WPF project in VS 2010 is using .NET 4.0 Client Profile. The sample used can be different in .NET version.

Have you tried to rebuild the solution? If it still doesn't work, try adding the assembly reference manually to the sample WPF project.


User contributions licensed under CC BY-SA 3.0