Share an Settings.settings file with a visual studio shared project

Ludovic Mainguy 0 Reputation points
2023-01-31T10:19:31.36+00:00

Hi,
We have a VSIX project targeting VS2019 that we updated so it can support VS2022 as well.

The recommended way to do that is to add a shared project with the original code and create two VSIX projects targeting each version of VS that reference the shared project.
It worked fine except for the settings.settings that we are unable to edit through the designer when it is located under the shared project.

The .settings file was put in the shared project by the migration tool and the xml nodes in the projitems file seem to be fine as far as I can tell.
I also can't create a .settings file in the shared project properties.

Is there a way to share .settings with a shared project ? Right now the only solution I have is to edit every file by hand, including the generated settings.designer.cs file.

Thank you
Ludovic

Developer technologies | Visual Studio | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,441 Reputation points Microsoft External Staff
    2023-02-07T07:56:49.4833333+00:00

    Hi Ludovic,

    I can reproduce this issue. Since the .settings file can’t be created directly in a shared project, the designer view may be also not supported. But the error seems to be strange, as it says '.NETCore,Version=v4.5.1'. As you know, there’s .NET Framework 4.5.1 or .NET Core 3.1 but there’s no .NET Core 4.5.1. I have submitted a ticket on our Developer Community, here’s the link: Share a .settings file with a shared project, please kindly follow up that thread.

    Currently, I think, no workarounds for shared project, but is "Add As Link" feature acceptable maybe(Right-click the project > Add > Existing Item… > select the .Settings file > click to choose Add As Link)?  

    Best Regards,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.