2016-12-30 3 views
0

Webサイトプロジェクトのソリューションがあります。 3つのカスタムソリューション構成があります:Dev、Test、Prod。ただし、Webサイトプロジェクトには.csprojファイルがなく、Webサイトプロジェクトの構成を使用する方法はありません(または見つけられません)。 私はソリューションを構築するためのMSBuildを使用しています:Visual Studio Webサイトのソリューションコンフィグレーションを書き換えます

MSBuild.exe MySolution.sln /m /p:Platform=x86;TargetFrameworkVersion=v4.6.2;OutputPath=bin;Configuration=Dev /ToolsVersion:14.0 

の.slnファイルは、Webサイトのプロジェクトのための私のDev構成に関するすべての情報を持っていないため、唯一のデバッグとリリース「セクション」があります。

は、
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Web", "Web\", "{1F81A0DB-6FF4-4F89-B988-6D327797C4FD}" 
ProjectSection(WebsiteProperties) = preProject 
    TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.6.2" 
    ProjectReferences = "{12A625AA-8B5A-4336-AA4A-3630AAB3A27D}|MyLib.dll;" 
    Debug.AspNetCompiler.VirtualPath = "/localhost_54141" 
    Debug.AspNetCompiler.PhysicalPath = "Web\" 
    Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_54141\" 
    Debug.AspNetCompiler.Updateable = "true" 
    Debug.AspNetCompiler.ForceOverwrite = "true" 
    Debug.AspNetCompiler.FixedNames = "false" 
    Debug.AspNetCompiler.Debug = "True" 
    Release.AspNetCompiler.VirtualPath = "/localhost_54141" 
    Release.AspNetCompiler.PhysicalPath = "Web\" 
    Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_54141\" 
    Release.AspNetCompiler.Updateable = "true" 
    Release.AspNetCompiler.ForceOverwrite = "true" 
    Release.AspNetCompiler.FixedNames = "false" 
    Release.AspNetCompiler.Debug = "False" 
    VWDPort = "54141" 
    SlnRelativePath = "Web\" 
    StartServerOnDebug = "false" 
EndProjectSection 

エンドプロジェクト

ウェブサイトが構築されていません。

OK、ソリューションファイルを手動で編集し、Dev.XXXX、Test.XXXなどの関連設定を変更/追加することができます.Visual Studioでソリューションを開いて保存するまで、すべてうまくいきます。 Visual Studioはすべての変更を排出し、同じ問題が再び発生します。

回避策として、.slnファイルのコピーを作成し、元のソリューションと手動で同期させることができます。誰か良いアイデアはありますか?

答えて

0

異なるカスタムAspNetCompiler MSBuildタスクを使用してWebサイトプロジェクトを構築できます。このような:

dev.msbuild

<Project xmlns = "http://schemas.microsoft.com/developer/msbuild/2003"> 
     <Target Name = "PrecompileWeb"> 
       <AspNetCompiler 
         VirtualPath = "/dev" 
         PhysicalPath = "D:\Project\WebSite1\" 
         TargetPath = "PrecompiledWeb\dev\" 
         Force = "true"   
         Debug = "False" 
         Updateable = "true"/> 
     </Target> 
</Project> 

Test.msbuildこのような

<Project xmlns = "http://schemas.microsoft.com/developer/msbuild/2003"> 
      <Target Name = "PrecompileWeb"> 
        <AspNetCompiler 
          VirtualPath = "/test" 
          PhysicalPath = "D:\Project\WebSite1\" 
          TargetPath = "PrecompiledWeb\test\" 
          Force = "true"   
          Debug = "False" 
          Updateable = "true"/> 
      </Target> 
    </Project> 

ビルドコマンド:

MSBuild.exe dev.msbuild /m /p:TargetFrameworkVersion=v4.6.2;OutputPath=bin /ToolsVersion:14.0 
関連する問題