【发布时间】:2021-07-06 01:03:00
【问题描述】:
我的项目中有一个用 Visual Basic 制作的自定义 dll,但是当我尝试运行一个函数时,它返回此错误:无法使用 typeref 中的令牌 01000047 解析类型(程序集中的预期类 'Microsoft.VisualBasic.DateAndTime' Microsoft.VisualBasic,版本=10.0.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a')
我有什么遗漏吗?我在所有项目的引用中添加了 dll 并安装了 Visual Basic nuget 包。
代码如下:
string aResult;
string Response;
string ErrorText;
long SelfCareID;
string FullName;
public Api api;
public string loginResponse;
public string registerResponse;
public string createResponse;
public string otpCode;
public SmartMeterVM()
{
api = new Api();
LoginCommand = new Command(LoginTestButton);
}
public Command LoginCommand { get; set; }
public void LoginCheck(UserModel userData)
{
ErrorText = "Something";
SelfCareID = 12389471823749;
FullName = "Some full";
try
{
loginResponse = api.AccUpdate(userData.idNumber, 2, ref SelfCareID, ref FullName, ref ErrorText);
if (loginResponse.ToLower() == "success")
{
UserDialogs.Instance.Alert(loginResponse.ToLower(), "Success", "OK");
}
else
{
UserDialogs.Instance.Alert(ErrorText);
}
}
catch(Exception ex)
{
UserDialogs.Instance.Alert(ex.Message, "Error","Ok");
}
return;
}
public void LoginTestButton()
{
var userTestData = new UserModel
{
idNumber = "01049496"
};
LoginCheck(userTestData);
}
更新:我尝试更新所有 nuget 包,但仍然没有任何变化。是不是不能在 xamarin 中使用 Visual Basic 制作的 dll?
【问题讨论】:
-
尝试清理并重建您的完整解决方案 如果这不起作用;从每个项目文件夹中手动删除 bin 和 obj 文件夹并重建
-
机器上的Net版本和用于构建Visual Basic nuget包的Net版本不一样。您需要重建 nuget 包。
-
@jdweng 如何重建 Visual Basic nuget 包?我的项目正在使用 .Net Standard 2.0
-
是否可以添加库或链接以包含 Microsoft.VisualBasic.DateAndTime?
-
恐怕没有
标签: c# xamarin.forms dll