Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在WPF中加载datagrid时出错_C#_.net_Wpf_Wpfdatagrid - Fatal编程技术网

C# 在WPF中加载datagrid时出错

C# 在WPF中加载datagrid时出错,c#,.net,wpf,wpfdatagrid,C#,.net,Wpf,Wpfdatagrid,我想更改应用程序的exe名称。因此,我将程序集名称从BoltDataCalculation更改为其他名称“BoltDataValidation”。但是,wpf应用程序中的datagrid在运行时加载时显示错误。请帮助我解决此异常。以下是错误: System.IO.FileNotFoundException: Could not load file or assembly 'BoltDataCalculation, Culture=neutral' or one of its dependenci

我想更改应用程序的exe名称。因此,我将程序集名称从BoltDataCalculation更改为其他名称“BoltDataValidation”。但是,wpf应用程序中的datagrid在运行时加载时显示错误。请帮助我解决此异常。以下是错误:

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.
System.IO.FileNotFoundException:无法加载文件或程序集“BoltDataCalculation,Culture=neutral”或其依赖项之一。系统找不到指定的文件。
文件名:“BoltDataCalculation,区域性=中性”
在System.Reflection.RuntimeAssembly.\n加载(AssemblyName文件名、字符串代码基、证据assemblySecurity、RuntimeAssembly位置提示、StackScrawMark和stackMark、IntPtr pPrivHostBinder、Boolean throwOnFileNotFound、Boolean for Inspection、Boolean suppressSecurityChecks)
位于System.Reflection.RuntimeAssembly.nLoad(AssemblyName文件名、字符串代码基、证据assemblySecurity、RuntimeAssemblyLocationHint、StackScrawlMark和stackMark、IntPtr pPrivHostBinder、Boolean throwOnFileNotFound、Boolean For Inspection、Boolean suppressSecurityChecks)
位于System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,证据assemblySecurity,RuntimeAssembly reqAssembly,StackScrawMark&stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean For Inspection,Boolean suppressSecurityChecks)
在System.Reflection.Assembly.Load处(AssemblyName assemblyRef)
位于System.Windows.Navigation.BaseUriHelper.GetLoadedAssembly(String assemblyName、String assemblyVersion、String assemblyKey)
位于MS.Internal.AppModel.ResourceContainer.GetResourceManagerRapper(Uri、字符串和部件名、布尔值和isContentFile)
位于MS.Internal.AppModel.ResourceContainer.GetPartCore(Uri)
位于System.IO.Packaging.Package.GetPartHelper(Uri partUri)
在System.IO.Packaging.Package.GetPart(Uri partUri)中
位于System.Windows.Application.GetResourceOrContentPart(Uri)
位于System.Windows.Application.LoadComponent(Uri resourceLocator,布尔bSkipJournaledProperties)
位于System.Windows.Application.LoadComponent(Uri resourceLocator)
在一楼.ModernUI.Windows.DefaultContentLoader.LoadContent(Uri)
在FirstFloor.ModernUI.Windows.DefaultContentLoader.c__DisplayClass1.b__0()
在System.Threading.Tasks.Task`1.InnerInvoke()中
在System.Threading.Tasks.Task.Execute()中
==预绑定状态信息===
日志:User=Manish PC\Manish
日志:DisplayName=BoltDataCalculation,区域性=neutral
(部分)
警告:为程序集提供了部分绑定信息:
警告:程序集名称:BoltDataCalculation,区域性=中性|域ID:1
警告:仅提供部分程序集显示名称时,会发生部分绑定。
警告:这可能会导致活页夹加载不正确的组件。
警告:建议为程序集提供完全指定的文本标识,
警告:它由简单的名称、版本、区域性和公钥令牌组成。
警告:见白皮书http://go.microsoft.com/fwlink/?LinkId=109270 有关此问题的更多信息和常见解决方案。
日志:Appbase=file:///C:/Users/Manish/Desktop/Indepth 工作/曼尼什/博尔特数据计算/博尔特数据计算/博尔特数据计算/仓位/放行/
日志:初始PrivatePath=NULL
调用程序集:PresentationCore,版本=4.0.0.0,区域性=neutral,PublicKeyToken=31bf3856ad364e35。
===
日志:此绑定在默认加载上下文中启动。
日志:使用应用程序配置文件:C:\Users\Manish\Desktop\Indepth work\Manish\BoltDataCalculation\BoltDataCalculation\bin\Release\InDepthBoltValidation.vshost.exe.Config
日志:使用主机配置文件:
日志:使用C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config中的计算机配置文件。
日志:此时未将策略应用于引用(私有、自定义、部分或基于位置的程序集绑定)。
日志:正在尝试下载新URLfile:///C:/Users/Manish/Desktop/Indepth work/manish/BoltDataCalculation/BoltDataCalculation/BoltDataCalculation/bin/Release/BoltDataCalculation.DLL。
日志:正在尝试下载新URLfile:///C:/Users/Manish/Desktop/Indepth work/manish/BoltDataCalculation/BoltDataCalculation/BoltDataCalculation/bin/Release/BoltDataCalculation/BoltDataCalculation.DLL。
日志:正在尝试下载新URLfile:///C:/Users/Manish/Desktop/Indepth work/manish/BoltDataCalculation/BoltDataCalculation/BoltDataCalculation/bin/Release/BoltDataCalculation.EXE。
日志:正在尝试下载新URLfile:///C:/Users/Manish/Desktop/Indepth work/manish/BoltDataCalculation/BoltDataCalculation/BoltDataCalculation/bin/Release/BoltDataCalculation/BoltDataCalculation.EXE。

根据日志,您似乎还没有用新程序集的名称更新XAML中使用的URI


更新项目中的所有包URI以引用新的程序集名称。

我同意Rohit的观点,如果这不起作用,请尝试先清理解决方案。

似乎您还没有用新程序集的名称更新XAML中使用的URI。更新项目中的所有包URI以引用新的程序集名称。是的,我错过了。成功了。谢谢