none
.NET - Project Reference works fine but Package Reference fails RRS feed

  • Question

  • Hi,

    We have several projects as part of the single solution file and the projects reference other projects in the same solution through the "ProjectReference" in the csproj file. So, lets say there are 3 projects; A, B and C. B is referencing C and A is referencing both B and C using project reference.

    We wanted to introduce Package Reference instead of Project Reference. So, we used "dotnet pack" to package all the above 3 projects (A,B and C) so that they can be used as package reference for another project, D which was previously referencing them through Project Reference. The package is created and stored in the TFS Package URL. Ideally, this should work as we are referencing the same project using package reference which was previously referenced as project reference.

    So, the only change to the CSPROJ file is as below:

    <ItemGroup>
        <PackageReference Include="packageName" Version="1.0.0" />

    </ItemGroup>

    The project reference for the same is removed from the CSPROJ file.

    While building the project D (which is referencing the packages) we are getting the below error.

    "The type or namespace name 'someClass/someFolder' does not exist in the namespace 'someProject(A/B/C)' (are you missing an assembly reference?)"

    The packages were built with no arguments so the project would have been first built and then packaged.

    I am not sure what are we missing here and why is it not able to find the assembly. Any insight/guidance will be highly appreciated.

    Thank you.

    Tuesday, September 22, 2020 7:12 PM

Answers

  • AnanyoBAzDOps,

    You use the word "project" several times but I don't see anything else in your post that relates to Microsoft Project, a project management application, but, that is the sole focus of this forum. If you are referring to customizing and programming Microsoft Project, then hopefully someone will step in and offer help. Otherwise, I suggest you re-post to the following:https://social.technet.microsoft.com/Forums/en-US/home?forum=whatforum

    John

    Tuesday, September 22, 2020 7:54 PM

All replies

  • AnanyoBAzDOps,

    You use the word "project" several times but I don't see anything else in your post that relates to Microsoft Project, a project management application, but, that is the sole focus of this forum. If you are referring to customizing and programming Microsoft Project, then hopefully someone will step in and offer help. Otherwise, I suggest you re-post to the following:https://social.technet.microsoft.com/Forums/en-US/home?forum=whatforum

    John

    Tuesday, September 22, 2020 7:54 PM
  • Hi,

    I had originally posted in the "whatforum" and was guided to this forum from there.

    The project am referring to is for .NET framework and C# projects which are in the format of .CSPROJ files. May be this is not the right forum for .NET. Request you to kindly guide me if the specific forum is known.

    Thank you.

    Wednesday, September 23, 2020 12:05 PM
  • AnanyoBAzDOps,

    Try this forum for C#:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=csharpgeneral

    or this one for C# and ASP.NET:

    https://www.c-sharpcorner.com/forums/

    John

    Wednesday, September 23, 2020 4:28 PM