Reputation: 2181
I have added a 3rd party project to my solution, which i have forked from github.
I'll do often changes in this repo which i pull-request back to orig repository.
How can i modify build destination of this project, building to ..\..\bin\Debug
instead of bin\Debug
without modifying the csproj
file.
I am trying to avoid stashing the csproj every time while pushing changes.
Answer, based on JakeSays input
//Filename - *.csproj.user
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<OutputPath>..\..\..\bin\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>..\..\..\bin\Debug\</OutputPath>
</PropertyGroup>
</Project>
This outputpaths will be used instead of the orig OutputPath entry
Upvotes: 1
Views: 339
Reputation: 349
The changes should be made outside of the .csproj file. I suggest placing a .csproj.user file next to the project file, and overriding the output path in it.
You can then add the .user file to gitignore (if it isn't already)
Upvotes: 2
Reputation: 142612
There are several options:
.gitignore
fileThis will ignore the file and any changes made to it.
--assume-unchaged
Raise the --assume-unchaged
flag on this file so it will stop tracking changes on this file
Using method (2) will tell git to ignore this file even when ts already committed.
It will allow you to modify the file without having to commit it to the repository.
--[no-]assume-unchanged When this flag is specified, the object names recorded for the paths are not updated. Instead, this option sets/unsets the "assume unchanged" bit for the paths. When the "assume unchanged" bit is on, the user promises not to change the file and allows Git to assume that the working tree file matches what is recorded in the index. If you want to change the working tree file, you need to unset the bit to tell Git. This is sometimes helpful when working with a big project on a filesystem that has very slow lstat(2) system call (e.g. cifs).
Git will fail (gracefully) in case it needs to modify this file in the index e.g. when merging in a commit; thus, in case the assumed-untracked file is changed upstream, you will need to handle the situation manually.
git add -P
Using git add -p
to add only parts of changes which you will choose to commit.
You can choose which changes you wish to add (picking the changes) and not committing them all.
Upvotes: 1