microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
220 stars 10 forks source link

Can't generate .csproj for player projects #763

Open Merichbier opened 9 months ago

Merichbier commented 9 months ago

Type: Bug

Currently it seems impossible to toggle the generation of player projects file. This is usefull when developing for platform where we need to write native code, like for HoloLens 2.

In Visual Studio we have the possibility to switch the code analysis between project and player (editor / platform) which allows compilation checks for the platform. image image

Reproduction steps :

Actual:

Expected:

Extension version: 0.9.3 VS Code version: Code 1.84.2 (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e, 2023-11-09T10:51:52.184Z) OS version: Windows_NT x64 10.0.22621 Modes:

System Info |Item|Value| |---|---| |CPUs|12th Gen Intel(R) Core(TM) i9-12900H (20 x 2918)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.68GB (9.13GB free)| |Process Argv|C:\\git-repos\\some-repo --crash-reporter-id fc47f6da-83c7-43c9-b339-54ad6c91ce78| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vslsvsres303:30308271 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263cf:30335440 vscoreces:30445986 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 pythonvs932:30410667 py29gd2263:30880072 vsclangdc:30486549 c4g48928:30535728 dsvsc012:30540252 pynewext54:30695312 azure-dev_surveyone:30548225 282f8724:30602487 f6dab269:30613381 showlangstatbar:30737416 pythonfmttext:30731395 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 welcomedialog:30887143 pythonnosmt12:30797651 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 dsvsc013:30795093 dsvsc014:30804076 dsvsc015:30845448 pythontestfixt:30871694 pythonregdiag2:30871582 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 2e7ec940:30885897 pythontbext0:30879054 accentitlementsc:30887149 dsvsc016:30886110 dsvsc017:30886112 dsvsc018:30886114 aa_t_chat:30882232 ```
dibarbet commented 9 months ago

@jbevain is this expected to be supported? How do these player projects work? Is the .cs file shared between multiple projects - or is there a separate .cs file for each project?

If these projects required shared files - then assuming the project generation happens, we'd still need to implement https://github.com/dotnet/vscode-csharp/issues/5788 to allow you to switch between different contexts.

jbevain commented 9 months ago

Hi @dibarbet, at the moment we're not supporting this because there's no way to switch between different contexts :)

Basically today we generate project files to represent what Unity is compiling for the Unity Editor.

Having Player projects allows you in VS to be able to select the project context to represent what Unity is compiling when building a Player for a target platform, so you can get a different editor experience based on ifdef or references for instance.

dibarbet commented 9 months ago

Basically today we generate project files to represent what Unity is compiling for the Unity Editor.

Having Player projects allows you in VS to be able to select the project context to represent what Unity is compiling when building a Player for a target platform, so you can get a different editor experience based on ifdef or references for instance.

How does this work in VS - is the project generated with a linked file reference to the same .cs file? If so we can mark this as blocked on Roslyn support for project contexts.

jbevain commented 9 months ago

Yes, there are N different csprojs with a different set of defines and references that are referencing the same .cs file.

dibarbet commented 9 months ago

Got it, blocked on https://github.com/dotnet/vscode-csharp/issues/5788 then

Merichbier commented 9 months ago

Amazing, thanks for the check and extra information!