VS 2022 image cannot build hello world program

pkaminsky's Avatar

pkaminsky

21 Oct, 2022 01:25 PM

I'm confounded by this problem with Appveyor not being able to build a default scaffolded AspNet app.

dotnet publish HelloWorld.csproj -o publish --configuration Release --framework net6.0

The appveyor image gets this error

C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk.Publish\targets\CopyTargets\Microsoft.NET.Sdk.Publish.CopyFiles.targets(80,5): error MSB4006: There is a circular dependency in the target dependency graph involving target "Publish". Since "_CopyAspNetCoreFilesToIntermediateOutputPath" has "DependsOn" dependence on "Publish", the circular is "Publish<-_CopyAspNetCoreFilesToIntermediateOutputPath<-CorePublish<-DotNetPublish<-_PublishBuildAlternative<-Publish".

The .csproj file is default with no dependencies, with the SDK set to Microsoft.NET.Sdk.Web . If I change the SDK to just Microsoft.NET.Sdk, appveyor can build it. But, then it's slightly different than what I want.

  1. Support Staff 1 Posted by Feodor Fitsner on 21 Oct, 2022 04:30 PM

    Feodor Fitsner's Avatar

    I can build a stock "webapp" without any issues on VS 2022 image: https://ci.appveyor.com/project/FeodorFitsner/appveyor-check/builds...

    appveyor.yml used for tests: https://gist.github.com/FeodorFitsner/9c770de9f64a0f312b91d221b4eb7d36

    What app template are you trying?

  2. 2 Posted by pkaminsky on 21 Oct, 2022 05:30 PM

    pkaminsky's Avatar

    The only other difference in the code is my template included Swashbuckle package reference. I also called nuget restore before dotnet publish, and passed some --source urls which were not used. Maybe that's somehow the problem. But the solution also makes no sense. I removed the --framework net6.0 specifier and it worked.

    The same script works on my machine so we'll never know, just bizarre MSBUILD environmental things I guess.

  3. Support Staff 3 Posted by Feodor Fitsner on 21 Oct, 2022 06:12 PM

    Feodor Fitsner's Avatar

    This is why we need external CI service - to fight "works on my machine" problem.

    If you can give me a simple repro with Swashbuckle I can give it a try.

  4. Feodor Fitsner closed this discussion on 21 Dec, 2022 09:02 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

03 Oct, 2024 07:07 PM
01 Oct, 2024 05:06 PM
01 Oct, 2024 04:27 PM
26 Sep, 2024 03:49 PM
26 Sep, 2024 09:02 AM
25 Sep, 2024 07:07 PM