Je vien à vous car un problème m'est apparu, que je n'avais pas avant ...
Dans un importateur de project Visual Studio 2005, je veux obtenir le dossier de sortie de ce même projet. Sur mon ancienne machine de developpement ( Visual Studio 2005 SP1 + Windows XP + .NET 2.0 ) ça marchait nikel mais là ( Visual Studio 2005 SP1 + Patchs Vista + Windows Vista + ... ) j'obtient nul, quelque soit le projet choisis. Voici mon code :
Sur la dernière ligne, j'obtient un ArgumentNullException. Pourtant que je regarde le code source d'un des fichiers projets que j'utilise, je vois bien la propriété OutputPath définie :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 Engine.GlobalEngine.BinPath = RuntimeEnvironment.GetRuntimeDirectory(); Project vs_project = new Project(); vs_project.Load(project_path); string out_dir = ""; out_dir = vs_project.EvaluatedProperties["OutputPath"].FinalValue;
Qu'ai-je mal fait ? y aurai-t-il quelque chose que j'ai oublié ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{18B58CA4-E470-4EB4-AC2B-52BECAFE0B53}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>InfoBox</RootNamespace> <AssemblyName>InfoBox</AssemblyName> <SignAssembly>false</SignAssembly> <AssemblyOriginatorKeyFile> </AssemblyOriginatorKeyFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <DocumentationFile>bin\InfoBox.XML</DocumentationFile> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> ... </Project>![]()
Partager