Setting Up Powershell In Visual Studio For Mac

Over the years, PowerShell developers have used tools like Quest PowerGUI and Visual Studio with the PowerShell Tools Extension to write, test, and debug their PowerShell code. In fact, not all that long ago, I wrote about moving from PowerGUI over to Visual Studio for your PowerShell development work. A brief introduction of Powershell for everyone. In this video I have discusses and showed Powershell for Mac. Used Visual Studio Code to write powershell script and debug the. In a blog post on November 16th 2015 Microsoft announced PowerShell support in Visual Studio Code.And as it befits the “new” Microsoft, this PowerShell extension for Visual Studio Code (VSC) was placed on GitHub. Setting up Visual Studio Code as your primary PowerShell editor is a cinch. You can make your setup as simple or as custom as you want and there is a combination of settings to make anyone happy. Wednesday, November 21, 2018. As of Visual Studio Code version 1.9 you can debug PowerShell scripts without having to open the folder containing the PowerShell script. Simply open the PowerShell script file with File->Open File., set a breakpoint on a line (press F9) and then press F5 to start debugging. However, it is PowerShell Core designed to run cross-platform on Windows, Mac, and Linux. PowerShell Core runs on top of.NET Core, a cross-platform, open-source version of the code base powering most of the Windows world. As you can see in the Default Settings tab of the editor on the left, lots of areas of Visual Studio Code can be customized, including extensions like PowerShell. The editor on the left provides the “default” settings and is read-only.

Viewed 68 times

I want to make #PowerShell the default language in Visual Studio Code on Mac 1.24.1 so that after I enter ⌘N I can immediately start typing PowerShell code and have all the parsing and completion and syntax highlighting work.

Under 'User Settings' I did this:

I then exited and restarted Visual Studio Code.

I then tried ⌘N and typed $ps and pressed the tab key. I got a tab. No completion. No highlighting.

What did I do wrong?

I'm a complete newb with Visual Studio Code so any advice is appreciated.

Gama11
15.6k6 gold badges33 silver badges53 bronze badges
chrischris
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Mac

Browse other questions tagged powershellvisual-studio-codevscode-settings or ask your own question.

AEM forms provides the complete source code of the AEM forms app. The source contains all components to build a custom workspace application. The source code archive, adobe-lc-mobileworkspace-src-<version>.zip, is installed along with AEM forms JEE. The default location of the adobe-lc-mobileworkspace-src-<version>.zip is [AEM_forms_root]sdkLC Mobile Workspace.

The following image displays the extracted contents of the adobe-lc-mobileworkspace-src-<version>.zip.

The following image displays the directory structure of the windows folder in the src folder.

For Windows devices, you need:

  • Microsoft Windows 8.1 or Windows 10
  • Microsoft Visual Studio 2015
  • Microsoft Visual Studio Tools for Apache Cordova

Setting up Visual Studio Project for AEM forms app

Perform the following steps to set up the AEM forms app project in Visual Studio.

  1. Copy the adobe-lc-mobileworkspace-src-<version>.zip archive to %HOMEPATH%Projects folder in the Windows 8.1 or Windows 10 device with Visual Studio 2015 installed and configured.

  2. Extract the archive in the %HOMEPATH%ProjectsMobileWorkspace directory.

  3. Navigate to the %HOMEPATH%ProjectsMobileWorkspacesrcwindows directory.

  4. Open the MWSWindows.sln file using Visual Studio 2015.

  5. In the Plugins Window, navigate to the Custom tab. In this window, select Local method to retrieve the plug-in.

  6. Click Browse and select %HOMEPATH%ProjectsMobileWorkspacesrcwindowsMWSWindowsADReachability.

  7. Click Add that appears on the right tab to add the plug-in.

  8. Repeat steps 8 and 9 for the following plug-ins:

    • %HOMEPATH%ProjectsMobileWorkspacesrcwindows
      MWSWindowsChildBrowser
    • %HOMEPATH%ProjectsMobileWorkspacesrcwindows
      MWSWindowsFormUtility
    • %HOMEPATH%ProjectsMobileWorkspacesrcwindows
      MWSWindowsNativeUtils
    • %HOMEPATH%ProjectsMobileWorkspacesrcwindows
      MWSWindowsWindowsAccountManager
    • %HOMEPATH%ProjectsMobileWorkspacesrcwindows
      MWSWindowsTaskPinPlugin
    • %HOMEPATH%ProjectsMobileWorkspacesrcwindows
      MWSWindowsCordovaPluginscordova-plugin-camera
    • %HOMEPATH%ProjectsMobileWorkspacesrcwindows
      MWSWindowsCordovaPluginscordova-plugin-file
    • %HOMEPATH%ProjectsMobileWorkspacesrcwindows
      MWSWindowsCordovaPluginscordova-plugin-file-transfer
    • %HOMEPATH%ProjectsMobileWorkspacesrcwindows
      MWSWindowsCordovaPluginscordova-plugin-websql

    Note:

    Do not insert a space in the complete path mentioned, as it stops you from adding a plug-in.

  9. In the Visual Studio Solution Explorer, navigate to the MWSWindowsplugins folder and verify that folders are created for the plug-ins added above.

