In my solution I have many projects. In each project I have a publish profile “local.pubxml” inside “/properties/PublishProfiles”. In this publish profile I want to import a file “publishsettings.targets” which is in the root where the solution file is. This is the content of the .pubxml.
<Project>
<Import Project="$(SolutionDir)publishsettings.targets"/>
<PropertyGroup>
<Configuration>Debug</Configuration>
<Platform>Any CPU</Platform>
<PublishDir>$(PublishDir)</PublishDir>
<PublishUrl>$(PublishUrl)</PublishUrl>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net48</TargetFramework>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
it does not work. In Visual Studio when I right click on the project and click “publish”, it does not recognize the $(“SolutionDir”).
But if I write the path directly for ex: c:\Repo\abc\abc\publishsettings.targets, it works.
I have tried to add the following in Directory.build.pros with no luck.
<SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir>
I also tried “../../../../../../publishsettings.targets”, does not work.
Am I missing something here?