Search code examples
c#.netwpfwpfdatagrid

Error in loading datagrid in WPF


I wanted to change the exe name of my application. So, I changed the assembly name from BoltDataCalculation to some other name "BoltDataValidation". However, the datagrid in wpf application displays error while loading in run time. Please help me in resolving this exception. Below is the error:

System.IO.FileNotFoundException: Could not load file or assembly 'BoltDataCalculation, Culture=neutral' or one of its dependencies. The system cannot find the file specified.
File name: 'BoltDataCalculation, Culture=neutral'
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at System.Windows.Navigation.BaseUriHelper.GetLoadedAssembly(String assemblyName, String assemblyVersion, String assemblyKey)
   at MS.Internal.AppModel.ResourceContainer.GetResourceManagerWrapper(Uri uri, String& partName, Boolean& isContentFile)
   at MS.Internal.AppModel.ResourceContainer.GetPartCore(Uri uri)
   at System.IO.Packaging.Package.GetPartHelper(Uri partUri)
   at System.IO.Packaging.Package.GetPart(Uri partUri)
   at System.Windows.Application.GetResourceOrContentPart(Uri uri)
   at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
   at System.Windows.Application.LoadComponent(Uri resourceLocator)
   at FirstFloor.ModernUI.Windows.DefaultContentLoader.LoadContent(Uri uri)
   at FirstFloor.ModernUI.Windows.DefaultContentLoader.<>c__DisplayClass1.<LoadContentAsync>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

=== Pre-bind state information ===
LOG: User = Manish-PC\Manish
LOG: DisplayName = BoltDataCalculation, Culture=neutral
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: BoltDataCalculation, Culture=neutral | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/Manish/Desktop/Indepth work/manish/BoltDataCalculation/BoltDataCalculation/BoltDataCalculation/bin/Release/
LOG: Initial PrivatePath = NULL
Calling assembly : PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Manish\Desktop\Indepth work\manish\BoltDataCalculation\BoltDataCalculation\BoltDataCalculation\bin\Release\InDepthBoltValidation.vshost.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/Manish/Desktop/Indepth work/manish/BoltDataCalculation/BoltDataCalculation/BoltDataCalculation/bin/Release/BoltDataCalculation.DLL.
LOG: Attempting download of new URL file:///C:/Users/Manish/Desktop/Indepth work/manish/BoltDataCalculation/BoltDataCalculation/BoltDataCalculation/bin/Release/BoltDataCalculation/BoltDataCalculation.DLL.
LOG: Attempting download of new URL file:///C:/Users/Manish/Desktop/Indepth work/manish/BoltDataCalculation/BoltDataCalculation/BoltDataCalculation/bin/Release/BoltDataCalculation.EXE.
LOG: Attempting download of new URL file:///C:/Users/Manish/Desktop/Indepth work/manish/BoltDataCalculation/BoltDataCalculation/BoltDataCalculation/bin/Release/BoltDataCalculation/BoltDataCalculation.EXE.

Solution

  • As per the logs it seems you haven't updated URI's used in your XAML with name of new assembly.

    Update all PACK URI's in your project to refer to new assembly name.