none
VS 2019 Extension project folder cannot be renamed? RRS feed

  • Question

  • I have created a new Vb.Net project with VS2019. The project is created using the VSIX Project template, using "Place Solution and Project in the same directory" as the default. This results in a single directory (call it MyExtensionProject1) that compiles successfully.

    If I close VS, then rename the project's folder (say, to MyExtensionProject2) then load the .sln file back into VS2019, a compile fails with several errors about Types that are not defined, Fields and Properties that are not found, etc.

    This did not happen using VS2017.

    Has something changed in VS2019 to cause this? I would like to know that I can changed the "container" folder name for a project without something breaking.

    Wednesday, May 15, 2019 2:10 PM

Answers

  • Hi Sam,

    Welcome to MSDN forum.

    Sorry for the delay. After renaming the container name, delete the obj folder(necessary) and .vs folder(not necessary) before load the .sin, this issue goes away.

    I've done several tests and let me describe the cause of the issue for you:

    >>This did not happen using VS2017. Has something changed in VS2019 to cause this?

    Actually, if you use VS2017 and use PackageReference format to manage nuget packages, then rename the Solution name outside vs, it will also cause a failed compile.

    (With place solution and project in the same dir enabled, the project name is solution name)

    Description: Every time when I get the same error like you. I observe the nuget packages about VS extension disappears, that's the direct cause of the issue. In my opinion, maybe it's because vs reads some out-of-date value when loading and compiling which messes up the project-system.

    Out-of-date value: When we rename the solution name outside vs, this change is unknown for VS. So some settings will still try to find the original path which now is not available.

    e.g: In obj folder, we can find a projects.asserts.json file, it has content like below:

    project": {
        "version": "1.0.0",
        "restore": {
          "projectUniqueName": "C:\\Users\\Administrator\\source\\repos\\OriginalPath\\OriginalPath.vbproj",
          "projectName": "OriginalPath",
          "projectPath": "C:\\Users\\Administrator\\source\\repos\\OriginalPath\\OriginalPath.vbproj",
          "packagesPath": "C:\\Users\\Administrator\\.nuget\\packages\\",

    When we rename the container name outside vs, the actual path of our project is ...\NewPath\\OriginalPath.vbproj, this situation will cause some compile errors.

    >>I would like to know that I can changed the "container" folder name for a project without something breaking.

    As I mentioned above, this issue is due to VS reads some "out-of-date" value from .vs and obj folder which mess up the settings.

    So as an easy workaround for it:

    After you rename the "container" folder name, delete the .vs and obj folder, and then load the .sln  back into VS2019, the issue goes away. If not, restore the nuget package and rebuild can help.

    Any update please feel free to let me know. If my answer is helpful, a feedback would be expected :)

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, May 17, 2019 3:38 AM

All replies

  • Hi Sam,

    Welcome to MSDN forum.

    Sorry for the delay. After renaming the container name, delete the obj folder(necessary) and .vs folder(not necessary) before load the .sin, this issue goes away.

    I've done several tests and let me describe the cause of the issue for you:

    >>This did not happen using VS2017. Has something changed in VS2019 to cause this?

    Actually, if you use VS2017 and use PackageReference format to manage nuget packages, then rename the Solution name outside vs, it will also cause a failed compile.

    (With place solution and project in the same dir enabled, the project name is solution name)

    Description: Every time when I get the same error like you. I observe the nuget packages about VS extension disappears, that's the direct cause of the issue. In my opinion, maybe it's because vs reads some out-of-date value when loading and compiling which messes up the project-system.

    Out-of-date value: When we rename the solution name outside vs, this change is unknown for VS. So some settings will still try to find the original path which now is not available.

    e.g: In obj folder, we can find a projects.asserts.json file, it has content like below:

    project": {
        "version": "1.0.0",
        "restore": {
          "projectUniqueName": "C:\\Users\\Administrator\\source\\repos\\OriginalPath\\OriginalPath.vbproj",
          "projectName": "OriginalPath",
          "projectPath": "C:\\Users\\Administrator\\source\\repos\\OriginalPath\\OriginalPath.vbproj",
          "packagesPath": "C:\\Users\\Administrator\\.nuget\\packages\\",

    When we rename the container name outside vs, the actual path of our project is ...\NewPath\\OriginalPath.vbproj, this situation will cause some compile errors.

    >>I would like to know that I can changed the "container" folder name for a project without something breaking.

    As I mentioned above, this issue is due to VS reads some "out-of-date" value from .vs and obj folder which mess up the settings.

    So as an easy workaround for it:

    After you rename the "container" folder name, delete the .vs and obj folder, and then load the .sln  back into VS2019, the issue goes away. If not, restore the nuget package and rebuild can help.

    Any update please feel free to let me know. If my answer is helpful, a feedback would be expected :)

    Best Regards

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, May 17, 2019 3:38 AM
  • Thank you, Lance. Deleting the obj and .vs folders cures the issue.

    Monday, May 20, 2019 6:45 PM