How can I prevent Visual Studio from creating license.licx

前端 未结 5 2254
野趣味
野趣味 2021-02-19 10:31

We use 3rd party controls in our project. Almost every time when I double click on a file which has a design view too, Visual Studio tries to bring up the designer with heroic e

相关标签:
5条回答
  • 2021-02-19 11:08

    If you use the EmptyLicensesLicx NuGet package, it will create an empty Licenses.licx file in your project on every build (which is all you really need).

    0 讨论(0)
  • 2021-02-19 11:22

    For your point #1, you could prevent double-clicking from opening the designer but instead open the code editor by default.

    You can do this by:

    • right-clicking on a .cs file that has a form
    • select "Open with..."
    • select "CSharp Editor" (or VB)
    • click "Set as Default"
    • and OK

    If you want to change it back later, follow same procedure but pick "CSharp Form Editor".

    0 讨论(0)
  • 2021-02-19 11:23

    That license.licx is important. You really do want it in your projects that use components licenced from third parties. If you don't use third party components, the licences.licx file will not be added.

    0 讨论(0)
  • 2021-02-19 11:30

    You can create a post build event that removes the .licx file for you. We've dealt with this annoyance on our team, and aside from manually excluding or deleting it, the post build event is your best bet. Every time you open a Windows Form, the file will be added again if that form is referencing or using any of the 3rd party .dlls.

    You can specify the pre and post build events via console or by right clicking on the project and selecting Properties -> Build Events. Hope this helps.

    0 讨论(0)
  • 2021-02-19 11:31

    If anyone is looking for solution for this problem because they are using precompiled licenses via Lc.exe tool and want to prevent licenses.licx from conflicting on build server, edit your csproj file, and change line that looks like this:

    <EmbeddedResource Include="Properties\licenses.licx" />
    

    into this:

    <ItemGroup Condition=" '$(Configuration)' != 'Release' " > <EmbeddedResource Include="Properties\licenses.licx" /> </ItemGroup>

    0 讨论(0)
提交回复
热议问题