[英]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.