I'm trying to access the properties from
project.ConfigurationManager.ActiveConfiguration.Properties
but it's currently returning null. I've created my own Package type by extending
MSVSIP.
Package and Project from ProjectNode. I'm using the September CTP and RC1 of Visual Studio 2005. Does anyone have any insight into thisWith regards to the properties, I'm trying to change this property:
project.ConfigurationManager.Item("Debug", "Any CPU").Properties.Item("StartProgram").Value
and
project.ConfigurationManager.Item(
"Debug", "Any CPU").Properties.Item("StartArguments").Value(note that project.ConfigurationManager.Item("Debug", "Any CPU").Properties is still returning null... )
Interestingly enough, the Microsoft.VisualStudio.Package.Project.ProjectConfig code uses the Properties "StartPropram" and "CmdArgs". These values get passed to VsShellUtilities.LaunchDebugger().
To compare my custom project and the one generated by the Visual Studio Integration Package I've investigated the Properties defined in the PropertyGroup within the template file. At runtime, the C# Visual Studio Intergration Package wizard will create a Project with the following properties:
RunCodeAnalysis false
NoStdLib false
ErrorReport ""
CodeAnalysisUseTypeNameInSuppression ""
CodeAnalysisInputAssembly ""
GenerateSerializationAssemblies 2
CodeAnalysisModuleSuppressionsFile "GLobalSuppressions.cs"
StartWorkingDirectory ""
Optimize false
DocumentationFile ""
StartPage ""
OutputPath "Debug\\"
TreatWarningsAsErrors false
EnableASPDeubgging false
IncrementalBuild true
CodeAnalysisLogFile ""
DefineCOnstants "DEBUG;TRACE"
UseVSHostingProcess true
StartProgram ""
DefineDebug false
CodeAnalysisRuleAssemblies "C:\\Program FIles\\Microsoft Visual Studio 8\\Team Tools\Static Analysis Tools\\FxCop\\\\rules"
DefineTrace false
DebugSymbols true
NoWarn ""
EnableSQLServerDebugging false
BaseAddress 4194304
RemoteDebugEnabled false
StartURL ""
AllowUnsafeBlocks false
TreatSpecificWarningsAsErrors ""
PlatformTarget "AnyCPU"
EnableUnmanagedDebugging false
StartWithIE false
StartArguments ""
IntermediatePath "obj\\Debug\\"
DebugInfo "none"
CheckForOverflowUnderflow false
RemoteDebugMachine ""
CodeAnalysisSpellCheckLanguages ""
CodeAnalysisRules ""
REgisterForCOmInterop false
FileAlignment 4096
StartAction 0
EnableASPXDebugging false
COnfigurationOVerrideFile ""
WarningLevel 4
RemoveIntegerChecks false
Here's the template file:
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.40128</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyName>%ProjectName%</AssemblyName>
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<RootNamespace>Vsip.%ProjectClass%</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>Debug\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<IncrementalBuild>false</IncrementalBuild>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>Release\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>false</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<IncrementalBuild>false</IncrementalBuild>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.OLE.Interop">
<Name>Microsoft.VisualStudio.OLE.Interop</Name>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Interop">
<Name>Microsoft.VisualStudio.Shell.Interop</Name>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0">
<Name>Microsoft.VisualStudio.Shell.Interop.8.0</Name>
</Reference>
<Reference Include="Microsoft.VisualStudio.TextManager.Interop">
<Name>Microsoft.VisualStudio.TextManager.Interop</Name>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell">
<Name>Microsoft.VisualStudio.Shell</Name>
</Reference>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Design">
<Name>System.Design</Name>
</Reference>
<Reference Include="System.Drawing">
<Name>System.Drawing</Name>
</Reference>
<Reference Include="System.Windows.Forms">
<Name>System.Windows.Forms</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Guids.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ResourcesId.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="VsPkg.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>"%InstallDir%\tools\bin\RegPkg" /root:Software\Microsoft\VisualStudio\8.0Exp /codebase "$(TargetPath)"</PostBuildEvent>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
</VisualStudio>
</ProjectExtensions>
</Project>
Notice how the "StartProgram" property doesn't exist (and i couldn't find it in the Microsoft.CSharp.targets file either).
Where and how does this property get added
Thanks
Ryan

project.ConfigurationManager.ActiveConfiguration.Properties is null
MosIdiot
Craig
Z.Fan
And i will come out four folder(html,images,scripts and templates)
the js file(default.js) is in the scripts folder,you can add the function if you like and also you add some code before the project is save(proj.save()) like following
proj.ConfigurationManager.Item(
"Debug","Any CPU").Properties.Item("StartAction").Value =1; if(ofso.FileExists("c:\\windows\\notepad.exe")){
proj.ConfigurationManager.Item(
"Debug","Any CPU").Properties.Item("StartProgram").Value = "c:\\windows\\nodepade.exe";}
proj.Save();
............
so when you create a project by this wizard,
the debug mode will be chaged into "Program"(VS2003 ,and different in VS2005)
and the "StartProgram" will be "nodepade.exe"
S Eisenberg
I think if you want to set the "StartProgram",you must first set the "StartAction",
The right answer will be set StartAction = 1; and then set the StartProgram to the executable file.
And
I think the reason for that the problem happened to you is that you must open anthor project,so the code you wrote can set the opened project