2015-10-12 46 views
0

我想在我的app.config中添加一些设置。通过预览,设置可以正确添加,但不能在构建之后。vb.net app.config xml转换不起作用

我的App.config

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <configSections> 
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> 
    </configSections> 
    <startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> 
    </startup> 
    <entityFramework> 
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> 
     <parameters> 
     <parameter value="v11.0" /> 
     </parameters> 
    </defaultConnectionFactory> 
    <!--<providers> 
     <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> 
    </providers>--> 
    </entityFramework> 
    <connectionStrings> 
    <add name="BackOfficeEntities" connectionString="metadata=res://*/DAL.BackOfficeDAL.csdl|res://*/DAL.BackOfficeDAL.ssdl|res://*/DAL.BackOfficeDAL.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=MySource;initial catalog=***;persist security info=True;user id=***;password=***;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 
    </connectionStrings> 
    <appSettings /> 
</configuration> 

我App.Debug.config生成后

<?xml version="1.0" encoding="utf-8" ?> 
<!-- For more information on using transformations 
    see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. --> 
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
    <appSettings> 
    <add key="inputDirectory" value="C:\Dev\Intranet_MISC\" xdt:Transform="Insert" /> 
    <add key="outputDirectory" value="C:\Dev\Intranet_MISC\Traites\" xdt:Transform="Insert" /> 
    <add key="historyDirectory" value="C:\Dev\Intranet_MISC\XmlHistory\" xdt:Transform="Insert" /> 
    <add key="MH_ID_MOTIF_REPOS_HEBDO" value="16" xdt:Transform="Insert" /> 
    </appSettings> 
</configuration> 

最后的app.config:

<?xml version="1.0" encoding="utf-8"?> 
<!-- For more information on using transformations 
    see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. --> 
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
    <appSettings> 
    <add key="inputDirectory" value="C:\Dev\Intranet_MISC\" xdt:Transform="Insert" /> 
    <add key="outputDirectory" value="C:\Dev\Intranet_MISC\Traites\" xdt:Transform="Insert" /> 
    <add key="historyDirectory" value="C:\Dev\Intranet_MISC\XmlHistory\" xdt:Transform="Insert" /> 
    <add key="MH_ID_MOTIF_REPOS_HEBDO" value="16" xdt:Transform="Insert" /> 
    <add key="inputDirectory" value="C:\Dev\Intranet_MISC\"/> 
    <add key="outputDirectory" value="C:\Dev\Intranet_Dekra_MISC\Traites\"/> 
    <add key="historyDirectory" value="C:\Dev\Intranet_MISC\XmlHistory\"/> 
    <add key="MH_ID_MOTIF_REPOS_HEBDO" value="16"/> 
    </appSettings> 
</configuration> 

你有原点任何想法的问题?

回答

0

我找到了。在vbproj我修改了attribut:

来源:

<PropertyGroup> 
    <AppConfig>App.$(Configuration).config</AppConfig> 
    </PropertyGroup> 

要:

<PropertyGroup> 
    <AppConfig>App.config</AppConfig> 
    </PropertyGroup> 

在ohters vbproj有没有这个的PropertyGroup。