Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CopyToPublishDirectory does not work in .net9. #46073

Open
neominky opened this issue Jan 17, 2025 · 0 comments
Open

CopyToPublishDirectory does not work in .net9. #46073

neominky opened this issue Jan 17, 2025 · 0 comments
Labels
Area-WebSDK untriaged Request triage from a team member

Comments

@neominky
Copy link

neominky commented Jan 17, 2025

CopyToPublishDirectory does not work after changing from .net8 to .net9. So file conflict occurs.

21>C:\Program Files\dotnet\sdk\9.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ConflictResolution.targets(112,5): 오류 NETSDK1152: 상대 경로가 같은 여러 게시 출력 파일을 찾았습니다. P:\Projects\MyCompany\MyProduct\src\MyProduct.Api\aspnet-core\src\MyProduct.Api.Client.Windows\appsettings.json, P:\Projects\MyCompany\MyProduct\src\MyProduct.Api\aspnet-core\src\MyProduct.Api.Client.Web.Host\appsettings.json, P:\Projects\MyCompany\MyProduct\src\MyProduct.Api\aspnet-core\src\MyProduct.Api.Client.Windows\appsettings.Production.json, P:\Projects\MyCompany\MyProduct\src\MyProduct.Api\aspnet-core\src\MyProduct.Api.Client.Web.Host\appsettings.Production.json.

MyProduct.Api.Client.Web.Host

		<None Update="appsettings.json">
			<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
			<CopyToPublishDirectory>false</CopyToPublishDirectory>
			<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
		</None>
		<None Update="appsettings.Production.json">
			<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
			<CopyToPublishDirectory>false</CopyToPublishDirectory>
			<DependentUpon>appsettings.json</DependentUpon>
			<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
		</None>

MyProduct.Api.Client.Windows

		<Content Include="appsettings.json">
			<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
			<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
			<CopyToPublishDirectory>Always</CopyToPublishDirectory>
		</Content>
		<Content Include="appsettings.Production.json">
			<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
			<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
			<DependentUpon>appsettings.json</DependentUpon>
			<CopyToPublishDirectory>Always</CopyToPublishDirectory>
		</Content>

any temporary solution?

added --- The problem has been solved.
MyProduct.Api.Client.Web.Host:
Change None to Content in MyProduct.Api.Client.Web.Host
Image

MyProduct.Api.Client.Windows:
Remove None+Remove from MyProduct.Api.Client.Windows. I don't know why this is there. VisualStudio added it.
Image

It is true that this is not a problem in .net8.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-WebSDK untriaged Request triage from a team member labels Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-WebSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

1 participant