Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="vs-impl" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json" />
</packageSources>
<packageSourceMapping>
<clear />
Expand Down
15 changes: 15 additions & 0 deletions src/VSIntegration2022.sln
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger2022", "VisualStudi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectPackage2022", "VisualStudio\ProjectPackage\ProjectPackage2022.csproj", "{F4ADEBDB-CD20-4532-B4E3-FE7424F5369D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSharp.ProjectSystem2022", "VisualStudio\ProjectSystem\XSharp.ProjectSystem2022.csproj", "{AB494DCE-A11B-4583-851E-D4A86775B3F0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Vs2022", "Vs2022", "{0D3C69B5-D236-42B3-B70D-2C9ABC9D434C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common", "Common", "{9F285506-97D3-486E-B59E-7C30C56B95AE}"
Expand Down Expand Up @@ -133,6 +135,18 @@ Global
{F4ADEBDB-CD20-4532-B4E3-FE7424F5369D}.Release|arm64.Build.0 = Release|arm64
{F4ADEBDB-CD20-4532-B4E3-FE7424F5369D}.Release|x86.ActiveCfg = Release|x86
{F4ADEBDB-CD20-4532-B4E3-FE7424F5369D}.Release|x86.Build.0 = Release|x86
{AB494DCE-A11B-4583-851E-D4A86775B3F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB494DCE-A11B-4583-851E-D4A86775B3F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB494DCE-A11B-4583-851E-D4A86775B3F0}.Debug|arm64.ActiveCfg = Debug|Any CPU
{AB494DCE-A11B-4583-851E-D4A86775B3F0}.Debug|arm64.Build.0 = Debug|Any CPU
{AB494DCE-A11B-4583-851E-D4A86775B3F0}.Debug|x86.ActiveCfg = Debug|Any CPU
{AB494DCE-A11B-4583-851E-D4A86775B3F0}.Debug|x86.Build.0 = Debug|Any CPU
{AB494DCE-A11B-4583-851E-D4A86775B3F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB494DCE-A11B-4583-851E-D4A86775B3F0}.Release|Any CPU.Build.0 = Release|Any CPU
{AB494DCE-A11B-4583-851E-D4A86775B3F0}.Release|arm64.ActiveCfg = Release|Any CPU
{AB494DCE-A11B-4583-851E-D4A86775B3F0}.Release|arm64.Build.0 = Release|Any CPU
{AB494DCE-A11B-4583-851E-D4A86775B3F0}.Release|x86.ActiveCfg = Release|Any CPU
{AB494DCE-A11B-4583-851E-D4A86775B3F0}.Release|x86.Build.0 = Release|Any CPU
{B837AC3B-9C61-49E4-9F4F-C8AD1FAF21CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B837AC3B-9C61-49E4-9F4F-C8AD1FAF21CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B837AC3B-9C61-49E4-9F4F-C8AD1FAF21CC}.Debug|arm64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -228,6 +242,7 @@ Global
{4484939E-DDA8-4033-8B1C-E8F60A2BAFE1} = {0D3C69B5-D236-42B3-B70D-2C9ABC9D434C}
{16272550-75E6-4B9D-91E3-653BD141C756} = {0D3C69B5-D236-42B3-B70D-2C9ABC9D434C}
{F4ADEBDB-CD20-4532-B4E3-FE7424F5369D} = {0D3C69B5-D236-42B3-B70D-2C9ABC9D434C}
{AB494DCE-A11B-4583-851E-D4A86775B3F0} = {0D3C69B5-D236-42B3-B70D-2C9ABC9D434C}
{B837AC3B-9C61-49E4-9F4F-C8AD1FAF21CC} = {9F285506-97D3-486E-B59E-7C30C56B95AE}
{7619DB88-6286-4EF1-8273-2A08CC8AC70E} = {9F285506-97D3-486E-B59E-7C30C56B95AE}
{EED6843B-B727-4F08-AA32-CA0F48FDDE3F} = {9F285506-97D3-486E-B59E-7C30C56B95AE}
Expand Down
10 changes: 10 additions & 0 deletions src/VisualStudio/ProjectSystem/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Reflection;
using System.Runtime.InteropServices;

// General information
[assembly: AssemblyTitle("XSharp CPS Project System")]
[assembly: AssemblyDescription("CPS-based XSharp project system for Visual Studio 2022 and later")]
[assembly: AssemblyCompany("XSharp B.V.")]
[assembly: AssemblyProduct("XSharp")]
[assembly: AssemblyCopyright("Copyright © XSharp B.V. 2024")]
[assembly: ComVisible(false)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// Copyright (c) XSharp B.V. All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//

using System.ComponentModel.Composition;

using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.ProjectSystem.VS.Properties;

namespace XSharp.VisualStudio.ProjectSystem.PropertyPages
{
/// <summary>
/// CPS property page metadata for the XSharp "Build" page.
///
/// This page surfaces the MSBuild properties defined in
/// <c>Rules/XSharp.xaml</c> under the <c>Build</c> rule category.
/// It mirrors <c>XSharpBuildPropertyPage</c> in the MPF AppDesigner.
/// </summary>
[Export(typeof(IPageMetadata))]
[AppliesTo(XSharpProjectCapabilities.XSharp)]
internal sealed class XSharpBuildPropertyPageProvider : IPageMetadata
{
/// <inheritdoc />
public string Name => "Build";

/// <inheritdoc />
public System.Guid PageGuid =>
new System.Guid(XSharpConstants.BuildPropertiesPage);

/// <inheritdoc />
public int PageOrder => 200;

/// <inheritdoc />
public bool HasConfigurationCondition => true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// Copyright (c) XSharp B.V. All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//

using System.ComponentModel.Composition;

using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.ProjectSystem.VS.Properties;

namespace XSharp.VisualStudio.ProjectSystem.PropertyPages
{
/// <summary>
/// CPS property page metadata for the XSharp "Debug" page.
///
/// This page surfaces the MSBuild properties defined in
/// <c>Rules/XSharp.xaml</c> under the <c>Debug</c> rule category.
/// It mirrors <c>XSharpDebugPropertyPage</c> in the MPF AppDesigner.
/// </summary>
[Export(typeof(IPageMetadata))]
[AppliesTo(XSharpProjectCapabilities.XSharp)]
internal sealed class XSharpDebugPropertyPageProvider : IPageMetadata
{
/// <inheritdoc />
public string Name => "Debug";

/// <inheritdoc />
public System.Guid PageGuid =>
new System.Guid(XSharpConstants.DebugPropertiesPage);

/// <inheritdoc />
public int PageOrder => 300;

/// <inheritdoc />
public bool HasConfigurationCondition => true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// Copyright (c) XSharp B.V. All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//

using System.ComponentModel.Composition;
using System.Runtime.InteropServices;

using Microsoft.VisualStudio.ProjectSystem;
using Microsoft.VisualStudio.ProjectSystem.VS.Properties;
using Microsoft.VisualStudio.Shell;

namespace XSharp.VisualStudio.ProjectSystem.PropertyPages
{
/// <summary>
/// CPS property page metadata for the XSharp "Application" (General) page.
///
/// This page surfaces the MSBuild properties defined in
/// <c>Rules/XSharp.xaml</c> under the <c>Application</c> rule category.
/// It mirrors the information shown by <c>XSharpGeneralPropertyPage</c>
/// in the MPF-based AppDesigner.
/// </summary>
[Export(typeof(IPageMetadata))]
[AppliesTo(XSharpProjectCapabilities.XSharp)]
internal sealed class XSharpGeneralPropertyPageProvider : IPageMetadata
{
/// <inheritdoc />
public string Name => "Application";

/// <inheritdoc />
public System.Guid PageGuid =>
new System.Guid(XSharpConstants.GeneralPropertiesPage);

/// <inheritdoc />
public int PageOrder => 100;

/// <inheritdoc />
public bool HasConfigurationCondition => false;
}
}
66 changes: 66 additions & 0 deletions src/VisualStudio/ProjectSystem/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# XSharp CPS Project System

This folder contains the **CPS-based (Common Project System)** implementation of the XSharp project system for Visual Studio 2022 and later.

## Overview

| Path | Purpose |
|---|---|
| `XSharp.ProjectSystem2022.csproj` | Project file (net472, VS2022 SDK references) |
| `XSharpProjectCapabilities.cs` | CPS capability constants (`XSharp`, `Managed`, `MultipleTargetFrameworks`, …) |
| `XSharpProjectCapabilitiesProvider.cs` | MEF export that advertises capabilities to CPS |
| `XSharpProjectType.cs` | Binds the `.xsproj` extension and project GUID to this CPS project system |
| `XSharpProjectTreePropertiesProvider.cs` | Custom icons for `.xsfrm`, `.xsmnu`, `.prg`, `.xaml`, etc. |
| `XSharpProjectBuildProvider.cs` | Build-property integration + up-to-date check stub |
| `XSharpProjectProperties.cs` | Strongly-typed wrappers around MSBuild project properties |
| `XSharpTargetFrameworkProvider.cs` | Multi-targeting support (VS2022+ only — reads `<TargetFrameworks>`) |
| `XSharpCodeDomIntegration.cs` | Bridge to the existing XSharp CodeDom provider for Windows Forms designer |
| `PropertyPages/*.cs` | CPS `IPageMetadata` exports for Application, Build, and Debug pages |
| `Rules/XSharp.xaml` | MSBuild property rules (XAML format) surfaced in the project designer |
| `Rules/XSharpMultiTarget.xaml` | `TargetFrameworks` rule for multi-targeting (VS2022+ only) |
| `XSharpCpsPackage.cs` | VS AsyncPackage that registers CPS components |
| `XSharpCpsPackage.pkgdef` | Registry entries that activate CPS for `.xsproj` in VS2022+ |

## VS Version Strategy

| Feature | VS2019 | VS2022 / VS2026 |
|---|---|---|
| Project system | **MPF** (`ProjectBase` + `ProjectPackage`) | **CPS** (this assembly) |
| Multi-targeting | ❌ not supported | ✅ via `<TargetFrameworks>` |
| VO binary editors (`.xsfrm`, `.xsmnu`, …) | ✅ | ✅ |
| CodeDom / WinForms designer | ✅ | ✅ |
| Project designer pages | ✅ AppDesigner | ✅ AppDesigner + CPS rules |

The MPF code in `ProjectBase` and `ProjectPackage` is **not modified**. The CPS package activates only in VS2022+ via the `ProjectSystemPackage` registry entry in `XSharpCpsPackage.pkgdef`.

## Multi-Targeting (VS2022+ only)

SDK-style `.xsproj` files can use `<TargetFrameworks>` to target multiple frameworks simultaneously:

```xml
<Project Sdk="XSharp.Net.Sdk">
<PropertyGroup>
<TargetFrameworks>net48;net6.0-windows</TargetFrameworks>
<Dialect>Core</Dialect>
</PropertyGroup>
</Project>
```

> **Note:** The VS2019 / MPF path does **not** support multi-targeting.
> Use a single `<TargetFramework>` value when VS2019 compatibility is required.

## Custom Editors

The VO binary file editors (`.xsfrm`, `.xsmnu`, `.xsdbs`, `.xsfs`) are implemented in the `ProjectPackage` assembly and registered both there (for MPF) and in `XSharpCpsPackage.pkgdef` (for CPS). No code duplication is required — the factory implementations are shared.

## CodeDom / Windows Forms

`XSharpCodeDomIntegration` locates `VSXsharpCodeDomProvider` in the `ProjectPackage` assembly at run-time and exposes it through the MEF `ICodeDomProviderIntegration` interface so the Windows Forms designer can generate XSharp source code in the CPS context.

## Building

This project is included in `src/VSIntegration2022.sln`. It is **not** included in `src/VSIntegration.sln` (VS2019).

```
msbuild src/VSIntegration2022.sln /p:Configuration=Release
```
Loading