简体   繁体   English

切换到Windows 8需要以管理员身份运行Visual Studio来生成dll

[英]Switching to Windows 8 requires running Visual Studio as administrator for generating dll

I have a Visual Studio 2010 C# class library project that produces DLL. 我有一个生成DLL的Visual Studio 2010 C#类库项目。 After switching from Windows 7 to Windows 8 I started getting the error: 从Windows 7切换到Windows 8后,我开始出现错误:

Cannot register assembly "C:\\Users\\Almeesoft User\\Dropbox\\code\\hysysintegration\\HysysMembraneExtension\\Almeesoft.HysysMembraneExtension\\bin\\Release\\Almeesoft.HysysMembraneExtension.dll" - access denied. 无法注册程序集“ C:\\ Users \\ Almeesoft用户\\ Dropbox \\代码\\ hysysintegration \\ HysysMembraneExtension \\ bin \\ Release \\ Almeesoft.HysysMembraneExtension.dll”-访问被拒绝。 Please make sure you're running the application as administrator. 请确保您以管理员身份运行该应用程序。 Access to the registry key 'HKEY_CLASSES_ROOT\\CLSID{0C1B5FDB-7C22-3FF9-B6B0-645C2E72D934}' is denied 拒绝访问注册表项'HKEY_CLASSES_ROOT \\ CLSID {0C1B5FDB-7C22-3FF9-B6B0-645C2E72D934}'

Changing UAC and folders permissions did not help. 更改UAC和文件夹权限无济于事。 The only thing that helped was running Visual Studio as administrator. 唯一有帮助的是以管理员身份运行Visual Studio。 Are there any other methods? 还有其他方法吗?

That's not new for Windows 8, allowing MSBuild to register a [ComVisible] assembly requires elevation since Vista. 对于Windows 8而言,这并不是什么新鲜事,因为Vista允许MSBuild注册[ComVisible]程序集需要提升。 Since it writes registry keys that are protected by UAC. 由于它写入受UAC保护的注册表项。 Perhaps you had a desktop shortcut before that launched VS with admin privileges. 在启动具有管理员权限的VS之前,也许您有一个桌面快捷方式。 Which is what it takes. 这是需要的。

You can do it by hand by unticking the "Register for COM interop" option and running Regasm.exe from an elevated command prompt. 您可以通过取消选中“注册COM互操作”选项并从提升的命令提示符下运行Regasm.exe来手动完成此操作。 Use the /codebase and /tlb options. 使用/ codebase和/ tlb选项。 If you apply the [Guid] attribute to the interop interfaces and classes then this only needs to be done once. 如果将[Guid]属性应用于互操作接口和类,则只需执行一次。 It is dangerous, you should remove them again and rebuild before you ship the assembly or you'll risk DLL Hell. 这样做很危险,您应在装运部件之前再次将其删除并重新构建,否则将冒DLL地狱的危险。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio需要Windows 10吗? - Visual Studio requires windows 10? 如何避免以管理员身份运行Visual Studio或测试代理 - How to avoid running Visual studio or Test Agent as administrator Visual Studio 2019 SSDT 项目 SQLCLR 签名未生成签名的 DLL - Visual Studio 2019 SSDT project SQLCLR signing not generating signed DLL “Visual Studio 需要更新版本的 Windows 才能显示此内容。” - "Visual Studio requires a newer version of Windows to display this content." 从 Visual Studio 发布后,WPF APP 不会运行,但会以管理员身份运行 - WPF APP won't be running after publishing from Visual Studio but would be running with administrator 在 Visual Studio Windows 窗体中运行 CMD 代码 - Running CMD code in Visual Studio Windows Form 在管理员帐户中运行Visual Studio时无法触发拖放事件 - Drag and drop event can not be fired when running visual studio in Administrator account 在Visual Studio 2015 Update 3中生成Windows 10构建时出错 - Error while Generating Windows 10 Build in Visual Studio 2015 Update 3 在Unity中运行的外部DLL的行为与在Visual Studio中运行的行为不同 - External DLL running in Unity behaves differently then when run in Visual Studio 在 Visual Studio 中生成服务 - Generating service in Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM