Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Can't import DSC resources in dotnet core #4493

Copy link
Copy link
@erwinwildenburg

Description

@erwinwildenburg
Issue body actions

When trying to build a configuration in a dotnet core application, I can't get it to import the required modules.

Running the following script in a PSCore console works but when running it in a dotnet application it can't find the module:

Configuration Test {
	Import-DscResource -ModuleName PolicyFileEditor
}

Running the following command in the dotnet core application works perfectly, so the problem seems to be limited the the dsc resources:
Import-Module PolicyFileEditor

Steps to reproduce

using (PowerShell ps = PowerShell.Create())
{
	string configScript = "Configuration Test { Import-DscResource -ModuleName PolicyFileEditor }";
	ps.AddScript(configScript);
	ps.Invoke();
}

Expected behavior

The DSC module is imported

Actual behavior

At line:2 char:1
+ Import-DscResource -ModuleName PolicyFileEditor
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Could not find the module 'PolicyFileEditor'.

Environment data

Name                           Value
----                           -----
PSVersion                      6.0.0-beta
PSEdition                      Core
GitCommitId                    v6.0.0-beta.4
OS                             Microsoft Windows 10.0.15063
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-DSCDesired State Configuration issuesDesired State Configuration issuesResolution-FixedThe issue is fixed.The issue is fixed.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.