ASP.net编译项目错误
Error 102 'System.Guid' does not contain a definition for 'Parse'
根据 MSDN:
http://msdn.microsoft.com/en -us/library/system.guid.parse.aspx
这是因为解析方法位于 mscorlib(在 mscorlib.dll 中),.NET 4.0
我所有的项目设置/应用程序池都是设置为.NET 4.0。但我在 web.config 中的程序集如下:
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add assembly="System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
<add assembly="MySql.Data.Entity, Version=6.3.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
<add assembly="MySql.Web, Version=6.3.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
</assemblies>
如果我将 System.core 更改为版本 4.0.0.0,它会引发很多错误:
Error 102 The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
任何人都可以帮我修复它,以便我可以构建我的网站吗?
Error 102 'System.Guid' does not contain a definition for 'Parse'
According to MSDN:
http://msdn.microsoft.com/en-us/library/system.guid.parse.aspx
This is because the parse method is in mscorlib (in mscorlib.dll), .NET 4.0
All my project settings/app pools are set to .NET 4.0. But my assemblies in web.config is as follows:
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add assembly="System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
<add assembly="MySql.Data.Entity, Version=6.3.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
<add assembly="MySql.Web, Version=6.3.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
</assemblies>
If I change System.core to version 4.0.0.0 it throws a lot of errors:
Error 102 The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
Can anyone help me fix it so I can build my website?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Guid.Parse
仅是 .NET 4.0 方法,Silverlight 也是如此,但这与此处无关。您不能只升级一个程序集,而是将整个站点升级到 .NET 4.0。或者,如果您需要保留在 3.5 中,您可以简单地尝试从旧的字符串表示形式创建一个新的 GUID。Guid.Parse
is a .NET 4.0 method ONLY, well Silverlight also but that is not relevant here. You cannot just upgrade the one assembly, upgrade the entire site to .NET 4.0. Or you can simple try to create a newGUID
from the old string representation of it, if you need to stay in 3.5.尝试创建一个新的 .NET 4.0 站点并复制其中的所有
标记值。您是否也尝试将它们全部删除?
Try to create a new .NET 4.0 site and copy all the
<assemblies>
tag values in it.Did you try to remove them all also ?
1 - System.Guid.Parse - ?尝试 System.Guid().Parse - 你应该有一条红线告诉你语法错误
2 - 如果你是 3.5,那么将 System.data、system.data.linq 添加到你的项目中
- 如果您是 4.0,则添加 system.data 和 system.linq
我注意到您引用了 System.web 和 System.windows.forms?在同一个项目中?一般来说,让一个使用 windows.forms 的网站
最后查明 MySQL 版本是否需要 .net 4.0 是不好的做法 - 如果需要,则会出现另一个问题
1 - System.Guid.Parse - ? Try System.Guid().Parse - you should have a red line telling bad syntax
2 - If you are 3.5 then add System.data, system.data.linq to your project
- if you are 4.0 then add system.data and system.linq
I notice that you have references to System.web and System.windows.forms? In the same project? Generally it is bad practice to have a web site that uses windows.forms
lastly find out if the MySQL version requires .net 4.0 - if it does there is another problem