Olá, estou com um projeto em C# windows forms e preciso compilar e gerar o .exe
com o MSBuild. Porém, quando atualizo as fontes e executo para compilar, dá erro dizendo que a estrutura do código está errada: com ponto e virgula faltando, etc.
Mas, se eu entrar no mesmo projeto, compilar pela IDE Visual Studio e depois ir fazer pelo MSBuild, funciona sem erros. No meu caso preciso fazer a compilação onde não tem a IDE instalada.
Muito obrigado.
Mensagem de erro na compilação com MSBUILD :
"D:\CRIS\Programas_Cris\Projeto\Projeto.sln" (destino padrão) (1) ->"D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj" (destino padrão) (2) ->
(CoreCompile destino) -> FrmPrincipal.cs(117,54): error CS1525: Termo de expressão inválido 'int' [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
FrmPrincipal.cs(117,65): error CS1002: ; esperado [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
FrmPrincipal.cs(117,65): error CS1525: Termo de expressão inválido ',' [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
FrmPrincipal.cs(117,67): error CS1002: ; esperado [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
FrmPrincipal.cs(117,68): error CS1002: ; esperado [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
FrmPrincipal.cs(117,68): error CS1525: Termo de expressão inválido ')' [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
FrmPrincipal.cs(2028,55): error CS1525: Termo de expressão inválido 'int' [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
FrmPrincipal.cs(2028,61): error CS1002: ; esperado [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
FrmPrincipal.cs(2028,61): error CS1525: Termo de expressão inválido ')' [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
FrmPrincipal.cs(2028,62): error CS1002: ; esperado [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
FrmPrincipal.cs(2028,62): error CS1525: Termo de expressão inválido ')' [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
FrmPrincipal.cs(2028,63): error CS1002: ; esperado [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
FrmPrincipal.cs(2032,13): error CS1525: Termo de expressão inválido 'else' [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
FrmPrincipal.cs(2032,17): error CS1002: ; esperado [D:\CRIS\Programas_Cris\Projeto\Projeto\Projeto.csproj]
Aqui o arquivo .CsProj
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2E1B2020-4F0A-4F82-90E0-A08B8D3E0E2F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Projeto</RootNamespace>
<AssemblyName>Projeto</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Icone.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="DotNetZip, Version=1.13.8.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.13.8\lib\net40\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="System">
<HintPath>..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Classes\Funcoes.cs" />
<Compile Include="FrmImagemPDV.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmImagemPDV.Designer.cs">
<DependentUpon>FrmImagemPDV.cs</DependentUpon>
</Compile>
<Compile Include="FrmPrincipal.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmPrincipal.Designer.cs">
<DependentUpon>FrmPrincipal.cs</DependentUpon>
</Compile>
<Compile Include="Classes\INIFile.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmImagemPDV.resx">
<DependentUpon>FrmImagemPDV.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmPrincipal.resx">
<DependentUpon>FrmPrincipal.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="Icone.ico" />
<None Include="Img\Lupa.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>