Adding source code to asp.net core project

Is there any way to add Service Stack source code to an existing asp.net core project based off the default template?

I am using the provided .pdb files to debug and I can step into a method and select the file but I am unable to get it to hit certain breakpoints such as AutoQueryFeature.Register(). I’d like to be able to just set breakpoints wherever I like in the source so having the full source as part of my solution would be best I think.

I have downloaded source and checked out 5.4. Then in my project I create folder and go to add existing project then select the ServiceStack.sln and it imports all of the projects into the folder.

I run restore but it fails to compile. I have tried manually referencing each service stack project from my default project and just referencing main ServiceStack project but no matter what I do it is always failing to build.

These are the build errors:

E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\ServiceStack.WebHost.IntegrationTests\ServiceStack.WebHost.IntegrationTests.csproj(342,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.402\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\ServiceStack.Auth.Tests\ServiceStack.Auth.Tests.csproj(152,3): error MSB4019: The imported project "E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\.nuget\NuGet.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\ServiceStack.RazorHostTests\ServiceStack.RazorHostTests.csproj(206,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.402\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\RazorRockstars.Console.Files\RazorRockstars.Console.Files.csproj(419,3): error MSB4019: The imported project "E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\.nuget\NuGet.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\RazorRockstars.Web\RazorRockstars.Web.csproj(225,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.402\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\ServiceStack.Mvc.Tests\ServiceStack.Mvc.Tests.csproj(92,3): error MSB4019: The imported project "E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\.nuget\NuGet.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\ServiceStack.AuthWeb.Tests\ServiceStack.AuthWeb.Tests.csproj(243,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.402\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
MyServices.cs(5,20): error CS0234: The type or namespace name 'Templates' does not exist in the namespace 'ServiceStack' (are you missing an assembly reference?) [E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\WithSourceTest.ServiceInterface\WithSourceTest.ServiceInterface.csproj]
MyServices.cs(18,31): error CS0246: The type or namespace name 'Service' could not be found (are you missing a using directive or an assembly reference?) [E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\WithSourceTest.ServiceInterface\WithSourceTest.ServiceInterface.csproj]
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\CheckWeb\CheckWeb.csproj(240,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.402\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\RazorRockstars.Web.Tests\RazorRockstars.Web.Tests.csproj(103,5): error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\\.nuget\NuGet.targets.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\CheckMvc\CheckMvc.csproj(240,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.402\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\ServiceStack.OpenApi.Tests\ServiceStack.OpenApi.Tests.csproj(274,3): error MSB4019: The imported project "E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\.nuget\NuGet.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\ServiceStack.WebHost.IntegrationTests\ServiceStack.WebHost.IntegrationTests.csproj(342,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.402\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\ServiceStack.Auth.Tests\ServiceStack.Auth.Tests.csproj(152,3): error MSB4019: The imported project "E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\.nuget\NuGet.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\ServiceStack.RazorHostTests\ServiceStack.RazorHostTests.csproj(206,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.402\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\RazorRockstars.Console.Files\RazorRockstars.Console.Files.csproj(419,3): error MSB4019: The imported project "E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\.nuget\NuGet.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\RazorRockstars.Web\RazorRockstars.Web.csproj(225,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.402\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\ServiceStack.Mvc.Tests\ServiceStack.Mvc.Tests.csproj(92,3): error MSB4019: The imported project "E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\.nuget\NuGet.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\ServiceStack.AuthWeb.Tests\ServiceStack.AuthWeb.Tests.csproj(243,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.402\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
MyServices.cs(5,20): error CS0234: The type or namespace name 'Templates' does not exist in the namespace 'ServiceStack' (are you missing an assembly reference?) [E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\WithSourceTest.ServiceInterface\WithSourceTest.ServiceInterface.csproj]
MyServices.cs(18,31): error CS0246: The type or namespace name 'Service' could not be found (are you missing a using directive or an assembly reference?) [E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\WithSourceTest.ServiceInterface\WithSourceTest.ServiceInterface.csproj]
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\CheckWeb\CheckWeb.csproj(240,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.402\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\RazorRockstars.Web.Tests\RazorRockstars.Web.Tests.csproj(103,5): error : This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\\.nuget\NuGet.targets.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\CheckMvc\CheckMvc.csproj(240,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.402\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
E:\Projects\ServiceStackSource\WithSourceTest\ServiceStack\tests\ServiceStack.OpenApi.Tests\ServiceStack.OpenApi.Tests.csproj(274,3): error MSB4019: The imported project "E:\Projects\ServiceStackSource\WithSourceTest\WithSourceTest\.nuget\NuGet.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

I know this is outside the realms of normal support but any help you can provide is greatly appreciated.

To reproduce issue you can clone repo and service stack into same folder:

mkdir test
cd test
git clone https://github.com/ServiceStack/ServiceStack
cd ServiceStack
git checkout v5.4
cd ..
git clone https://github.com/GuerrillaCoder/WithSourceTest
cd WithSourceTest
dotnet restore
dotnet build

The weird thing is that when I checked just now the first build actully completed without errors but then I tried to run and the errors appeared and then subsequent build attempts failed. Not really sure what is going on.

I googled the vaious errors and found issues related to .net core not supporting dependency chains and some reported bugs with older version of sdk but nothing that really matched exactly or had solution.

Any ideas?

Don’t check out master, checkout a published release:

isn’t git checkout v5.4 the release?

It builds when i open it’s sln but doent when I try to add it to existing project.

You would also need to add every project and dependency each project references in the same solution.

I have done this. Did you look at the repo?

What repo? Referencing all referenced projects and dependencies in the solution does work (if it’s not already clear: you need to manually add each project to the same solution), I do this every single time someone sends in a repro which is the only approach I use to debug from source. An example .NET Core project where I often switch to source to, is in the commented project references from:

I have nothing else to add. If you still can’t get it to work you can try referencing the pdb’s of each release published on:

If you still can’t get it to work consider it unsupported.

The one I linked in the first question. I think we have been talking at cross purposes as I don’t think you read my first post to the end. If you had you would have seen that I had checked out v5.4 and also made a repo that has the sln file in it so you can see exactly how I added it. Not sure how I could have been any clearer. Here is copy paste from first post:

To reproduce issue you can clone repo and service stack into same folder:

mkdir test
cd test
git clone GitHub - ServiceStack/ServiceStack: Thoughtfully architected, obscenely fast, thoroughly enjoyable web services for all
cd ServiceStack
git checkout v5.4
cd …
git clone GitHub - GuerrillaCoder/WithSourceTest: testing adding source
cd WithSourceTest
dotnet restore
dotnet build

If you have nothing else to add that is fine, I appreciate the responses even though they show you didn’t read my post :stuck_out_tongue: .

What is dumping projects together supposed to do? You need to manually reference the projects (I.e. see the commented ProjectReferences in my link above) as I’ve continually kept saying and can’t be anymore clearer than I already have.

1 Like

Oh man my apologies, I was the one not reading things right. I am a bit slow and misunderstood what you were saying. I have got it building now. I thought adding existing project and then using VS2017 option to add project reference would work. Didn’t realise I had to manually change the path. Sorry to be a pain and thank you again, I was trying to figure that out for a while.

1 Like