I currently have
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "$(SolutionDir)Shared.Lib\$(TargetFileName)"</PostBuildEvent>
</PropertyGroup>
I want to do s开发者_Python百科omething like this, but one level above $(SolutionDir)
You can use ..\ to move up a directory.
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "$(SolutionDir)..\Shared.Lib\$(TargetFileName)"</PostBuildEvent>
</PropertyGroup>
Solution:
copy "$(TargetPath)" "$(SolutionDir)"..\"Shared.Lib\$(TargetFileName)"
If you have ..\
within the quotation marks, it will take it as literal instead of running the DOS command up one level.
This is not working in VS2010 .. is not resolved but becomes part of the path
Studio is running command something like this copy drive$:\a\b\bin\debug drive$:\a\b..\c
In .Net Core edit csproj file:
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y "$(TargetPath)" "$(SolutionDir)"..\"lib\$(TargetFileName)"" />
</Target>
/Y
Suppresses prompting to confirm you want to overwrite an existing destination file.
xcopy "$(TargerDir)." "$(SolutionDir)..\Installer\bin\"
Note: "../" is used for One level up folder structure
精彩评论