Visual studio 如何在没有Visual Studio的情况下从comand line使用MSBuild.exe生成代码
您能一步一步地解释一下如何在没有Visual Studio的情况下使用命令行生成代码并生成DLL吗Visual studio 如何在没有Visual Studio的情况下从comand line使用MSBuild.exe生成代码,visual-studio,msbuild,msbuild-4.0,Visual Studio,Msbuild,Msbuild 4.0,您能一步一步地解释一下如何在没有Visual Studio的情况下使用命令行生成代码并生成DLL吗 我正在使用VisualStudio2010SP1。我需要一个示例文件(.sln、.csproj),它将与MSBuild一起使用,并且需要一个命令,使我可以在不使用Visual Studio的情况下编译代码并生成DLL。最终我得到了解决方案 Please do following steps to generate DLL from xml file without having Visual St
我正在使用VisualStudio2010SP1。我需要一个示例文件(.sln、.csproj),它将与MSBuild一起使用,并且需要一个命令,使我可以在不使用Visual Studio的情况下编译代码并生成DLL。最终我得到了解决方案
Please do following steps to generate DLL from xml file without having Visual Studio IDE.
Basically, we require only two types files
1. class file like Helloworld.cs , Welcome.cs
2. XML file
Here below is the format of XML file which helps to generate DLL file
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Generate DLL/Assembly Name -->
<AssemblyName>MSBuildSample</AssemblyName>
<OutputPath>Bin\</OutputPath>
<OutputType>Library</OutputType>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Linq" />
</ItemGroup>
<ItemGroup>
<!-- Mentioned here class file to compile -->
<Compile Include="Helloworld.cs" />
<Compile Include="Welcome.cs" />
<!-- <Compile Include="C:\testing\test.Designer.cs" />
<EmbeddedResource Include="C:\testing\test.resx" /> -->
</ItemGroup>
<Target Name="Build">
<Csc Sources="@(Compile)"
Resources="@(EmbeddedResource)"
References="@(Reference)"
TargetType="library"
OutputAssembly="C:\testing\test.dll" />
</Target>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
这将帮助您在没有VisualStudio的情况下从XML文件编译和生成DLL
这是一个非常基本的.xml文件,但您也可以从项目文件(.csproj)中编译并生成dll文件。如果.csproj文件中不存在以下行,则只需添加以下行
<PropertyGroup>
<OutputType>Library</OutputType>
<OutputPath>Bin\</OutputPath>
</PropertyGroup>
图书馆
垃圾桶
您的意思是机器上没有安装Visual Studio?当然,您已经安装了它,但想使用命令行吗?我的意思是,我想使用MSBuild命令行编译/生成代码,并从.sln和.csproj文件生成DLL,而不使用Visual Studio(IDE)。
<PropertyGroup>
<OutputType>Library</OutputType>
<OutputPath>Bin\</OutputPath>
</PropertyGroup>