这是一个经典问题,其中描述了许多解决方案.但是,它们似乎都不适合我.
我在SharePoint解决方案中使用Report.NET库.添加Reports.dll作为参考并在错误消息中编译结果"程序集生成失败 - 参考程序集'报告'没有强名称." 但是,我的项目在项目属性中链接了一个key.snk.所以我尝试用这个密钥文件反汇编,签名和重新组装dll,如别处所述:
C:\Users\Administrator\Documents\Visual Studio 2010\Projects\MyProj
\dll>ildasm Reports.dll /out:Reports.il
C:\Users\Administrator\Documents\Visual Studio 2010\Projects\MyProj
\dll>ilasm Reports.il /dll /resource=Reports.res /key=..\key.snk
<output removed for brevity>
Class 95
Class 96
Method Implementations (total): 1
Resolving local member refs: 0 -> 0 defs, 0 refs, 0 unresolved
Writing PE file
Signing file with strong name
Operation completed successfully
Run Code Online (Sandbox Code Playgroud)
我最终得到了一个新的Reports.dll时间戳.但是,将此作为对项目和构建的引用添加,会提供与以前相同的错误消息."Reports"引用的属性显示"强名称:False".
不要因为有点麻烦而气馁,我尝试使用强命名实用程序重新签名程序集:
C:\Users\Administrator\Documents\Visual Studio 2010\Projects\MyProj
\dll>sn -R Reports.dll ..\key.snk
Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All …Run Code Online (Sandbox Code Playgroud) 我有一个WPF应用程序,它使用一些库代码进行身份验证,需要在单线程单元线程中运行.我的方法是生成一个单独的线程来获取身份验证对象,阻塞直到线程返回然后继续执行.但是,在某些情况下,我的应用程序挂起在Thread.Join()上,即使线程方法已返回.
public static ClaimsAuthenticationResult GetClientContextAndCookieCollection(string siteUrl, out CookieCollection cookieResult)
{
ClaimsAuthenticationResult authResult = new ClaimsAuthenticationResult();
// Authentication module needs to run in single-thread apartment state because it uses
// COM library calls where this is required
Thread authenticationThread = new Thread(new ThreadStart(threadMethod));
authenticationThread.SetApartmentState(ApartmentState.STA);
authenticationThread.Start();
// Block until thread completion
authenticationThread.Join(); // Application hangs here
return authResult;
}
private static void threadMethod() {
// In proper application: set result. But for debugging, return immediately
return;
}
Run Code Online (Sandbox Code Playgroud)
我是mulththreading和WPF的新手,所以我可能会做一些愚蠢的事情.有谁看到这里发生了什么?为了记录,如果我没有将线程设置为STA,我不会遇到问题,但这是一个要求.
[编辑:似乎只有当我通过WPF视图中的验证绑定调用指定的方法时才会出现错误,特别是在TextBox上.当我在视图的构造函数中调用相同的代码时,代码按预期运行.这将是一个可行的解决方法,但知道这里实际发生了什么会很有趣.
[编辑:此处的代码已经简化了一些调试 …
我已经使用了Xamarin的自包含的Windows安装程序在这里,但是我有一个要求,我知道的装机是Xamarin的特定版本的问题.我如何找到这些信息?(请注意,我正在寻找Visual Studio插件的版本,而不是 Xamarin Studio).