c# - Determine a project's solution file location via Visual Studio Designer -


We have a statement that tries to determine where a particular folder is located, It's running locally (debug), or on a customer's machine (release), we see a different place for this.

  #if (DEBUG) firefoxpat = @ ".. \ .. \ .. \ \ xulrunner \" is included; #else if (System.Diagnostics.Debugger.IsAttached) {firefoxPath = @ ".. .. .. .. .. .. \ XulRunner" is included; } Else {firefoxPath = Path.Combine (application.StartupPath, @ "XulRunner \"); } #endif   

However, when we try to run a designer for one of the projects, this path is unable to resolve, because the working directory of the designer is: C: \ Program Files (x86) \ Microsoft Visual Studio 12.0 \ Common7 \ IDE If the folder's path is incorrect, the project will not run properly, and when the designer tries to load it, the designer crashes.

We can use it to determine that we are currently executing through the designer:

  bool is InDesignMode = LicenseManager.UsageMode == LicenseWoodMod.Designment || System.Digagnostics.Debugger.IsAttached == is true;   

My question is, how can we determine the path of solution through a designer, so that we can solve the path of that folder correctly, which we need?

You can get some assembly examples within the entire project, use the property and It can play with:

  string assembly = new URI (assembly .gate assembly (typef (some kind of missing project)). Codebabes.AssolutePath; // At least you have bin \ debug Bin \ Release Now you can assume some conventions / and project directory You can find the string binDir = path.gate directoryname (binDir);   

I do not know your exact case, but maybe assembly.setting assembly () There may be enough and you do not need to load the entire assembly by giving one type.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -