Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

dotnet pack failing in AWS Codebuild for .NET framework web project

$
0
0

I am trying to package a project in my buildspec.yml file. My build server is AWS Codebuild.

I am using the following line-

aws s3 sync s3://<MyS3Bucket>/<MyProject> ./builddotnet pack "$($_.FullName)" --configuration Release --output ./nupkg

However I was getting the error that the build server couldn't find the Microsoft.WebApplication.Targets package.

What I have tried

After reading this answer, I installed the MSBuild.Microsoft.VisualStudio.Web.targets nuget package and then added to my csproj -

<Import Project="..\packages\MSBuild.Microsoft.VisualStudio.Web_WebApplication.Targets.12.0.2\tools\VSToolsPath\WebApplications" />

This resulted in the error -

Packaging C:\codebuild\tmp\output\src480207879\src\bitbucket.org\MyProject.csproj if MSBuild version 17.4.1+9a89d02ff for .NET   Determining projects to restore...   Nothing to do. None of the projects specified contain packages to restore. C:\codebuild\tmp\output\src480207879\src\bitbucket.org\My.csproj(3,3): error MSB4019: The imported project "C:\codebuild\tmp\output\src480207879\src\bitbucket.org\MyProject\packages\MSBuild.Microsoft.VisualStudio.Web_WebApplication.Targets.12.0.2\tools\VSToolsPath\WebApplications" was not found. Confirm that the expression in the Import declaration "..\packages\MSBuild.Microsoft.VisualStudio.Web_WebApplication.Targets.12.0.2\tools\VSToolsPath\WebApplications" is correct, and that the file exists on disk.  

My understanding is that the AWS CodeBuild server lacks the relevant binaries to build and package my project, so I also tried creating a new build project, using a custom image and an external registry of mcr.microsoft.com/dotnet/framework/sdk:4.8 however this took me down a rabbit hole of the server being unable to locate the AWS CLI component so I reverted to my previous build project.

Am I perhaps missing a step when referencing the package?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>