命令行使用VBC编译Settings.settings [英] Command Line Compiling Settings.settings using VBC

查看:503
本文介绍了命令行使用VBC编译Settings.settings的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的早期问题,使用WinForms入侵VBC和NAnt ,我

在vbproj文件中,您具有以下内容:

Within vbproj file, you have the following:

<ItemGroup>
  <None Include="My Project\Settings.settings">
    <Generator>SettingsSingleFileGenerator</Generator>
    <CustomToolNamespace>My</CustomToolNamespace>
    <LastGenOutput>Settings.Designer.vb</LastGenOutput>
  </None>
</ItemGroup>
<ItemGroup>
  <Content Include="My Project\Application.myapp">
    <Generator>MyApplicationCodeGenerator</Generator>
    <LastGenOutput>Application.Designer.vb</LastGenOutput>
  </Content>
</ItemGroup>

当在Visual Studio中运行构建(Debug Verbosity设置为Normal)时,是:

When one runs build from within Visual Studio (Debug Verbosity set to Normal), one of the lines produces is:

Target CoreCompile:
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Vbc.exe ...

其中包括vbc.exe所需的所有设置跑。但是,从Visual Studio中获取该字符串,并直接在命令行上运行它:

Which includes all of the settings required for vbc.exe to run. However, taking that string from Visual Studio, and running it directly on the command line yields:

... My Project\Settings.Designer.vb(67) : error BC30002: Type 'My.MySettings' is not defined.
        Friend ReadOnly Property Settings() As Global.My.MySettings
...\My Project\Settings.Designer.vb(69) : error BC30456: 'My' is not a member of '<Default>'.
                Return Global.My.MySettings.Default

如何获得上述Generators从命令行,或者是有某个地方的调用会生成正确的临时文件,这是vbc.exe正确运行命令字符串所需的?

How does one get the above Generators to run from a command line, or is there a call somewhere that will generate the correct temp files that are needed for vbc.exe to run the command string correctly?

推荐答案

在visual studio中查看构建字符串的问题是,它实际上不是调用vbc.exe从visual studio构建。 Visual Studio中的所有构建都是使用内存编译器而不是命令行编译器(对于C#也是如此)。

The problem with looking at the build string within visual studio is that it's not actually calling vbc.exe to build from visual studio. All builds in visual studio happen with the in-memory compiler instead of the command line compiler (true for C# as well).

看起来像vbc.exe ...的命令是一个生成的字符串,实际上并未执行。如果要找出正确的字符串来构建项目,请从visual studio命令提示符处运行以下代码。

The command that looks like vbc.exe ... is a generated string that isn't actually executed. If you want to find out the correct string to build your project run the following code from a visual studio command prompt.

msbuild / v:diag myproject.vbproj

msbuild /v:diag myproject.vbproj

这将产生一个msbuild日志文件(它会很长,所以我建议管道到一个文件)。一旦构建完成后,在该文件中搜索vbc.exe。它将具有构建您的项目所需的实际命令行。

This will produce an msbuild log file (it will be quite long so I suggest piping to a file). Once the build is completed search for vbc.exe within that file. It will have the actual command line needed to build your project.

这篇关于命令行使用VBC编译Settings.settings的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