Msbuild 中的 CSC 任务因命名空间错误而中止
我尝试了以下操作:
<!-- Specify the inputs by type and file name -->
<ItemGroup>
<CSFile Include = "$(MSBuildProjectDirectory)\..\Mine.cs"/>
</ItemGroup>
<Target Name = "Compile">
<!-- Run the Visual C# compilation using input files of type CSFile -->
<Csc Sources="@(CSFile)" />
<!-- Log the file name of the output file -->
<Message Text="The output file is done"/>
</Target>
这不起作用,因为项目中使用的所有命名空间都会抛出错误。有谁知道我如何显式地从解决方案文件中获取程序集,因为路径没问题,并且如果在 Visual Studio 中加载,一切都很好。我需要编写这个脚本,而上面的内容不起作用。有明显的事故吗?
感谢您的输入:-)
我已经意识到这不会起作用,因为我拥有的文件有几个外部依赖项。因此我需要使用 devenv.exe。问题是我得到以下信息:
我得到的是命令退出时显示代码 1?我想让项目构建它所需的所有依赖 dll,而无需打开 Visual Studio。
有什么想法吗?
谢谢:-)
I have attempted the following:
<!-- Specify the inputs by type and file name -->
<ItemGroup>
<CSFile Include = "$(MSBuildProjectDirectory)\..\Mine.cs"/>
</ItemGroup>
<Target Name = "Compile">
<!-- Run the Visual C# compilation using input files of type CSFile -->
<Csc Sources="@(CSFile)" />
<!-- Log the file name of the output file -->
<Message Text="The output file is done"/>
</Target>
This does not work as all the namespaces used in the project throw errors. Does anyone know how I can explicitly get the assemblies to pick up from the solution file, as the paths are ok and if loaded in Visual Studio all is fine. I need to script this and the above is not working. Is there an obvious mishap?
Appreciate the inpuT :-)
I have realised that this is not going to work as the file I have has several external dependancies. Hence I would need to use the devenv.exe. Problem is that I get the follwing:
What I get is that the command exits with Code 1? I want to get the project to build all the dependant dlls that it requires without having to open visual studio.
Any ideas?
Thnxes :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个(添加你自己的dll引用)
try this (add you own dlls references)