2009-09-24 14 views
6

Mi sto abituando a usare nant per le versioni build. Ma ho iniziato ad usare asp.net MVC, e ho scelto di fare il setup per l'installazione con un .vdproj.Ho un errore nella creazione di un file .vdproj su msbuild con il numero

Ma, quando chiamo il:

< exec program="${dotnet.dir}/msbuild.exe" commandline='"./Wum.sln" /v:q /nologo /p:Configuration=Release' />

a Nant, il mio risultato è:

[exec] D:\My Documents\Visual Studio 2008\Projects\Wum\Wum.sln : warning MS 
B4078: The project file "Wum.Setup\Wum.Setup.vdproj" is not supported by MSBuild 
and cannot be built.

Qualcuno ha qualche idea, o una soluzione?

Se utilizzo lo schermo, avrò un problema?

risposta

7

MSBuild non può creare progetti .vdproj. È necessario utilizzare Visual Studio (devenv.com) per questo.

+0

... o passare dall'Installazione di Visual Studio .NET e Progetto di distribuzione a WiX che sarà comunque supportato in VS 2010. –

+0

Dai un'occhiata a http://wix.sourceforge.net/ per maggiori informazioni su WiX. –

+0

*** PERCHE 'MSBuild non può creare progetti .vdproj ***? qualsiasi riferimento completo in MSDN? Comunque, 'Wix' ha una curva di apprendimento molto grande ** – Kiquenet

3

FYI questo non è ancora supportato in .NET 4.0

10

Ecco come ho fatto di recente utilizzando devenv come msbuild non farà i file .vdproj. Questo articolo ha veramente aiutato con l'aggiornamento del file .vdproj prima: http://www.hanselman.com/blog/BuildingMSIFilesFromNAntAndUpdatingTheVDProjsVersionInformationAndOtherSinsOnTuesday.aspx

<target name="someTarget"> 
    <!-- full path to setup project and project file (MSI -> vdproj) --> 
    <property name="DeploymentProjectPath" value="fullPath\proj.vdproj" /> 
    <!-- full path to source project and project file (EXE -> csproj) --> 
    <property name="DependencyProject" value="fullPath\proj.csproj" /> 
    <script language="C#"> 
    <code> 
     <![CDATA[ 
     public static void ScriptMain(Project project) 
     { 
      //Purpose of script: load the .vdproj file, replace ProductCode and PackageCode with new guids, and ProductVersion with 1.0.SnvRevisionNo., write over .vdproj file 

      string setupFileName = project.Properties["DeploymentProjectPath"]; 
      string productVersion = string.Format("1.0.{0}", project.Properties["svn.revision"]); 
      string setupFileContents; 

      //read in the .vdproj file   
      using (StreamReader sr = new StreamReader(setupFileName)) 
      { 
       setupFileContents = sr.ReadToEnd(); 
      } 

      if (!string.IsNullOrEmpty(setupFileContents)) 
      { 
       Regex expression2 = new Regex(@"(?:\""ProductCode\"" = \""8.){([\d\w-]+)}"); 
       Regex expression3 = new Regex(@"(?:\""PackageCode\"" = \""8.){([\d\w-]+)}"); 
       Regex expression4 = new Regex(@"(?:\""ProductVersion\"" = \""8.)(\d.\d.\d+)"); 
       setupFileContents = expression2.Replace(setupFileContents,"\"ProductCode\" = \"8:{" + Guid.NewGuid().ToString().ToUpper() + "}"); 
       setupFileContents = expression3.Replace(setupFileContents,"\"PackageCode\" = \"8:{" + Guid.NewGuid().ToString().ToUpper() + "}"); 
       setupFileContents = expression4.Replace(setupFileContents,"\"ProductVersion\" = \"8:" + productVersion); 

       using (TextWriter tw = new StreamWriter(setupFileName, false)) 
       { 
        tw.WriteLine(setupFileContents); 
       } 
      } 
     } 
     ]]> 
    </code> 
    </script> 

    <!-- must build the dependency first (code project), before building the MSI deployment project --> 
    <exec program="Devenv.exe" commandline='"fullPath\solution.sln" /rebuild "Release" /project "${DependencyProject}" /out "fullPath\somelog.log"'/> 
    <exec program="Devenv.exe" commandline='"fullPath\solution.sln" /rebuild "Release" /project "${DeploymentProjectPath}" /out "fullPath\somelog.log"'/> 
</target> 
+0

@GarrisonNeely hai provato qualche script come '% DevEnv%"% BaseSln% "/ build"% BuildConfiguration% |% BuildPlatform% "/ Project"% BaseVdproj% "/ Out" vs_errors.txt "'? – Kiquenet

+0

Applica anche *** *** Script MSBuild *** ('* .targets')? – Kiquenet

1

Giusto per espandere il postale crise s' - la costruzione di un progetto di vdproj utilizzando VS2010 devenv attraverso la linea di comando non funziona. Pre-2010 funziona bene, credo (vedi link text)

+0

Sembra che ci siano alcuni problemi, stavo usando 2008. Microsoft ha dichiarato "La stima corrente per l'aggiornamento rapido è a metà agosto". – CRice