[Runtime.interopservices.marshal] :: getactiveObject Обходной путь для .NET CoreC#

Место общения программистов C#
Ответить Пред. темаСлед. тема
Anonymous
 [Runtime.interopservices.marshal] :: getactiveObject Обходной путь для .NET Core

Сообщение Anonymous »

Вышеуказанное не работает для меня в PS 7 (из -за ядра .NET).
Я наткнулся на различные решения для этого по сети, например,
One. Тем не менее, я не могу заставить их работать.
Я сохраняю код C# в файл .cs и когда я запускаю Add-Type в PS, с путем к файлу .cs, я получаю много ошибок, таких как Следующее: < /p>

Код: Выделить всё

    Add-Type: (51,6): error CS0246: The type or namespace name 'ResourceExposureAttribute' could not be found (are you missing a using directive or an assembly reference?)
[ResourceExposure(ResourceScope.None)]
^
Add-Type: (51,6): error CS0246: The type or namespace name 'ResourceExposure' could not be found (are you missing a using directive or an assembly reference?)
[ResourceExposure(ResourceScope.None)]
^
Add-Type: (52,6): error CS0246: The type or namespace name 'SuppressUnmanagedCodeSecurityAttribute' could not be found (are you missing a using directive or an assembly reference?)
[SuppressUnmanagedCodeSecurity]
^
Add-Type: (52,6): error CS0246: The type or namespace name 'SuppressUnmanagedCodeSecurity' could not be found (are you missing a using directive or an assembly reference?)
[SuppressUnmanagedCodeSecurity]
^
Add-Type: (51,23): error CS0103: The name 'ResourceScope' does not exist in the current context
[ResourceExposure(ResourceScope.None)]
^
Add-Type: (37,6): error CS0246: The type or namespace name 'ResourceExposureAttribute' could not be found (are you missing a using directive or an assembly reference?)
[ResourceExposure(ResourceScope.None)]
^
Add-Type: (37,6): error CS0246: The type or namespace name 'ResourceExposure' could not be found (are you missing a using directive or an assembly reference?)
[ResourceExposure(ResourceScope.None)]
^
Add-Type: (38,6): error CS0246: The type or namespace name 'SuppressUnmanagedCodeSecurityAttribute' could not be found (are you missing a using directive or an assembly reference?)
[SuppressUnmanagedCodeSecurity]
Я думаю, что что -то упускаю в процессе импорта классов C# в PS.

Подробнее здесь: https://stackoverflow.com/questions/794 ... r-net-core
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • [Runtime.interopservices.marshal] :: getactiveObject Обходной путь для .NET Core
    Anonymous » » в форуме C#
    0 Ответы
    11 Просмотры
    Последнее сообщение Anonymous
  • [Runtime.interopservices.marshal] :: GetactiveObject Обходной путь для .NET Core [закрыто]
    Anonymous » » в форуме C#
    0 Ответы
    10 Просмотры
    Последнее сообщение Anonymous
  • Как использовать Marshal.getActiveObject(), чтобы получить 2 экземпляра запущенного процесса, в котором открыты два проц
    Anonymous » » в форуме C#
    0 Ответы
    12 Просмотры
    Последнее сообщение Anonymous
  • .net maui System.Runtime.InterOpservices.comexception при добавлении данных в ObservableCollection
    Anonymous » » в форуме C#
    0 Ответы
    4 Просмотры
    Последнее сообщение Anonymous
  • System.Runtime.InteropServices.COMException "
    Anonymous » » в форуме C#
    0 Ответы
    18 Просмотры
    Последнее сообщение Anonymous

Вернуться в «C#»