Perform the following steps to build and deploy AEM forms app.

Note:

Data stored on Windows file system for AEM forms app is not encrypted. It is recommended that you use a third-party tool like Windows BitLocker Drive Encryption to encrypt disk data.

  1. In the Visual Studio Standard Toolbar, select Release from the drop-down for build mode.

  2. Select Windows-AnyCPU, Windows-x64, or Windows-x86 based on your platform. Windows-AnyCPU is recommended.

  3. In the Visual Studio Solution Explorer, select the project MWSWindows, right-click on the project, and select build option.

    The CordovaApp.Windows_1.0.0.0_anycpu.appx installer file is created in the platformswindowsAppPackagesCordovaApp.Windows_1.0.0.0_anycpu_Test directory.

  4. After the project is built, you can install the app using:

    • Windows PowerShell
    • Visual Studio

    The .appx package requires the following items to install successfully:

    1. WinJS library
    2. Ensure that the package comes with a self-signed certificate, or a trusted authority signed public certificate such as VeriSign.
    3. Developer license

    The directory PlatformswindowsAppPackagesCordovaApp.Windows_1.0.0.0_anycpu_Test contains the four main components in it:

    1. .appx file
    2. Certificate (Currently it is a self-signed certificate by Apache Cordova)
    3. Dependency folder
    4. PowerShell file (.ps1 extension)

There are two ways to install the application on a Windows device.

  1. Right-click on the PowerShell file (Add-AppDevPackage.ps1), and choose Run with PowerShell.
  2. The setup prompts you to get a developer license. Use Microsoft account credentials to acquire developer license.
    This license is valid for 30 days, and you can renew it for free.
  3. When you acquire the developer license, the setup installs the self-signed certificate on the system and application installs successfully.

For enterprise owned devices that are joined to the domain of the enterprise, acquiring a developer license is not required.

Enterprise owned devices use Professional and Enterprise editions of Windows.

Microsoft recommends that you install a trusted authority issued public certificate such as VeriSign.

To deploy the app:

  • Ensure that the device is joined to the domain of the enterprise.
  • Enable group policy setting.

To enable group policy setting:

Power Shell In Visual Studio 2017

  1. In your device, run gpedit.msc.
  2. Navigate to Computer Configuration > Administrative Templates > Windows Component > App Package Deployment.
  3. Right-click on Allow all trusted apps to install.
  4. Click Edit and select Enabled.
  5. Click OK.

Edit the Visual Studio generated PowerShell script to stop it from acquiring developer license.

In the PowerShell script, set the variable: $NeedDeveloperLicense = $false.

For devices that are not domain-joined, side-loading product activation key is required. You can purchase it from a Windows reseller.

For Windows 8.1 Home edition, there is no group policy, the enterprise side-loading is not allowed, and you cannot join it with the enterprise domain. Deploy the app on a Windows 8.1 Home Edition device using developer license.

For more information, click here.

To install the app on Windows using Visual Studio:

  1. Connect the device using remote debugger.
    For more information, see Run Windows Store apps on a remote machine.
  2. With your app open in Visual Studio, choose Windows-x64, Windows-x86, or Windows-AnyCPU from the Solution Platforms list, and select Remote Machine.
  3. Your app is deployed on the remote machine.

If you use Visual Studio to build the Windows app, your build can fail. Your build fails because Visual Studio fails to acquire certificates for the latest version.

Visual Studio For Mac Download

When the build fails, you see the error shown below.


Visual Studio Community For Mac

If your build has failed because of the issue described above, perform the following steps before you build your app again:

  1. Open MWSWindows.sln in Visual Studio.
  2. In the project, open config.xml using designer.
    Use Shift+F7 keys together on your keyboard to open the file in designer.
  3. Click Platforms.
  4. In the Platforms screen, if the Cordova CLI version is 5.0.0, change it to 5.1.1.

Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Microsoft Visual Studio For Mac

Legal Notices | Online Privacy Policy