Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSB4057: The target "Release" does not exist in the project: in csproj in TeamCity

I've set up a build step using msbuild (Microsoft BuildTools 2019, ToolsVersion 16.0)

If I set build target to Release, I get the error in the title. If I set build target to Debug, I get the equivalent error.

If I don't set a build target at all, I get: NETSDK1004: Assets file 'C:\TeamCity\buildAgent\work\b8126aa0ba178445\Test\Application\Matisa.Test.ApplicationEnums\obj\project.assets.json' not found

I've tried switching to .NET CLI builder, but it gives the same error.

like image 745
Benjol Avatar asked Dec 09 '25 21:12

Benjol


2 Answers

It seems that you need to run dotnet restore in your pipeline somehow. You can try to add .NET CLI step with restore command to your build definition and place it before your msbuild step.

like image 87
scor4er Avatar answered Dec 12 '25 15:12

scor4er


Sorry, silly me...

The target isn't Debug or Release, it's Build/Restore etc... Got mixed up.

Debug or Release goes in Parameters.

like image 41
Benjol Avatar answered Dec 12 '25 15:12

Benjol



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!