C# Project Template File Uses Wrong Paths

Jeff Gaines 351 Reputation points
2023-12-10T15:07:44.05+00:00
In VS 2022 I am trying to create a C# Winforms project file that contains the references I frequently use and links to files I regularly use.

My base project directory is D:\Data\Visual Studio 2022\Projects

When I create a new project based on the template the path of the linked file has been changed. Unzipping the template and examining the contents shows:

JGBaseProject.csproj contains the correct path: 

 

<Compile Include="..\..\_Common\JGLibrary\JGLibrary\Source\_Base\JBaseForm.cs"> 

      <Link>Links\JGLibrary\JBaseForm.cs</Link> 

      <SubType>Form</SubType> 

    </Compile> 

MyTemplate.vstemplate has no paths in it. 

 

But when creating a project from the template the reference is to: 

 

C:\Temp\VsTempFiles\_Common\JGLibrary\JGLibrary\Source\_Base\JBaseForm.cs 

Is there anything I can do to correct this? The concept is excellent but only if it works!


Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,415 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 32,861 Reputation points Microsoft Vendor
    2023-12-18T09:31:49.2433333+00:00

    Hi @Jeff Gaines ,

    I understand. I still remember this issue: Visual Studio 2022 links to files. It’s still under investigation, so it’s possible that there is something wrong with "link to files".

    I have submitted another ticket about current issue, here’s the link: C# Project Template File Uses Wrong Paths(Link to files). You can follow up that ticket and get any latest information and progress there.

    Kind Regards,

    Tianyu


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.