2009-09-24 7 views
6

Ich bin daran gewöhnt, Nant für Build-Releases verwenden. Aber ich habe angefangen, asp.net MVC zu verwenden, und ich wähle das Setup für die Installation mit einem .vdproj.Ich habe einen Fehler beim Erstellen eines .vdproj auf Msbuild mit Nant

Aber, als ich den Anruf:

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

in Nant, mein Ergebnis ist:

[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.

jemand einen Hinweis haben, oder eine Lösung?

Wenn ich den Devenv verwende, habe ich ein Problem?

Antwort

7

MSBuild kann keine .vdproj-Projekte erstellen. Sie sollten dafür Visual Studio (devenv.com) verwenden.

+0

... oder von Visual Studio .NET Setup und Deployment Project zu WiX, die sowieso in VS 2010 unterstützt wird. –

+0

Werfen Sie einen Blick auf http://wix.sourceforge.net/ für weitere Informationen zu WiX. –

+0

*** Warum kann MSBuild keine .vdproj-Projekte *** erstellen? eine vollständige Referenz in MSDN? Wie auch immer, "Wix" hat eine sehr große ** Lernkurve ** – Kiquenet

3

FYI ist dies noch nicht unterstützt, in .NET 4.0

10

Hier ist, wie ich das tat vor kurzem mit devenv als msbuild werden die Dateien nicht tun .vdproj. Dieser Artikel wirklich mit der Aktualisierung der .vdproj Datei zuerst geholfen: 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 Hast du irgendein Skript wie '% DevEnv%"% BaseSln% "/ Build"% BuildConfiguration% |% BuildPlatform% "/ Projekt"% BaseVdproj% "/ Out" vs_errors.txt "'? – Kiquenet

+0

Gilt auch *** MSBuild-Skript *** ('* .targets')? – Kiquenet

1

einfach zu erweitern auf crise ‚s Post - Aufbau eines vdproj Projekt mit VS2010 devenv durch Befehlszeile funktioniert nicht. Pre-2010 funktioniert gut Ich glaube (siehe link text)

+0

Sieht so aus, als gäbe es einige Probleme, die ich 2008 benutzte. Microsoft hat gesagt "Die aktuelle Schätzung für den Hotfix ist Mitte August." – CRice

Verwandte Themen