Created
October 22, 2017 11:47
-
-
Save mishrsud/066409b9b5dcce2ff721adffc7995527 to your computer and use it in GitHub Desktop.
Modify Csproj Programmatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add Refernce to Microsoft.Build.BuildEngine | |
// SO: https://stackoverflow.com/a/8492560/190476 | |
using Microsoft.Build.BuildEngine; | |
namespace UpdateVsProjects | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string fullProjPath = | |
@"C:\SourceCode\Github-Public\CSharpFeatures\ExceptionHandlingDemo\ExceptionHandlingDemo\ExceptionHandlingDemo.csproj"; | |
Engine eng = new Engine(); | |
Project proj = new Project(eng); | |
proj.Load(fullProjPath); | |
proj.SetProperty("PlatformTarget", "x64", "'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"); | |
proj.SetProperty("PlatformTarget", "x64", "'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"); | |
proj.Save(fullProjPath); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment