I have this yaml pipeline in Azure DevOps:
variables:
solution: 'fph.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- xxxx
- task: VSBuild#1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /t:FPH_Api\FPH_Api_csproj;Rebuild'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
The solution contain multiple projects and I am hoping that by providing DesktopBuildPackageLocation parameter and target parameter FPH_Api\FPH_Api_csproj;Rebuild, VSBuild will rebuild my web api project (so will rebuild other referenced projects as well) and then automatically zip the build into webapp.zip.
However, I got this error:
FPH_Api\FPH_Api_csproj" does not exist in the project.
I replaced the dots in FPH.API\FPH.api.csproj with underscores as dot is a forbidden character and tried several combinations like FPH_Api\FPH_Api or FPH_Api, but got the same error message.
Detail error shows this:
Project "D:\a\1\s\fph.sln" (1) is building "D:\a\1\s\FPH.Api\FPH.Api.csproj" (2) on node 1 (FPH_Api\FPH_Api_csproj target(s)).
D:\a\1\s\FPH.Api\FPH.Api.csproj : error MSB4057: The target "FPH_Api\FPH_Api_csproj" does not exist in the project.
Done Building Project "D:\a\1\s\FPH.Api\FPH.Api.csproj" (FPH_Api\FPH_Api_csproj target(s)) -- FAILED.
Seems the way I am doing things is not correct. So is it possible to use the VSBuild task to build a project in a solution and automatically zip the output?
I could reproduce your issue in my pipeline.
To solve this issue, you could define the target to folder level instead of csproj file level.
For example:
File structure:(csproj file is under Sample.WebAPI folder)
argument: /t:Sample_WebApi:Rebuild
- task: VSBuild#1
displayName: 'Build solution'
inputs:
solution: '$(Parameters.solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactstagingdirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site" /t:Sample_WebApi:Rebuild'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
For more info, you could refer to this doc about How to: Build specific targets in solutions by using MSBuild.exe
I realise that this is an old question but I have just been through similar pain trying to build a specific project from my solution using the msbuild targets argument. The answer was buried in this stack overflow thread specify project file of a solution using msbuild but it still took me a while to work out.
The msbuild /t parameter does not want file path and file name. Instead it requires the solution folder structure and the name of the project.
Optional: solution folder structure
Project name
wrapped in double quotes if there are any spaces in the parameter
Periods replaced with underscores.
For example if I have added FPH.Api project within a second level solution folder (e.g. Top Level > Second Level > FPH.Api) then I will see something like this in the .SLN file
Project("{guid}") = "Top Level", "Top Level", "{guid}"
EndProject
Project("{guid}") = "Second Level", "Second Level", "{guid}"
EndProject
Project("{guid}") = "FPH.Api", "FPH.Api\FPH.Api.csproj", "{guid}"
EndProject
In this case you would construct the /t parameter value as:
/t:"Top Level\Second Level\FPH_Api"
I hope that is helpful.
Related
I am trying to run the VSBuild#1 task in an Azure Pipeline and every time it fails with the same error - "The target "<project_name>" does not exist in the project". I've searched for every answer to this question and none have worked for me. The exact yaml I'm running is
- task: VSBuild#1
displayName: 'Build Project1 and Project2'
inputs:
solution: '$(solution)'
msbuildArgs: '/t:Folder\Project1:Rebuild;Folder\Project2:Rebuild'
clean: true
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
The directory looks like 'Repo\Folder\Project1\Project1.csproj' and 'Repo\Folder\Project2\Project2.csproj' and the VSBuild version is 1.199.
You can run
set MSBuildEmitSolution=1
msbuild All.sln /t:<project_name>
Then search in the generated All.sln.metaproj file the exact target names () of all projects you want to build. After that you can build projects:
msbuild All.sln /t:"<project_name>" /p:Configuration=Release /p:Platform=x64
I have created a Azure DevOps pipeline for my VB.net (.NET framework) project. Although, I am able to have the build pipeline successful, I am not seeing any artifacts generated for this. Not sure what I am doing wrong here. Appreciate if someone can help. Thank you.
My YAML File
trigger:
- Dev
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller#1
- task: NuGetCommand#2
inputs:
command: 'restore'
restoreSolution: '$(solution)'
- task: VSBuild#1
inputs:
solution: '$(solution)'
vsVersion: '16.0'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)\WebApp.zip"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
clean: true
- task: VSTest#2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: 'drop'
Following is what I see in the run log for Azure DevOps
VS Build Logs:
2021-05-13T16:33:13.8214355Z ##[section]Starting: VSBuild
2021-05-13T16:33:13.8440350Z ==============================================================================
2021-05-13T16:33:13.8440703Z Task : Visual Studio build
2021-05-13T16:33:13.8441022Z Description : Build with MSBuild and set the Visual Studio version property
2021-05-13T16:33:13.8441289Z Version : 1.183.0
2021-05-13T16:33:13.8441508Z Author : Microsoft Corporation
2021-05-13T16:33:13.8441860Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/build/visual-studio-build
2021-05-13T16:33:13.8442594Z ==============================================================================
2021-05-13T16:33:16.7807662Z ##[command]"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.183.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -latest -format json
2021-05-13T16:33:17.3715816Z ##[command]"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" "D:\a\1\s\BtuDia.sln" /nologo /nr:false /t:"Clean" /dl:CentralLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.183.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=f2cc1997-715f-4533-9cf5-809e154c58d8|SolutionDir=D:\a\1\s"*ForwardingLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.183.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="D:\a\1\a\WebApp.zip" /p:platform="Any CPU" /p:configuration="Release" /p:VisualStudioVersion="16.0" /p:_MSDeployUserAgent="VSTS_50ac3de3-2135-4b5c-a9b3-2b73c7988867_build_133_0"
2021-05-13T16:33:17.6709276Z Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
2021-05-13T16:33:18.2609764Z Build started 5/13/2021 4:33:18 PM.
2021-05-13T16:33:19.5083919Z Project "D:\a\1\s\BtuDia.sln" on node 1 (Clean target(s)).
2021-05-13T16:33:19.5097447Z ValidateSolutionConfiguration:
2021-05-13T16:33:19.5099659Z Building solution configuration "Release|Any CPU".
2021-05-13T16:33:19.5680685Z ##[warning]D:\a\1\s\BtuDia.sln.metaproj(0,0): Warning MSB4121: The project configuration for project "BtuDia" was not specified in the solution file for the solution configuration "Release|Any CPU".
2021-05-13T16:33:19.5693931Z D:\a\1\s\BtuDia.sln.metaproj : warning MSB4121: The project configuration for project "BtuDia" was not specified in the solution file for the solution configuration "Release|Any CPU". [D:\a\1\s\BtuDia.sln]
2021-05-13T16:33:19.8359709Z Project "D:\a\1\s\BtuDia.sln" (1) is building "D:\a\1\s\BtuDia.metaproj" (2) on node 1 (Clean target(s)).
2021-05-13T16:33:19.8366757Z Clean:
2021-05-13T16:33:19.8367729Z Web projects do not support the "Clean" target. Continuing with remaining projects ...
2021-05-13T16:33:19.8459255Z Done Building Project "D:\a\1\s\BtuDia.metaproj" (Clean target(s)).
2021-05-13T16:33:19.8660708Z Done Building Project "D:\a\1\s\BtuDia.sln" (Clean target(s)).
2021-05-13T16:33:19.8703982Z
2021-05-13T16:33:19.8704763Z Build succeeded.
2021-05-13T16:33:19.8820172Z
2021-05-13T16:33:19.8842817Z "D:\a\1\s\BtuDia.sln" (Clean target) (1) ->
2021-05-13T16:33:19.8843734Z (ValidateProjects target) ->
2021-05-13T16:33:19.8845021Z D:\a\1\s\BtuDia.sln.metaproj : warning MSB4121: The project configuration for project "BtuDia" was not specified in the solution file for the solution configuration "Release|Any CPU". [D:\a\1\s\BtuDia.sln]
2021-05-13T16:33:19.8845810Z
2021-05-13T16:33:19.8846120Z 1 Warning(s)
2021-05-13T16:33:19.8846392Z 0 Error(s)
2021-05-13T16:33:19.8846513Z
2021-05-13T16:33:19.8846801Z Time Elapsed 00:00:01.63
2021-05-13T16:33:19.9555158Z ##[command]"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild.exe" "D:\a\1\s\BtuDia.sln" /nologo /nr:false /dl:CentralLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.183.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=e520b37e-5959-4f7c-b65e-386d0792019a|SolutionDir=D:\a\1\s"*ForwardingLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.183.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="D:\a\1\a\WebApp.zip" /p:platform="Any CPU" /p:configuration="Release" /p:VisualStudioVersion="16.0" /p:_MSDeployUserAgent="VSTS_50ac3de3-2135-4b5c-a9b3-2b73c7988867_build_133_0"
2021-05-13T16:33:20.2085454Z Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
2021-05-13T16:33:20.3002560Z Build started 5/13/2021 4:33:20 PM.
2021-05-13T16:33:20.6526165Z Project "D:\a\1\s\BtuDia.sln" on node 1 (default targets).
2021-05-13T16:33:20.6539318Z ValidateSolutionConfiguration:
2021-05-13T16:33:20.6540673Z Building solution configuration "Release|Any CPU".
2021-05-13T16:33:20.6660965Z ##[warning]D:\a\1\s\BtuDia.sln.metaproj(0,0): Warning MSB4121: The project configuration for project "BtuDia" was not specified in the solution file for the solution configuration "Release|Any CPU".
2021-05-13T16:33:20.6667606Z D:\a\1\s\BtuDia.sln.metaproj : warning MSB4121: The project configuration for project "BtuDia" was not specified in the solution file for the solution configuration "Release|Any CPU". [D:\a\1\s\BtuDia.sln]
2021-05-13T16:33:20.8648353Z Project "D:\a\1\s\BtuDia.sln" (1) is building "D:\a\1\s\BtuDia.metaproj" (2) on node 1 (default targets).
2021-05-13T16:33:20.8649177Z Build:
2021-05-13T16:33:20.8649644Z C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /localhost_52471 -p BtuDia\ -u -f PrecompiledWeb\localhost_52471\
2021-05-13T16:33:39.1158371Z ##[warning]BtuDia\App_Code\classLocal.vb(6,0): Warning BC40056: Namespace or type specified in the Imports 'GrJhDll' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
2021-05-13T16:33:39.1161745Z D:\a\1\s\BtuDia\App_Code\classLocal.vb(6): warning BC40056: Namespace or type specified in the Imports 'GrJhDll' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. [D:\a\1\s\BtuDia.metaproj]
2021-05-13T16:33:43.1733067Z ##[warning]BtuDia\Dia_File_Group_Session_Open.aspx.vb(272,0): Warning BC42104: Variable 'CloneTargets_Old' is used before it has been assigned a value. A null reference exception could result at runtime.
2021-05-13T16:33:43.1739019Z D:\a\1\s\BtuDia\Dia_File_Group_Session_Open.aspx.vb(272): warning BC42104: Variable 'CloneTargets_Old' is used before it has been assigned a value. A null reference exception could result at runtime. [D:\a\1\s\BtuDia.metaproj]
2021-05-13T16:33:43.1747520Z ##[warning]BtuDia\Dia_File_Group_Session_Open.aspx.vb(979,0): Warning BC42024: Unused local variable: 'i'.
2021-05-13T16:33:43.1751140Z D:\a\1\s\BtuDia\Dia_File_Group_Session_Open.aspx.vb(979): warning BC42024: Unused local variable: 'i'. [D:\a\1\s\BtuDia.metaproj]
2021-05-13T16:33:43.6445378Z Done Building Project "D:\a\1\s\BtuDia.metaproj" (default targets).
2021-05-13T16:33:43.6612251Z Done Building Project "D:\a\1\s\BtuDia.sln" (default targets).
2021-05-13T16:33:43.6700189Z
2021-05-13T16:33:43.6701164Z Build succeeded.
2021-05-13T16:33:43.6767010Z
2021-05-13T16:33:43.6778847Z "D:\a\1\s\BtuDia.sln" (default target) (1) ->
2021-05-13T16:33:43.6780435Z (ValidateProjects target) ->
2021-05-13T16:33:43.6785676Z D:\a\1\s\BtuDia.sln.metaproj : warning MSB4121: The project configuration for project "BtuDia" was not specified in the solution file for the solution configuration "Release|Any CPU". [D:\a\1\s\BtuDia.sln]
2021-05-13T16:33:43.6787616Z
2021-05-13T16:33:43.6787719Z
2021-05-13T16:33:43.6788094Z "D:\a\1\s\BtuDia.sln" (default target) (1) ->
2021-05-13T16:33:43.6788775Z "D:\a\1\s\BtuDia.metaproj" (default target) (2) ->
2021-05-13T16:33:43.6789290Z (Build target) ->
2021-05-13T16:33:43.6791152Z D:\a\1\s\BtuDia\App_Code\classLocal.vb(6): warning BC40056: Namespace or type specified in the Imports 'GrJhDll' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases. [D:\a\1\s\BtuDia.metaproj]
2021-05-13T16:33:43.6792589Z D:\a\1\s\BtuDia\Dia_File_Group_Session_Open.aspx.vb(272): warning BC42104: Variable 'CloneTargets_Old' is used before it has been assigned a value. A null reference exception could result at runtime. [D:\a\1\s\BtuDia.metaproj]
2021-05-13T16:33:43.7077554Z D:\a\1\s\BtuDia\Dia_File_Group_Session_Open.aspx.vb(979): warning BC42024: Unused local variable: 'i'. [D:\a\1\s\BtuDia.metaproj]
2021-05-13T16:33:43.7078421Z
2021-05-13T16:33:43.7078905Z 4 Warning(s)
2021-05-13T16:33:43.7079179Z 0 Error(s)
2021-05-13T16:33:43.7082264Z
2021-05-13T16:33:43.7083041Z Time Elapsed 00:00:23.37
2021-05-13T16:33:43.7892410Z ##[section]Finishing: VSBuild
From your Yaml sample, you are using the Asp.Net template to build vb.net project. This template is not fully applicable to the vb.net.
So it will not generate the package in $(build.artifactstagingdirectory) path.
You could try to change the msbuildArgs (/p:OutputPath=$(build.artifactstagingdirectory))in VSBuild task.
Here is an example:
- task: VSBuild#1
displayName: 'Build solution'
inputs:
solution: '$(Parameters.solution)'
msbuildArgs: '/p:OutputPath=$(build.artifactstagingdirectory)'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
Or you could change the PathtoPublish in PublishBuildArtifacts task.
You could change the path to $(build.sourcesdirectory)/foldername/bin/Release.
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.sourcesdirectory)/foldername/bin/Release'
ArtifactName: '$(Parameters.ArtifactName)'
condition: succeededOrFailed()
I need to restore 3 projects (csproj) using VSBuild yaml task. I know that I can do it if I add 3 yaml tasks, but I wonder if is there a way to restore them all using just one task.
I already tried like this:
- task: VSBuild#1
displayName: 'Restore projects'
inputs:
solution: "'**/Project1.csproj';'**/Project2.csproj'"
msbuildArgs: '/t:Restore'
vsVersion: $(VSVersion)
platform: '$(BuildPlatform)'
configuration: '$(Configuration)'
,and I don't have syntax errors but the pipeline fails with this error: "Solution not found using search pattern..."
Usually, you specify solution file(s) to build (e.g. *.sln) rather than individual projects. So if it's possible to provide a solution file name that includes those 3 projects you need, that would be the best approach.
If that doesn't fit your case, you can use wildcards to provide a mask that fits all 3 projects, for example, **/Project*.csproj.
As the last option, you can try to switch to the MSBuild task instead. In fact, the docs say that:
In some cases you might need to use the MSBuild task. For example, you should use it if you are building code projects apart from a solution.
VSBuild task cannot recognize the multiple projects in this format "'**/Project1.csproj';'**/Project2.csproj'". You can use the wildcards **/Project*.csproj to map your projects.
- task: VSBuild#1
displayName: 'Restore projects'
inputs:
solution: '**/Project*.csproj'
msbuildArgs: '/t:Restore'
If your projects are dotnet core projects. You can use the DotNetCoreCLI task, which support multiple lines input:
steps:
- task: DotNetCoreCLI#2
displayName: 'dotnet restore'
inputs:
command: restore
projects: |
**/Project1.csproj
**/Project2.csproj
**/Project3.csproj
I would like to copy Angular UI dist folder content into published content, specifically wwwroot when using VSbuild task as shown below
- task: VSBuild#1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.ArtifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
My two questions are
whether this task is responsible for publish that we do manually in Visual Studio, and hence can I expect wwwroot folder to be present in the corresponding target location?
How do I say zip : false in the above command so that I can copy the required content and then zip later?
Thanks,
AK
whether this task is responsible for publish that we do manually in Visual Studio, and hence can I expect wwwroot folder to be present in the corresponding target location?
Yes. You can use msbuild arguments to do this:
msbuildArgs: '/p:DeployOnBuild=true /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:SkipInvalidConfigurations=true /p:DeleteExistingFiles=True /p:publishUrl="$(build.artifactStagingDirectory)"'
Use /p:WebPublishMethod=FileSystem to output the results as files, not a zip. Use /p:publishUrl={target location} to specify the output location.
How do I copy the required content and then zip later?
Add the following script to your .csproj file:
<ItemGroup>
<None Update="wwwroot\**" CopyToOutputDirectory="drop" />
</ItemGroup>
I have a solution that has a few projects.
App.Client.Website
App.Client.WindowsService
App.Client.Database
App.Client.Connectors
App.Shared
The App.Client.Database and App.Client.Connectors are both dependencies of App.Client.Website and App.Client.WindowsService, and App.Shared is a dependency of all the projects.
I am wanting to create 2 pipelines: One for the website and one for the windows service.
The issue that I have is that when I set my solution to be App.Client.Website/*.csproj, it can't find any of my project references to build - which makes a lot of sense to me, but I would obviously like to have it build my project references as well.
I tried solving this by creating pipelines for each of the dependency projects that would pack a nuget package and then I would reference that nuget packages from the feed in my website and window service projects, but this stopped me from being able to debug the code and make changes in those project on the fly.
DevOps is something that I am only just starting to pick up. I have gotten to the point where I am needing to add build numbers to my website application and wanting to stop manually incrementing patch numbers. I am using YAML instead of the Classic pipeline builder.
Any and all help is appreciated.
YAML
Here is the YAML that I am using. It is just the basic YAML with the solution targeting my Website project.
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.Client.Website/*.csproj'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller#1
- task: NuGetCommand#2
inputs:
command: 'restore'
restoreSolution: '$(solution)'
feedsToUse: 'config'
nugetConfigPath: 'Pipelines/nuget.config'
externalFeedCredentials: 'External Feed'
- task: VSBuild#1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts#1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
The repo folder structure has the project folders at the root of repo.
My project references in my Website cs project file are as follows:
<ItemGroup>
<ProjectReference Include="..\App.Client.Database\App.Client.Database.csproj" />
<ProjectReference Include="..\App.Client.Connectors\App.Client.Connectors.csproj" />
<ProjectReference Include="..\App.Shared\App.Shared.csproj" />
</ItemGroup>
Here is an error from the build task:
##[error]C:\Program Files\dotnet\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): Error NETSDK1004: Assets file 'D:\a\1\s\App.Shared\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
The issue is related to the NuGet Restore task, We could try to restore the .sln file to restore all NuGet packages, and then build the .csproj file. It should work.