I have created a custom wizard for visual studio 2010. I can setup the the project configurations but I need I can't find how to set the solution configurations.
Below is an abstract from my code to setup a project configuration from default.js. How can I do a similar thin for the solution?
var debugConfig = proj.Object.Configurations('Debug');
debugConfig.OutputDirectory = '$(ProjectDir)$(ConfigurationName)';
debugConfig.IntermediateDirectory = '$(ConfigurationName)';
debugConfig.ConfigurationType = typeStaticLibrary;
debugConfig.CharacterSet = charSetUnicode;
var CLTool = debugConfig.Tools('VCCLCompilerTool');
CLTool.Optimization = optimizeDisabled;
CLTool.AdditionalIncludeDirectories = '.;$(COREDIR)/cliprt';
CLTool.PreprocessorDefinitions = 'WIN32;_DEBUG;_LIB;CLP_PLATFORM_WIN32';
CLTool.MinimalRebuild = 'true';
CLTool.BasicRuntimeChecks = runtimeBasicCheckAll;
CLTool.RuntimeLibrary = rtMultiThreadedDebug;
CLTool.UsePrecompiledHeader = pchNone;
CLTool.WarningLevel = warningLevel_3;
Update
I recently migrated from Visual Studio 2008 to Visual studio 2010. When I checked back at the 2008 version I noticed that it was behaving as required ie the new configurations were added for both the solution and the project. Is there a known difference in this respect between studio 2008 and 2010?
Ok
I have a solution now. I modified the above code to look like this.
var solCurrentConfig = Solution.SolutionBuild.SolutionConfigurations.Add('AutonomousDebug', 'Debug', true);
var currentConfig = proj.Object.Configurations('AutonomousDebug');
debugConfig.CopyTo( currentConfig );
currentConfig = proj.Object.Configurations('AutonomousDebug');
currentConfig.OutputDirectory = '$(SolutionDir)$(Configuration)';
currentConfig.IntermediateDirectory = '$(Configuration)/';
Related
I have unbound all projects from TFS version control, but every time I open the solution it pops-up a dialog asking me if I want to connect to TFS.
Q: How do I get rid of it?
Found it!
I had to go into the SOLUTION FILE and remove the following (by-hand)
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 8
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = https://yournamehere.visualstudio.com/
SccLocalPath0 = .
SccProjectUniqueName1 = Data\\Data.csproj
SccProjectTopLevelParentUniqueName1 = Guardians.sln
SccProjectName1 = Data
SccLocalPath1 = Data
SccProjectUniqueName2 = Framework\\Framework.csproj
SccProjectTopLevelParentUniqueName2 = Guardians.sln
SccProjectName2 = Framework
SccLocalPath2 = Framework
SccProjectUniqueName3 = Models\\Models.csproj
SccProjectTopLevelParentUniqueName3 = Guardians.sln
SccProjectName3 = Models
SccLocalPath3 = Models
SccProjectUniqueName4 = Dictionary\\Dictionary.csproj
SccProjectTopLevelParentUniqueName4 = Guardians.sln
SccProjectName4 = Dictionary
SccLocalPath4 = Dictionary
SccProjectUniqueName5 = Web\\Web.csproj
SccProjectTopLevelParentUniqueName5 = Guardians.sln
SccProjectName5 = Web
SccLocalPath5 = Web
SccProjectUniqueName6 = Cloud\\Cloud.ccproj
SccProjectTopLevelParentUniqueName6 = Guardians.sln
SccProjectName6 = Cloud
SccLocalPath6 = Cloud
SccProjectUniqueName7 = UnitTests\\UnitTests.csproj
SccProjectTopLevelParentUniqueName7 = Guardians.sln
SccProjectName7 = UnitTests
SccLocalPath7 = UnitTests
EndGlobalSection
In the solution's and projects' folders you will find *.vspscc files which are responsible of version control, remove them all and your problem should be fixed.
There is also a .vs and $tf hidden folders, you need to remove those also.
Initially, My project was developed on MS 2003 with Visual Studio 2005 and MS Office 2007. It takes 5 - 6 minutes to create excel file with microsoft.office.interop.excel
Now, I have migrated my project on MS 2008 R2 SP1 with VS 2013 and MS Office 2013. For the same sheet above mentioned, it takes around two hours.
Following things I have tried:
Latest assemblies have been tried.
excelApp.Visible = false; excelApp.ScreenUpdating = false; excelApp.DisplayAlerts = false; (thse set up are not done before migration but was still fast)
Tried installing Excel 2007, Excel 2010 and Excel 2013. (Both Office 32 bit and 64 version tried)
It's being more than 5 days, I am at the same problem.
Sample Code is as below:
Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
excelApp.Visible = false;
excelApp.ScreenUpdating = false;
excelApp.DisplayAlerts = false;
Excel._Workbook excelBook = (Excel._Workbook)excelApp.Workbooks.Add(Excel.XlSheetType.xlWorksheet);
Excel._Worksheet excelWorksheet = (Excel._Worksheet)excelBook.ActiveSheet;
Excel._Worksheet excelWorksheet2 = (Excel._Worksheet)excelBook.Sheets.Add(System.Reflection.Missing.Value, excelWorksheet, 1, Excel.XlSheetType.xlWorksheet);
Excel._Worksheet excelWorksheet3 = (Excel._Worksheet)excelBook.Sheets.Add(System.Reflection.Missing.Value, excelWorksheet2, 1, Excel.XlSheetType.xlWorksheet);
Excel._Worksheet excelWorksheet4 = (Excel._Worksheet)excelBook.Sheets.Add(System.Reflection.Missing.Value, excelWorksheet3, 1, Excel.XlSheetType.xlWorksheet);
Excel._Worksheet excelWorksheet5 = (Excel._Worksheet)excelBook.Sheets.Add(System.Reflection.Missing.Value, excelWorksheet4, 1, Excel.XlSheetType.xlWorksheet);
Excel._Worksheet excelWorksheet6 = (Excel._Worksheet)excelBook.Sheets.Add(System.Reflection.Missing.Value, excelWorksheet5, 1, Excel.XlSheetType.xlWorksheet);
Excel._Worksheet excelWorksheet7 = (Excel._Worksheet)excelBook.Sheets.Add(System.Reflection.Missing.Value, excelWorksheet6, 1, Excel.XlSheetType.xlWorksheet);
//****************** For the Day Summary Report (Sheet 1)*****************
Excel.Range oRng1;
... onwards updating excel sheets....
I dont know how to fix it.
Please help.
I have seen on various examples (even in Azure ML) that you are able to create appealing charts using R in Visual Studio (not R Studio!), but I have no clue how they did it. I am experienced with R, but if someone could point me in the right direction of how to visualize data sets in Visual Studio and Azure ML; I would really appreciate it.
Here is an example I would like to duplicate (in both Azure ML and Visual Studio): Visual studio chart
Image source: https://regmedia.co.uk/2016/03/09/r_vis_studio_plot.jpg?x=648&y=348&crop=1
You can install ggplot2 in your solution in the Visual Studio extension Open R (https://www.visualstudio.com/en-us/features/rtvs-vs.aspx) through this line of code and visualize it within the R Plot window in Visual Studio after creating your R-project:
install.packages('ggplot2', dep = TRUE)
library(ggplot2)
The reason I have «library(ggplot2)» is to check if the package got successfully installed, else you would get an error like this: Error in library(ggplot2) : there is no package called ‘ggplot2’
So if you don’t get that error; you should be good to go.
For your question about how to output charts; you simply have to populate the ggplot2 charts from a datasource, like in my example below (csv-file):
dataset1 <- read.csv("Adult Census Income Binary Classification dataset.csv", header = TRUE, sep = ",", quote = "", fill = TRUE, comment.char = "")
head(dataset1)
install.packages('ggplot2', dep = TRUE)
library(ggplot2)
names(dataset1) <- sub(pattern = ',', replacement = '.', x = names(dataset1))
foo = qplot(age, data = dataset1, geom = "histogram", fill = income, position = "dodge");
print(foo)
bar = qplot(age, data = dataset1, geom = "density", alpha = 1, fill = income);
print(bar)
Here you can see that I create two charts, one histogram and one density-chart.
In Azure ML, the same charts (this time I included a histogram for Relationships as well), would look like this:
// Map 1-based optional input ports to variables
dataset1 <- maml.mapInputPort(1) # class: data.frame
library(ggplot2)
library(data.table)
names(dataset1) <- sub(pattern=',', replacement='.', x=names(dataset1))
// This time we need to specify the X to be sex; which we didn’t need in Visual Studio
foo = qplot(x=sex, data=dataset1, geom="histogram", fill=income, position="dodge");
print(foo)
foo = qplot(x=relationship, data=dataset1, geom="histogram", fill=income, position="dodge");
print(foo)
foo = qplot(x=age, data=dataset1, geom="density", alpha=0.5, fill=income);
print(foo)
// Select data.frame to be sent to the output Dataset port maml.mapOutputPort("dataset1");
Remember to put all of this in a “Execute R Script module” in order to run it correctly. After that, you can right lick the module and visualize the result.
I believe you're referring to the R Tools for Visual Studio. These provide a means to develop and debug R code in the Visual Studio IDE, and can produce plots like the one you shared.
However, that plot looks like a pretty standard chart from the CRAN ggplot2 package, which means it could have been just as easily produced from R code running in the R console or RStudio.
This posting on the R-bloggers site should help get you started with ggplot2.
http://www.r-bloggers.com/basic-introduction-to-ggplot2/
Good luck, and enjoy!
jmp
I'm writing a simple Visual Studio 2010 Add-In to do a common copying job here at work (getting dlls from libs sln).
I want the progress of the copying to be written to the output window.
I tried Trace.WriteLine(...) expecting that to make it, but it doesn't when I run the add-in in the debugger. I have not tried it any other way yet.
I found some examples of doing that in Visual Studio 2008, but the required libs are not available to reference.
Can anyone point me to how to write to the output window? My googling skills have failed me.
I've done this for a macro I wrote:
Window window = dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
OutputWindow outputWindow = (OutputWindow) window.Object;
outputWindow.ActivePane.Activate();
outputWindow.ActivePane.OutputString(message);
Here is a link for the DTE Interface:
http://msdn.microsoft.com/en-us/library/envdte.dte(v=VS.100).aspx
As Robert pointed out, John's code will throw an exception when there is no ActivePane. If there is an active pane, it will use whichever pane is active.
One issue I have with Robert's example is depending on where you create the pane, which in my case is the Exec method, it will create multiple panes with the same name each time it is run.
Including my example as to how I got around that issue. Pretty simple, just check for the existence of the window first...
Window window = _applicationObject.Windows.Item( EnvDTE.Constants.vsWindowKindOutput );
OutputWindow outputWindow = ( OutputWindow )window.Object;
OutputWindowPane outputWindowPane = null;
for ( uint i = 1; i <= outputWindow.OutputWindowPanes.Count; i++ )
{
if ( outputWindow.OutputWindowPanes.Item( i ).Name.Equals( OUTPUT_WINDOW_NAME , StringComparison.CurrentCultureIgnoreCase ) )
{
outputWindowPane = outputWindow.OutputWindowPanes.Item( i );
break;
}
}
if ( outputWindowPane == null )
outputWindowPane = outputWindow.OutputWindowPanes.Add( OUTPUT_WINDOW_NAME );
outputWindowPane.OutputString( "Message" );
I am writing a Visual studio add-in and had the same problem, however when trying the above answer I found that the line:
outputWindow.ActivePane.Activate();
gave an error.
NullReferenceException -- Object reference not set to an instance of an object.
However I have now found a slightly different way to solve the problem:
Window window = applicationObject.Windows.Item(Constants.vsWindowKindOutput);
OutputWindow outputWindow = (OutputWindow)window.Object;
OutputWindowPane owp;
owp = outputWindow.OutputWindowPanes.Add("new pane");
owp.OutputString("hello");
How can I change color of lines in Visual Studio 2010 based on some custom pattern? For example, I want to change color of all lines that start with logger. . Is it possible at all?
I have ReSharper 5 installed too.
I wrote up a quick little extension to do this; since you'll very likely want to modify it, you should grab the source. The important part is the code in LayoutChanged:
void ViewLayoutChanged(object sender, TextViewLayoutChangedEventArgs e)
{
IWpfTextView view = sender as IWpfTextView;
var adornmentLayer = view.GetAdornmentLayer("HighlightLines");
foreach (var line in e.NewOrReformattedLines)
{
if (line.Extent.GetText().StartsWith("logger.", StringComparison.OrdinalIgnoreCase))
{
Rectangle rect = new Rectangle()
{
Width = view.ViewportWidth + view.MaxTextRightCoordinate,
Height = line.Height,
Fill = Brushes.AliceBlue
};
Canvas.SetTop(rect, line.Top);
Canvas.SetLeft(rect, 0);
adornmentLayer.AddAdornment(line.Extent, null, rect);
}
}
}
To build/run this, you'll need to:
Download the VS2010 SDK.
Create a new project from the editor extension templates (I usually pick Visual C# -> Extensibility -> Editor Text Adornment).
Delete all the source files it creates.
Add HighlightMatchingLines.cs to the project.
F5 to run/test.
If you want to change the brush, change the Fill = Brushes.AliceBlue line.
If you want to change what text is matched, changed the condition in the if expression.
If you want to change what file type the extension is loaded for, change the [ContentType] attribute. The "Content Types" section of this msdn page lists out some of the common ones.